Localsolver  6.0
localsolverblackbox.LocalSolverBlackBox Class Reference

Detailed Description

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().

Public Member Functions

 LocalSolverBlackBox ()
 Constructs a complete LocalSolverBlackBox environment and take a token license.
void Dispose ()
 Delete the LocalSolverBlackBox objects and release the licence token.
LSBBState GetState ()
 Gets the state of this LocalSolverBlackBox environment.
LSBBModel GetModel ()
 Gets the model associated to this LocalSolverBlackBox environment.
LSBBParam GetParam ()
 Gets the parameters of this LocalSolverBlackBox environment.
void Solve ()
 Solves the model.
void Stop ()
 Aborts the resolution previously launched using Solve().
LSBBSolution GetSolution ()
 Gets the best solution found by the solver.

Constructor & Destructor Documentation

localsolverblackbox.LocalSolverBlackBox.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.

Member Function Documentation

void localsolverblackbox.LocalSolverBlackBox.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 localsolverblackbox.LocalSolverBlackBox.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.
LSBBModel localsolverblackbox.LocalSolverBlackBox.GetModel ( )

Gets the model associated to this LocalSolverBlackBox environment.

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

Returns
Model.
LSBBParam localsolverblackbox.LocalSolverBlackBox.GetParam ( )

Gets the parameters of this LocalSolverBlackBox environment.

Returns
Parameters.
void localsolverblackbox.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.

void localsolverblackbox.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.

LSBBSolution localsolverblackbox.LocalSolverBlackBox.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
Best solution.