The MultiDimensionalSolver class offers methods for finding the location of the extremum (i.e. minimum or maximum) of a function of many real variables (or equivalently, a function defined on a multi dimensional real space) with or without linear constraints.
For a list of all members of this type, see MultiDimensionalSolver Members.
System.Object
MultiDimensionalSolver
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 its 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 its maximum or minimum value over the entire domain for which the optimization problem is considered. Here we offer procedures which are designed for finding 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. In particular, you should 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.
Depending on the nature of the object function at hand will determine which of the algorithms firstly can be used and secondly which algorithm(s) are most appropriate. Below we give the algorithms which you should use in the case of optimization problems with a general or differentiable (multidimensional) object function:
Remark: If your object function is Linear then you should use the Simplex Algorithm found in the LinearProgramming class.
At present we only offer algorithms which can treat problems with linear constraints. In instances where you have non-linear boundaries (i.e. boundaries which are not flat hyperplanes) you will need to linearize the boundaries in order to apply these algorithms. For optimization problems with linear constraints we offer:
All the algorithms listed within this class will yield a local extremum for any compatible optimization problem. However, in practice it is often the global extremum which is sort and often a (local) extremum found will not turn out to be a global extremum for the given optimization problem at hand. In order to address this need the technique known as Simulated Annealing which can be applied `on top' of any of the optimization algorithms for finding the local extremum. This will greatly increase the chance of the global extremum. At present we offer the following Simulating Annealing enable (local) optimization procedures:
Remark: If the object function is linear then the Simplex algorithm should be used from the LinearProgramming class which will always yield a global extremum.
An Optimization problem may also have constraints, such problems are referred to as constrained optimization. In the case of Linear Programming (see LinearProgramming) where the object function and constraints are linear there exists efficient and refined algorithms. However, for general multi-dimensional constrained optimization problems there are no known efficient general algorithms. Therefore in practice specific algorithms are developed to address particular instances of the general problem. We have implemented one such algorithm, known as Rosen's algorithm (see LinearConstraintRosen) which deals with the case when the constraints are linear and the object function is differentiable.
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 more `well behaved' the function is. The more `well behaved the function the more efficient and stable the optimization algorithms contained within the class will be when applied to the given function at hand. This principle is true whether we are dealing within general or differentiable functions. The reason for this is that the `greedy type' algorithms implemented here (excluding simulated annealing) have as there 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 more effectively as the function which it is applied to 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 restrictive since in most practical applications. The reason being that processes generated from real world systems such as economic systems are in nearly all cases 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
InvalidMultiDimensionalFunctionException
exception. If this exception is thrown then you will be able to call methods within the
Exception class which provide the point where the function evaluates to Double.NaN.
By modifying your given function at points where it returns a NaN you should be able to
modify the optimization problem so that the essential features of the underlying problem
are preserved but the optimization algorithm can be successfully applied.
As mentioned before the local extremum (i.e. minimum or maximum) is just the extremum in a neighborhood of a point, where as 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 but this problem in general is very difficult. The difficulty lies in the fact that `greedy type' optimization methods used here are an abstraction of methods based on differential calculus and hence use the local differentiable information about function in order to move closer to the extremum. The problem with such local methods is that even if they find a (local) extremum they have no way of knowing whether that (local) extremum is in fact the global extremum.
In the case of uni-dimensional optimization there are effective algorithms for finding the global extremum; for example UniDimensionalSolver.globalExtremeDeriv, GlobalExtreme. However, in the multi-dimensional case we are required to use one of the three approaches:
The first two approaches listed above are heuristic in nature and should be applied with particular insight into the problem at hand. The third approach simulated annealing is a general technique which can be applied to any of the standard local multi-dimensional optimization algorithms in order to transform them from an algorithm design to find local extremum to an algorithm which is much more likely to find a global extremum (see GlobalAnnealing or the PDF documentation for more details).
Before any of the optimization procedures offered within this class are called the multi-dimensional object function must be set using either SetFunction, or by passing the object function with the constructor of this MultiDimensionalSolver class.
Remark: It your clients uses threads then it should be pointed out that the procedure using SetFunction is not thread safe.
The MultiDimensionalException is thrown if a function is not set in the case of application of methods which require (general) functions, or if the differentiable function is not set, that is you do not also supply the derivative.
Within this class we offer eight algorithms aimed at unconstrained optimization with object functions will differing qualitative properties and one algorithm for constrained optimization.
Namespace: WebCab.COM.Math.Optimization.MultiDimensional
Assembly: WebCab.COM.Optimization (in WebCab.COM.Optimization.dll)
MultiDimensionalSolver Members | WebCab.COM.Math.Optimization.MultiDimensional Namespace