protected override void Context() { base.Context(); _jacobianMatrix = new JacobianMatrix(new[] { "A" }); _parameterIdentification.Configuration.CalculateJacobian = true; A.CallTo(_jacobianMatrixCalculator).WithReturnType <JacobianMatrix>().Returns(_jacobianMatrix); A.CallTo(() => _algorithm.Optimize(A <OptimizedParameterConstraint[]> ._, A <Func <IReadOnlyList <OptimizedParameterValue>, OptimizationRunResult> > ._)) .Invokes(x => { var objectiveFunction = x.GetArgument <Func <IReadOnlyList <OptimizedParameterValue>, OptimizationRunResult> >(1); objectiveFunction(new[] { new OptimizedParameterValue("P1", 5d, 5d) }); }); }
protected override void Context() { sut = new MatrixCalculator(); _residualsResult = new ResidualsResult(); _jacobianMatrix = new JacobianMatrix(new[] { "P1", "P2" }); _jacobianMatrix.AddRow(new JacobianRow("O1", 1, new[] { 1d, 5d })); _jacobianMatrix.AddRow(new JacobianRow("O1", 2, new[] { 2d, 11d })); _jacobianMatrix.AddRow(new JacobianRow("O1", 3, new[] { 3d, 12d })); _jacobianMatrix.AddRow(new JacobianRow("O1", 4, new[] { 4d, 2d })); _residualsResult.AddOutputResiduals( "01", new DataRepository("OBS"), new[] { new Residual(1, 0.1000, 1), new Residual(2, -0.200, 1), new Residual(3, 1.0000, 1), new Residual(4, 0.5000, 1) } ); }