LSParam Type¶
- type lsparam¶
Solving parameters. This type contains some methods allowing you to parameterize the resolution of the model. For the sake of simplicity, only a few parameters are actually offered to tune the search.
Summary¶
Number of threads used to parallelize the search. |
|
Verbosity level of the solver. |
|
Seed of the pseudo-random number generator used by the solver. |
|
Time limit in seconds before the solver stops. |
|
Maximum number of iterations before the solver stops. |
|
Simulated annealing levelDeprecated since version 8.5: The annealing level doesn’t have a significant influence on the search anymore. |
|
Time in seconds between two consecutive displays in console while the solver is running. |
|
Time in seconds between two events of type TIME_TICKED. |
|
Number of iterations between two events of type ITERATION_TICKED. |
|
Path of the LocalSolver log file. |
|
Thresholds of the objectives. |
Attributes¶
- lsparam.nbThreads¶
Number of threads used to parallelize the search. The number of threads must be a positive integer. The default number of threads is set to 0 which means that the number of threads is automatically adapted to your computer and to your optimization model.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int
- lsparam.verbosity¶
Verbosity level of the solver. The default verbosity is set to 1. There are 3 defined verbosity levels:
0: All the traces are disabled.
1: Normal verbosity. This is the default level.
2: Detailed verbosity. Displays statistics during the search.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (0, 1 or 2)
- lsparam.seed¶
Seed of the pseudo-random number generator used by the solver. The seed must be a positive integer. The default seed is set to 0.
The search for solutions is highly randomized. Fixing the seed and the number of iterations of the solver allows you to reproduce exactly its results over several runs.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be positive or zero)
- lsparam.timeLimit¶
Time limit in seconds before the solver stops.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be positive or zero)
- lsparam.iterationLimit¶
Maximum number of iterations before the solver stops. Fixing the seed and the number of iterations ensures the reproducibility of results over several runs.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be positive or zero)
- lsparam.annealingLevel¶
Simulated annealing level
Deprecated since version 8.5: The annealing level doesn’t have a significant influence on the search anymore. The tuning of this parameter won’t be allowed in a future version.
The level must be an integer between 0 and 9. The default simulated annealing level is set to 1. Only allowed in
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (between 0 and 9)
- lsparam.timeBetweenDisplays¶
Time in seconds between two consecutive displays in console while the solver is running. The default time between displays is set to 1 second.
This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be strictly positive)
- lsparam.timeBetweenTicks¶
Time in seconds between two events of type
TIME_TICKED
. The default time between ticks is set to 1 second.This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be strictly positive)
- lsparam.iterationBetweenTicks¶
Number of iterations between two events of type
ITERATION_TICKED
. The default number of iterations between ticks is set to 10,000.This attribute is read-write but it can only be changed in states
MODELING
orSTOPPED
.- Return type
int (must be strictly positive)
- lsparam.logFile¶
Path of the LocalSolver log file. If the path is nil, no log will be saved. To tune the logging verbosity, see
verbosity
.- Return type
string or nil
- lsparam.objectiveThresholds¶
Thresholds of the objectives. If an objective is minimized (resp. maximized), then the optimization of this objective is stopped as soon as this lower (resp. upper) threshold is reached. It can be useful for goal programming.
This field returns a readonly map-like structure with the following features:
A count field e.g.
objectiveThresholds.count()
. This count field is always equal to the number of objectives present in the model.An overloaded index
[]
operator to get a threshold for a specific objective, e.g.objectiveThresholds[0]
. The index must be between0
andobjectiveThresholds.count() - 1
. Accessing a value outside these bounds throws an exception.An overloaded
iterator
operator to iterate over the objective thresholds with afor
statement.
This attribute is read-write but it can only be read in states
PAUSED
andSTOPPED
and write in stateSTOPPED
.