The UniDimensionalSolver class offers methods for finding the location of the extremum (i.e. minimum or maximum) of a function of one real variable.
For a list of all members of this type, see UniDimensionalSolver Members.
System.Object
UniDimensionalSolver
That is, we offer procedures for finding the extremum of a function defined over a one dimensional real space (i.e. the real line) with or without upper and lower bounds.
Each of the procedures provided within this class proceeds by first being passed the object function of the optimization problem for which the location of the extremum is to be found. We then call one of the optimization procedures giving various parameters used to define procedure specific information such as the tolerance used and in the case of constrained optimization the constraints which must be satisfied. In most instances we are also required to provide an initial point from where the given optimization procedure will start it iterative search of the (local or global) extremum.
The aim of the theory of optimization is to find the location of the extremum (i.e. maximum or minimum) of a (possibly constrained) function defined over one or more (real) dimensions. An extremum point can be either local or global. A local extremum is a point such that the object function is known to obtain its highest (in the case of maximization) or lowest (in the case of minimization) value within a given sub-region of the entire domain over which the optimization problem is considered. A global extremum is the point at which the (object) function takes it maximum or minimum value over the entire domain for which the optimization problem is considered. Here we offer procedures which are designed for finding both the local and global extremum.
You should select an optimization procedure to use in accordance with the properties of the optimization problem you are considering. For the unidimensional case there are two approaches to selecting the particular algorithm to use, as described below:
This approach focuses on the properties of the problem at hand. In particular, we take into account the following criteria when selecting the particular optimization procedure to use:
By using this information and taking into account your particular applications needs you will able to select the most appropriate procedure to use.
It is also true that in the unidimensional optimization case the algorithms can be roughly broken down into the following three categories:
Apart from categorizing your problem within one of these three criteria the only other information required in the selection of an approach is whether the object function of your optimization problem is differentiable or not, and in the case of the second and third categories whether you wish to select the set of bracketing and locate algorithms which is used within the procedure.
Unless you particular wish to fine tune the optimization algorithms for your given problem at hand we strongly advise that when wishing to find the local or global extremum over an interval that the algorithms with a preset default set of bracketing and locate algorithms are used. The algorithms with these preset internal algorithms are as follows:
Remark: The function used within an optimization problem must be provided using SetFunction, which takes as a parameters an instance of a class which implements one of the UniDimensionalFunction sub-interfaces. When we refer to a function being general we refer to the fact that only the GetValueAt method, giving the functions value at a points has been implemented. By differentiable function we refer to the fact that in addition to the implementation of this method you have also implemented GetDerivativeAt.
To offer the greatest power and flexibility we provide methods which allow the Bracketing and Locate algorithms used within the optimization procedures to be selected and configured. This allows the algorithm to be finely tuned to find the exact requirements of your problem at hand and the level of precision and robustness required. We offer the following four procedures, two for finding the local extremum and two for finding the global extremum:
For those who require speed at the expense of precision we offer the following methods for finding the local extremum of a general function which are not even necessarily continuous.
For all three of these methods the specific bracketing and locate algorithms used within the algorithm must be selected (i.e. given via a parameter) from the class's BracketingAlgorithm and LocateAlgorithm.
A very effective means by which to select the optimal Bracketing and Locate algorithm combination for your particular problem, is to just try the 16 combinations of algorithms and then compare the results found. To assist (and demonstrate) this approach we provide within this package client examples which solve various unidimensional optimization problems using the various combinations of Bracketing and Locate algorithms. By adopting these examples (i.e. set your function rather than use the preset object function) you will be able to select the optimal bracketing and locate algorithm combination for your particular optimization problem but just comparing the results given by the various algorithms.
For unidimensional optimization problems the constraints can only take very simple forms,
for example lowerBound ≤ x ≤ upperBound, where lowerBound,
upperBound are two given real numbers. Therefore we are able to offer a number of
refined algorithms to deal with the unidimensional constrained case, two such examples are
GlobalExtremeDeriv, and GlobalExtreme.
As mentioned above the algorithms implemented within this class work most efficiently when the functions are `well behaved'. Generally speaking what we mean by `well behaved' is that the smoother the function, the more `well behaved' the function is. This is important to our study here since generally the more `well behaved' a function the more efficient and stable the optimization algorithms contained within this class will be when applied to the given function at hand. This principle is true for both general or differentiable functions.
The reason for this is that the `greedy type' algorithms implemented here have as a basis that at each iterative step we move to the extremum point within a given neighborhood lying in one of a number of chosen directions. Such `greedy type' or calculus inspired arguments work increasingly more effectively as the function on which they are applied gets smoother.
Remark: In practice, the requirement that the majority of the procedures within this class require that the object function is continuous or even differentiable is not a restriction with most practical applications. The reason being that processes generated from real world systems such as economic systems will result in the study of object functions which are in nearly all cases are continuous and even differentiable.
It is also important to point out that though we may consider non-continuous functions
with some of the algorithms these functions must never return a NaN (Not a
number). In order to guarantee this we must ensure that for all points within the domain
over which the optimization problem is considered the object function does not return
such as value. If such an value is returned, the algorithms will exit and throw an
InvalidUniDimensionalFunctionException
exception. If this exception is thrown, you will then be able to call methods within the
Exception class which provide the coordinate value of the point where the function evaluates
to a Double.NaN. By modifying your given function at points where it returns
a NaN you should be able to modify the object function of the optimization
problem so that the essential features of the underlying problem are preserved but the
optimization algorithm can be successfully applied.
The local extremum (i.e. minimum or maximum) is just the extremum in a neighborhood of a point, where the global extremum is the extremum on the whole domain over which the optimization problem is considered. In practice it is generally the global extremum which is desired and for constrained optimization problems (i.e. with an upper and lower bound) we provide effective algorithms which treat this case, namely:
For unconstrained optimization problems since you can never be certain that the local extremum is in fact the global extremum. There are no iterative algorithms which are effective at finding the global extremum of a unconstrained problem.
Before any of the optimization procedures offered within this class are called the uni-dimensional object function must be set using either SetFunction, or by passing the object function with the constructor of this UniDimensionalSolver class.
Remark: If your clients uses threads then it should be pointed out that set the functions using SetFunction is not thread safe.
The UniDimensionalException is thrown if a function is not set and one of the optimization solver algorithms is called. If the algorithm requires a differential object function and a differentiable function has not been set then a UniDimensionalException will be thrown. For details concerning the implementation and the setting of a function please see the documentation of SetFunction.
Namespace: WebCab.COM.Math.Optimization.UniDimensional
Assembly: WebCab.COM.Optimization (in WebCab.COM.Optimization.dll)
UniDimensionalSolver Members | WebCab.COM.Math.Optimization.UniDimensional Namespace