Localsolver
6.0
|
Mathematical optimization model.
A model is composed of a native function (the blackbox), a number of decisions and a function call that associates the decisions and the function. Once your optimization model is created and closed, the solver can be launched to resolve it. Note that you cannot modify a model which has been closed.
Public Member Functions | |
LocalSolverBlackBox | GetLocalSolverBlackBox () |
Returns the LocalSolverBlackBox object associated to this model. | |
LSBBExpression | CreateNativeFunction (LSBBNativeFunction function) |
Creates a native function. | |
LSBBExpression | Call () |
Creates a call expression. | |
LSBBExpression | Bool () |
Creates a boolean decision. | |
LSBBExpression | Float (double min, double max) |
Creates a float decision. | |
LSBBExpression | Int (long min, long max) |
Creates an integer decision. | |
void | AddObjective (LSBBExpression expr, LSBBObjectiveDirection direction) |
Sets the given expression to be the current objective to optimize. | |
void | Close () |
Closes the model. | |
bool | IsClosed () |
Returns true if the model is closed, false otherwise. |
LocalSolverBlackBox localsolverblackbox.LSBBModel.GetLocalSolverBlackBox | ( | ) |
Returns the LocalSolverBlackBox object associated to this model.
LSBBExpression localsolverblackbox.LSBBModel.CreateNativeFunction | ( | LSBBNativeFunction | function | ) |
Creates a native function.
Once you instanciated it, you have to pass arguments to your function and call it. For that, you have to create expressions of type LSBBOperator::Call. The first operand must be your native function. The other operands must be LSBBExpressions. Their value will be made accessible to your native function through the native context.
Note 1: Most of the time your native function will be called when the solver is in state LSState::Running. Do not attempt to call any method of the solver (to retrieve statistics, values of LSBBExpressions or whatever) in that state or an exception will be thrown. The only accessible function is LocalSolverBlackBox::Stop().
function | Native function to call |
LSBBExpression localsolverblackbox.LSBBModel.Call | ( | ) |
Creates a call expression.
LSBBExpression localsolverblackbox.LSBBModel.Bool | ( | ) |
Creates a boolean decision.
Binary decision with domain [0, 1].
LSBBExpression localsolverblackbox.LSBBModel.Float | ( | double | min, |
double | max | ||
) |
Creates a float decision.
Decision variable with domain [min, max].
LSBBExpression localsolverblackbox.LSBBModel.Int | ( | long | min, |
long | max | ||
) |
Creates an integer decision.
Decision variable with domain [min, max].
Since version 5.5
void localsolverblackbox.LSBBModel.AddObjective | ( | LSBBExpression | expr, |
LSBBObjectiveDirection | direction | ||
) |
Sets the given expression to be the current objective to optimize.
Only allowed in state LSState::Modeling.
expr | Expression. |
direction | Optimization direction of this objective. |
void localsolverblackbox.LSBBModel.Close | ( | ) |
Closes the model.
Only allowed in state LSBBState::Modeling. Once the model is closed, no expression, constraints or objectives can be added. The model must be closed before starting its resolution.
bool localsolverblackbox.LSBBModel.IsClosed | ( | ) |
Returns true if the model is closed, false otherwise.