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

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 localsolver.LSVersion for copyright and version info.

Summary

Methods
Dispose Delete the LocalSolverBlackBox objects and release the licence token.
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.

Instance methods

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.

void Dispose()

Delete the LocalSolverBlackBox objects and release the licence token. This method is automatically called when the LocalSolverBlackBox object was created in a using statement (see IDisposable interface). Otherwise it must be called explicitly. It deletes the native memory used by LocalSolverBlackBox and makes the LocalSolverBlackBox licence available for another LocalSolverBlackBox model.

LSBBState GetState()

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
LSBBModel GetModel()

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
LSBBParam GetParam()

Gets the parameters of this LocalSolverBlackBox environment.

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

LSBBSolution GetSolution()

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