33// http://numerics.mathdotnet.com
44// http://github.com/mathnet/mathnet-numerics
55//
6- // Copyright (c) 2009-2017 Math.NET
6+ // Copyright (c) 2009-2021 Math.NET
77//
88// Permission is hereby granted, free of charge, to any person
99// obtaining a copy of this software and associated documentation
@@ -61,44 +61,44 @@ public static double OfScalarFunction(Func<double, double> function, double init
6161 /// Find vector x that minimizes the function f(x) using the Nelder-Mead Simplex algorithm.
6262 /// For more options and diagnostics consider to use <see cref="NelderMeadSimplex"/> directly.
6363 /// </summary>
64- public static Tuple < double , double > OfFunction ( Func < double , double , double > function , double initialGuess0 , double initialGuess1 , double tolerance = 1e-8 , int maxIterations = 1000 )
64+ public static ( double P0 , double P1 ) OfFunction ( Func < double , double , double > function , double initialGuess0 , double initialGuess1 , double tolerance = 1e-8 , int maxIterations = 1000 )
6565 {
6666 var objective = ObjectiveFunction . Value ( v => function ( v [ 0 ] , v [ 1 ] ) ) ;
6767 var result = NelderMeadSimplex . Minimum ( objective , CreateVector . Dense ( new [ ] { initialGuess0 , initialGuess1 } ) , tolerance , maxIterations ) ;
68- return Tuple . Create ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] ) ;
68+ return ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] ) ;
6969 }
7070
7171 /// <summary>
7272 /// Find vector x that minimizes the function f(x) using the Nelder-Mead Simplex algorithm.
7373 /// For more options and diagnostics consider to use <see cref="NelderMeadSimplex"/> directly.
7474 /// </summary>
75- public static Tuple < double , double , double > OfFunction ( Func < double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double tolerance = 1e-8 , int maxIterations = 1000 )
75+ public static ( double P0 , double P1 , double P2 ) OfFunction ( Func < double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double tolerance = 1e-8 , int maxIterations = 1000 )
7676 {
7777 var objective = ObjectiveFunction . Value ( v => function ( v [ 0 ] , v [ 1 ] , v [ 2 ] ) ) ;
7878 var result = NelderMeadSimplex . Minimum ( objective , CreateVector . Dense ( new [ ] { initialGuess0 , initialGuess1 , initialGuess2 } ) , tolerance , maxIterations ) ;
79- return Tuple . Create ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] ) ;
79+ return ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] ) ;
8080 }
8181
8282 /// <summary>
8383 /// Find vector x that minimizes the function f(x) using the Nelder-Mead Simplex algorithm.
8484 /// For more options and diagnostics consider to use <see cref="NelderMeadSimplex"/> directly.
8585 /// </summary>
86- public static Tuple < double , double , double , double > OfFunction ( Func < double , double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double tolerance = 1e-8 , int maxIterations = 1000 )
86+ public static ( double P0 , double P1 , double P2 , double P3 ) OfFunction ( Func < double , double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double tolerance = 1e-8 , int maxIterations = 1000 )
8787 {
8888 var objective = ObjectiveFunction . Value ( v => function ( v [ 0 ] , v [ 1 ] , v [ 2 ] , v [ 3 ] ) ) ;
8989 var result = NelderMeadSimplex . Minimum ( objective , CreateVector . Dense ( new [ ] { initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 } ) , tolerance , maxIterations ) ;
90- return Tuple . Create ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] , result . MinimizingPoint [ 3 ] ) ;
90+ return ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] , result . MinimizingPoint [ 3 ] ) ;
9191 }
9292
9393 /// <summary>
9494 /// Find vector x that minimizes the function f(x) using the Nelder-Mead Simplex algorithm.
9595 /// For more options and diagnostics consider to use <see cref="NelderMeadSimplex"/> directly.
9696 /// </summary>
97- public static Tuple < double , double , double , double , double > OfFunction ( Func < double , double , double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double initialGuess4 , double tolerance = 1e-8 , int maxIterations = 1000 )
97+ public static ( double P0 , double P1 , double P2 , double P3 , double P4 ) OfFunction ( Func < double , double , double , double , double , double > function , double initialGuess0 , double initialGuess1 , double initialGuess2 , double initialGuess3 , double initialGuess4 , double tolerance = 1e-8 , int maxIterations = 1000 )
9898 {
9999 var objective = ObjectiveFunction . Value ( v => function ( v [ 0 ] , v [ 1 ] , v [ 2 ] , v [ 3 ] , v [ 4 ] ) ) ;
100100 var result = NelderMeadSimplex . Minimum ( objective , CreateVector . Dense ( new [ ] { initialGuess0 , initialGuess1 , initialGuess2 , initialGuess3 , initialGuess4 } ) , tolerance , maxIterations ) ;
101- return Tuple . Create ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] , result . MinimizingPoint [ 3 ] , result . MinimizingPoint [ 4 ] ) ;
101+ return ( result . MinimizingPoint [ 0 ] , result . MinimizingPoint [ 1 ] , result . MinimizingPoint [ 2 ] , result . MinimizingPoint [ 3 ] , result . MinimizingPoint [ 4 ] ) ;
102102 }
103103
104104 /// <summary>
@@ -144,7 +144,7 @@ public static Vector<double> OfFunctionGradient(Func<Vector<double>, double> fun
144144 /// For more options and diagnostics consider to use <see cref="BfgsMinimizer"/> directly.
145145 /// An alternative routine using conjugate gradients (CG) is available in <see cref="ConjugateGradientMinimizer"/>.
146146 /// </summary>
147- public static Vector < double > OfFunctionGradient ( Func < Vector < double > , Tuple < double , Vector < double > > > functionGradient , Vector < double > initialGuess , double gradientTolerance = 1e-5 , double parameterTolerance = 1e-5 , double functionProgressTolerance = 1e-5 , int maxIterations = 1000 )
147+ public static Vector < double > OfFunctionGradient ( Func < Vector < double > , ( double , Vector < double > ) > functionGradient , Vector < double > initialGuess , double gradientTolerance = 1e-5 , double parameterTolerance = 1e-5 , double functionProgressTolerance = 1e-5 , int maxIterations = 1000 )
148148 {
149149 var objective = ObjectiveFunction . Gradient ( functionGradient ) ;
150150 var algorithm = new BfgsMinimizer ( gradientTolerance , parameterTolerance , functionProgressTolerance , maxIterations ) ;
@@ -168,7 +168,7 @@ public static Vector<double> OfFunctionGradientConstrained(Func<Vector<double>,
168168 /// Find vector x that minimizes the function f(x), constrained within bounds, using the Broyden–Fletcher–Goldfarb–Shanno Bounded (BFGS-B) algorithm.
169169 /// For more options and diagnostics consider to use <see cref="BfgsBMinimizer"/> directly.
170170 /// </summary>
171- public static Vector < double > OfFunctionGradientConstrained ( Func < Vector < double > , Tuple < double , Vector < double > > > functionGradient , Vector < double > lowerBound , Vector < double > upperBound , Vector < double > initialGuess , double gradientTolerance = 1e-5 , double parameterTolerance = 1e-5 , double functionProgressTolerance = 1e-5 , int maxIterations = 1000 )
171+ public static Vector < double > OfFunctionGradientConstrained ( Func < Vector < double > , ( double , Vector < double > ) > functionGradient , Vector < double > lowerBound , Vector < double > upperBound , Vector < double > initialGuess , double gradientTolerance = 1e-5 , double parameterTolerance = 1e-5 , double functionProgressTolerance = 1e-5 , int maxIterations = 1000 )
172172 {
173173 var objective = ObjectiveFunction . Gradient ( functionGradient ) ;
174174 var algorithm = new BfgsBMinimizer ( gradientTolerance , parameterTolerance , functionProgressTolerance , maxIterations ) ;
@@ -191,7 +191,7 @@ public static Vector<double> OfFunctionGradientHessian(Func<Vector<double>, doub
191191 /// Find vector x that minimizes the function f(x) using the Newton algorithm.
192192 /// For more options and diagnostics consider to use <see cref="NewtonMinimizer"/> directly.
193193 /// </summary>
194- public static Vector < double > OfFunctionGradientHessian ( Func < Vector < double > , Tuple < double , Vector < double > , Matrix < double > > > functionGradientHessian , Vector < double > initialGuess , double gradientTolerance = 1e-8 , int maxIterations = 1000 )
194+ public static Vector < double > OfFunctionGradientHessian ( Func < Vector < double > , ( double , Vector < double > , Matrix < double > ) > functionGradientHessian , Vector < double > initialGuess , double gradientTolerance = 1e-8 , int maxIterations = 1000 )
195195 {
196196 var objective = ObjectiveFunction . GradientHessian ( functionGradientHessian ) ;
197197 var result = NewtonMinimizer . Minimum ( objective , initialGuess , gradientTolerance , maxIterations ) ;
0 commit comments