Solving Nonlinear Models using the Nelder-Mead and HLS Solvers
Microsoft Solver Foundation provides support for solving nonlinear models. It offers two solvers for nonlinear models: Nelder-Mead and hybrid local search (HLS).
The Nelder-Mead solver is new in Microsoft Solver Foundation 3.1. This solver is the default for unconstrained nonlinear models with optionally bounded variables that have no integer variables. It can also handle handling nonconvex or nondifferentiable goals. The Nelder-Mead solver often gives better results than the HLS solver (described in the next section), but it cannot handle all of the different types of nonlinear models that the HLS solver can. In particular, it cannot handle models that use constraints.
Hybrid Local Search (HLS) Solver
The HLS solver is a general purpose solver that is designed to solve constrained nonlinear models. You can use the HLS solver for any Optimization Modeling Language (OML) model or for any model that you create by using Developing with Solver Foundation Services (SFS). The HLS solver is the default solver for nonlinear models with integer variables, for mixed integer nonlinear programming models, and for any model that includes the trigonometric functions added in Microsoft Solver Foundation 3.0.
Although you can use the HLS solver with any model type by using an HLS directive or by registering the HLS solver in a configuration file, in most scenarios you achieve better results by using a more specific solver, such as the simplex solver.
The following considerations apply to the HLS solver:
It does not guarantee optimal results.
It does not match the support for linear terms that are provided by some other Solver Foundation solvers.
It does not provide infeasibility detection, but continues solving until it finds an optimal solution.
You can use the RunUntilTimeout property in the HybridLocalSearchDirective class to specify when a solver should stop solving. If RunUntilTimeout is set to true, the solver continues to search for better solutions until the timeout expires. Whenever the solver finds a better solution, it invokes the callback function provided by the Solving event. If RunUntilTimeout is set to false, the solver stops solving when it finds a local optimal solution.
Although the Excel add-in does not support event-based programming, you can set a similar property by using a Hybrid Local Search directive on the Directives tab of the Modeling Pane.
Use the following recommendations to improve the performance of the HLS solver:
Provide a range for decision variables if you can. Set the range of a decision instead of using a constraint, if the same effect can be achieved in a decision.
For example, in OML use
Decisions[Reals[-10, 10], x]
Decisions[Reals, x] Constraints[ -10 <= x <= 10]
If you are using Solver Foundation Services, try to use SetInitialValue(Rational, Object).
The HLS solver typically finds solutions quickly when there is a dense solution space, that is, the model is underconstrained.
Review your model and remove nonessential constraints, or change the model if possible so that a more specific solver, such as the Simplex solver, can accept it.
In the Excel add-in, click Summary to verify the model type determined by Solver Foundation.
When you debug, add constraints one at a time or in small groups, and test the performance impact with each new addition.