LocalSolver logo
is now
Hexaly logo

We're excited to share that we are moving forward. We're leaving behind the LocalSolver brand and transitioning to our new identity: Hexaly. This represents a leap forward in our mission to enable every organization to make better decisions faster when faced with operational and strategic challenges.

LSParam Class

class 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

Fields

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 or STOPPED.

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 between 0 and objectiveThresholds.count() - 1. Accessing a value outside these bounds throws an exception.

  • An overloaded iterator operator to iterate over the objective thresholds with a for statement.

This attribute is read-write but it can only be read in states PAUSED and STOPPED and write in state STOPPED.