Seeks the closest local extremum to a given initialPoint for the unidimensional differentiable object function using information from a user selected set of bracketing and location algorithms.
extremumType == ExtremumTypes.MINIMUM; and in the case of a maximum, extremumType == ExtremumTypes.MAXIMUM.(result - tolerance, result + tolerance). Hence, the value for the tolerance, should reflect the level of accuracy required.300. If the number of iterations exceeds this number TooManyUniDimensionalIterationsException will be thrown.the first local extremum found which is either greater than the initialPoint in the case of a maximum being sought, or less than the initialPoint in the case of the minimum being sought.
Unlike SeekExtremeValueUnidir and SeekExtremeUnidir which use only one pair of bracketing and locate algorithms and which can be rather imprecise. This method uses information from a set of user defined bracketing and locate algorithms, if you wish we also provide the method SeekNextExtremeDeriv, for which we have selected a collected of bracketing and location algorithms. Though the justification for this approach is heuristic in nature in many instances it leads to a improvement in the accuracy of the results found. Moreover, this approach also has the important property that the probability to miss extremum is greatly reduced.
The basic idea of this approach is that for each iteration all the algorithms chosen are invoked (even if there are duplicates) and the "best" next point of all the algorithms is used as the starting point of the next iteration. The precision used in each of the bracketing and locate algorithms should be similar (possibly even identical). The precision used should also increase as the initial point moves closer to the local extremum. In order to ensure the efficient execution of this approach certain care must be taken in the selection of the algorithms used. The reason being that for algorithms which fail for the given problem at hand though not influencing the result, will make significant computation demands during the methods execution.
Before this method is called the uni-dimensional object function of the optimization problem must be set (i.e. provided for the method) using either {@link #setFunction}, or passed using the constructor during the instantiation of the instance of the UniDimensionalSolver class. For further details, detailing exactly how the object function is implemented and then send to an instance of this class we refer the reader to SetFunction documentation. In is true that most users will find the {@link #setFunction} approach to be more user friendly, however it should be pointed out that if your application uses threads then this approach is not thread safe.
Once the object function has been set you should specify the set of bracketing and locate algorithms which are used within this method, by passing as parameters the appropriate procedures from the classs BracketingAlgorithm and LocateAlgorithm.
Finally the initialPoint from which the closest local extremum will be sought
must be given. It is also necessary to provide the type of extremum sought along with the tolerance
and the maximum number of iterations which can be used.
| Exception Type | Condition |
|---|---|
| UniDimensionalException | Thrown if the delivered function does not implement Derivative or an interface which extends Derivative. |
| TooManyUniDimensionalIterationsException | Thrown if the number of iterations is grater than maxIterations. |
| InvalidUniDimensionalFunctionException | Thrown if the user function returns invalid values like infinity or NaN. |
UniDimensionalSolver Class | WebCab.COM.Math.Optimization.UniDimensional Namespace