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

This class contains the LocalSolverBlackBox environment. It is the main class of the 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 and add phases to the solver LSBBParam.
  3. Run the solver LocalSolverBlackBox.
  4. Retrieve the best solution found by the solver LSBBSolution.

Please consult LSVersion for copyright and version info.

Summary

Methods
get_state Gets the state of this LocalSolverBlackBox environment.
get_model Gets the model associated to this LocalSolverBlackBox environment.
get_param Gets the parameters of this LocalSolverBlackBox environment.
solve Solves the model.
stop Aborts the resolution previously launched using solve().
get_solution Gets the best solution found by the solver.

Instance methods

LocalSolverBlackBox.get_state()

Gets the state of this LocalSolverBlackBox environment. This method can be called in any state. In particular, this method can be called in state LSBBState.RUNNING.

Returns:State of LocalSolverBlackBox.
Return type:LSBBState
LocalSolverBlackBox.get_model()

Gets the model associated to this LocalSolverBlackBox environment. Once the model is created and closed, the solver can be launched with solve().

Returns:Model
Return type:LSBBModel
LocalSolverBlackBox.get_param()

Gets the parameters of this LocalSolverBlackBox environment.

Returns:Parameters
Return type:LSBBParam
LocalSolverBlackBox.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.

LocalSolverBlackBox.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 LSBBState.RUNNING.

LocalSolverBlackBox.get_solution()

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

Returns:The best solution.
Return type:LSBBSolution