Localsolver  6.5
localsolverblackbox.LSBBModel Class Reference

Detailed Description

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.

See Also
LSBBExpression, LSBBOperator

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.

Member Function Documentation

LocalSolverBlackBox localsolverblackbox.LSBBModel.GetLocalSolverBlackBox ( )

Returns the LocalSolverBlackBox object associated to this model.

Returns
LocalSolverBlackBox object
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().

Parameters
functionNative function to call
Returns
The expression associated to the function.
See Also
LSBBOperator.NativeFunction
LSBBExpression localsolverblackbox.LSBBModel.Call ( )

Creates a call expression.

See Also
LSBBOperator.Call
LSBBExpression localsolverblackbox.LSBBModel.Bool ( )

Creates a boolean decision.

Binary decision with domain [0, 1].

See Also
LSBBOperator.Bool
LSBBExpression localsolverblackbox.LSBBModel.Float ( double  min,
double  max 
)

Creates a float decision.

Decision variable with domain [min, max].

See Also
LSBBOperator.Float
LSBBExpression localsolverblackbox.LSBBModel.Int ( long  min,
long  max 
)

Creates an integer decision.

Decision variable with domain [min, max].

See Also
LSBBOperator.Int

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.

Parameters
exprExpression.
directionOptimization 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.

Returns
True if the model is closed.