Performs a line search on a given function using the golden section algorithm.
Namespace:
ceometric.VectorGeometryAssembly: ceometric.VectorGeometry (in ceometric.VectorGeometry.dll) Version: 1.8.0.0 (1.8.0.0)
Syntax
C# |
---|
public static double GoldenSection( double epsilon, double lowerBound, double upperBound, LineSearch..::.ObjectiveFunction function ) |
Visual Basic (Declaration) |
---|
Public Shared Function GoldenSection ( _ epsilon As Double, _ lowerBound As Double, _ upperBound As Double, _ function As LineSearch..::.ObjectiveFunction _ ) As Double |
Visual C++ |
---|
public: static double GoldenSection( double epsilon, double lowerBound, double upperBound, LineSearch..::.ObjectiveFunction^ function ) |
Parameters
- epsilon
- Type: System..::.Double
The convergence interval length.
- lowerBound
- Type: System..::.Double
The lower bound of the initial interval.
- upperBound
- Type: System..::.Double
The upper bound of the initial interval.
- function
- Type: ceometric.VectorGeometry..::.LineSearch..::.ObjectiveFunction
The delegate function y = f(x) to minimize.
Return Value
Returns the unknown x* of the objective function y = f(x) that minimizes the function.Remarks
The objective function function must be a function y = f(x), where
'y' is the return value of the function and 'x' is the only parameter of the function.
This method returns the optimum x* of the objective function if and only if the objective function is
unimodal and convex. The optimum x* lies within a convergence interval of length epsilon
Examples
CopyC#
... LineSearch.ObjectiveFunction objective = new LineSearch.ObjectiveFunction(FooFunctions.barSquared); // for example, find the minimum in an interval of [-10,10] // the result has an accuracy of 1e-6 double result = LineSearch.GoldenSection(1e-6, -10, 10, objective) ....