GAMS [ Home | Downloads | Documentation | Solvers | APIs | Tools | Model Libraries | Resources | Sales | Support | Contact Us | Search ]


LocalSolver is an innovative mathematical programming solver developed and maintained by the company Innovation 24. LocalSolver finds high-quality solutions for large-scale mixed-variable non-convex optimization problems. Based on a unique hybrid neighborhood search approach, it combines local search techniques, constraint propagation and inference techniques, linear and mixed-integer programming techniques, as well as nonlinear programming techniques.

LocalSolver works on the algebraic representation of the model. As such, most common GAMS functions are supported, including logical operators and equations. However, GAMS extrinsic functions cannot be used together with LocalSolver. Also special-ordered-set variables are currently not supported.

LocalSolver requires all variables to have finite bounds. Currently, the GAMS/LocalSolver link sets missing variable bounds to ±1e10, but the user is invited to provide proper bounds. However, no bounds should be set for variables that can be aggregate out by the solver link (aggrvars option).

LocalSolver is usually not able to prove infeasibility of the problem or global optimality of a solution and thus continues the search until interrupted by a limit (iterlim, reslim) or the user (Ctrl+C) or when found a solution with value equal or better of the dualbound option. It is thus important to set an iteration limit or a time limit that is appropriate to the model.

Using GAMS/LocalSolver

The following statement can be used inside your GAMS program to specify using LocalSolver:

Option MIP = LocalSolver;  { or MIQCP or MINLP or ... }

The above statement should appear before the solve statement. If LocalSolver was specified as the default solver during GAMS installation, the above statement is not necessary.

The following GAMS options are used by GAMS/LocalSolver: iterlim, reslim, and threads.

Additionally, a GAMS/LocalSolver run can be customized by a using a solver options file. With the following example, one disables the automated aggregation of variables in the GAMS/LocalSolver link and sets the seed for the random number generator in LocalSolver to 42:

aggrvars 0
seed     42

The following options can be set:

Option Description Default
aggrvars Automatically find and aggregate out variables.
If this option is enabled, the GAMS/LocalSolver link will look for free continuous variables that it can substitute out by using equality equations in which these variables appear linearly. A heuristic procedure has been implemented to substitute out as many variables as possible.
annealinglevel Simulated annealing level (higher numbers increase the number of uphill moves, thus increases chances to reach better solutions).
Range: [0, 9]
dualbound Dual bound on objective function (lower bound for minimization, upper bound for maximization).
If a value has been set, GAMS/LocalSolver will stop when it found a feasible solution with an objective function value equal or better to the dual bound.
hierarchicalobj Whether to interpret the GAMS objective function as a specification for an hierarchical optimization. 0
seed Seed of random number generator. 0
solvetrace Filename of solving trace file.
solvetracetime Time interval when a trace record is written. 1
writelsp Name of file into which to write instance as LocalSolver .lsp file.

Hierarchical Optimization of Multiple Objective Functions

If the option hierarchicalobj is enabled, then the objective function in the GAMS model is interpreted as a specification of the priorities for an hierarchical optimization.

That is, assume the GAMS objective function is

\[ \sum_{i=1}^p c_i x_i \]

If hierarchicalobj is enabled, the GAMS/LocalSolver link will request LocalSolver to optimize each of the \(x_i\) variables in a hierarchical way. The highest priority will be given to a variable with largest value for \(|c_i|\), the 2nd highest priority to a variable with 2nd largest absolute coefficient value, etc. Further, if \(c_i\) is negative, then the optimization direction for \(x_i\) will be flipped (w.r.t. the objective sense specified in the GAMS solve statement).

Note, that GAMS will still report the value of the objective function \( \sum_{i=1}^p c_i x_i \) in the GAMS listing file and model attribute.


Let's assume we have 3 hierarchical objective functions,

o1 =e= ...
o2 =e= ...
o3 =e= ...

Assume we want to first minimize o1, secondly maximize o2, and thirdly minimize o3. To do this with GAMS/LocalSolver, you have to build a "weighted" combined objective and using the weights and the sign of the weight to determine the order and the direction:

o =e= 1000*o1 - 200*o2 + 50*o1;
solve m minimizing o using mip;


o =e= -1000*o1 + 200*o2 - 50*o3;
solve m maximizing o using mip;


When LocalSolver tries to find good solutions, it prints a number of statistics to the log. Next to the number of infeasible expressions or the objective value, these are

  • mov: the number of moves performed,
  • inf: the percentage of infeasible moves,
  • acc: the percentage of accepted moves,
  • imp: the number of improving moves.

Using a LocalSolver library license

Users that have a GAMS/LocalSolver link license need to provide a separate LocalSolver license file license.dat. By default, LocalSolver looks for its license file in 3 different locations in the following order:

  1. In the file specified by the environment variable LS_LICENSE_PATH.
  2. In the current directory, that is the directory from where GAMS is spawned. If a file license.dat exists in this directory, it is used as default license.
  3. In /opt/localsolver_X_Y/license.dat on Linux and Mac OS X and C:\localsolver_X_Y\license.dat on Windows.