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.

This page is for an old version of Hexaly Optimizer. We recommend that you update your version and read the documentation for the latest stable release.

LocalSolverBlackBox Class

class localsolverblackbox::LocalSolverBlackBox

LocalSolverBlackBox environment.

Main class of LocalSolverBlackBox library. Here are described the basic steps for using LocalSolverBlackBox:

  1. Build your model (LSBBModel) by creating some expressions (LSBBExpression).
  2. If desired, parameterize the solver (LSBBParam).
  3. Run the solver (LocalSolverBlackBox).
  4. Retrieve the best solution found by the solver (LSBBSolution).

Note that this API is not thread safe. If multiple threads access and modify a same LocalSolverBlackBox environment, it must be synchronized. The only methods that can be used without synchronization are getState() and stop().

Summary

Functions
LocalSolverBlackBox Constructs a complete LocalSolverBlackBox environment and take a token license.
~LocalSolverBlackBox Deletes this LocalSolverBlackBox environment and all associated objects.
getState Gets the state of this LocalSolverBlackBox environment.
getModel Gets the model associated to this LocalSolverBlackBox environment.
getParam Gets the parameters of this LocalSolverBlackBox environment.
solve Solves the model.
stop Aborts the resolution previously launched using solve().
getSolution Gets the best solution found by the solver.

Functions

LocalSolverBlackBox()

Constructs a complete LocalSolverBlackBox environment and take a token license.

If no token is available or if the token server is not accessible, an exception is thrown. The token license is released when the destructor of this LocalSolverBlackBox environment is called.

~LocalSolverBlackBox()

Deletes this LocalSolverBlackBox environment and all associated objects.

In particular, the model, its expressions, the phases, the statistics, and the solution are deleted. The token license is then released.

LSBBState getState() const

Gets the state of this LocalSolverBlackBox environment.

This method can be called in any state. In particular, this method can be called in state S_Running.

Return:State of LocalSolverBlackBox.

LSBBModel getModel() const

Gets the model associated to this LocalSolverBlackBox environment.

Once the model is created and closed, the solver can be launched with solve().

Return:Model.

LSBBParam getParam() const

Gets the parameters of this LocalSolverBlackBox environment.

Return:Parameters.

void solve()

Solves the model.

This method returns only when the time limit or the evaluation limit are reached. The model must be closed to launch the resolution.

void stop()

Aborts the resolution previously launched using solve().

If no resolution was launched, this method does nothing. Called from another thread, this method enables users to stop the resolution properly. Solution remains valid. This method can be called in any state, notably in state S_Running.

LSBBSolution getSolution() const

Gets the best solution found by the solver.

If the solver has not been started at least once, all the decision variables of the solution are set to 0 (such a solution may be infeasible). Only allowed in states S_Paused or S_Stopped.

Return:Best solution.