Setting Parameters
LINGO has many optional settings that can be controlled with the Solver|Options command. At times, you may find it necessary to alter these parameters dynamically in your model’s calc sections. For this reason, LINGO provides the @SET statement, which gives you access to the entire set of system parameters. There is also and additional function, @APISET, for setting more obscure parameters in the LINDO API (LINGO’s solver library) that aren’t available through the standard LINGO options set.
@SET( ‘PARAM_NAME’, PARAMETER_VALUE)
To change a parameter’s setting, @SET requires that you pass it a parameter name as a text string, along with the parameter’s new value. For example, to set the integer solver’s relative optimality tolerance to .05 we’d use:
@SET( ’IPTOLR’, .05);
A list of all the parameter names can be found in Chapter 6’s discussion of the SET command-line command.
A parameter may be returned to its default value by omitting the parameter_value argument. For instance,
@SET( ’IPTOLR’);
would return the IPTOLR parameter to its default value. Use:
@SET( ’DEFAULT ’);
to return all parameters to their default settings:
Note: | Parameters whose values have been changed with @SET in a calc section will be restored to their original settings once the model run is completed. |
@APISET( PARAM_INDEX, ‘INT|DOUBLE’, PARAMETER_VALUE)
LINGO uses the LINDO API solver library as its underlying solver engine. The LINDO API has a wealth of parameters that may be set by the user. Many of these parameters would be of use only in rare instances. Given this, LINGO does not provide direct access to all possible LINDO API parameters. However, if you need access to certain API parameters that aren’t in the standard LINGO set, you may do so with the @APISET command.
To change a parameter’s setting, @APISET requires that you pass it a parameter index, a text string of either ‘INT’ or "DOUBLE’ indicating if the parameter is an integer or double precision quantity, along with the parameter’s new value. You can refer to the LINDO API documentation (available on LINDO Systems’ Web site) for a list of available parameters. A list of parameters and their indices is also in the lindo.h file included as part of your LINGO installation.
As an example, the LINDO API adds cuts in the branch-and-bound tree every 10 nodes. If you would like to add cuts more frequently, say every 5 nodes, then you could do so with the:
@APISET( 318, ‘INT’, 5);
You may also force all API parameters back to their default values with:
@APISET( ‘DEFAULT’);
Note: | Parameters whose values have been changed with @APISET will be restored to their original settings once the model run is completed. |