Localsolver
6.0
|
Mathematical optimization model.
A model is composed of expressions (some of which are decisions), organized as a tree. Then, some expressions of the model can be constrained or optimized. 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: you must reopen-it (with LSModel::Open()) or instantiate another LocalSolver environment to optimize another model.
Public Member Functions | |
LocalSolver | GetLocalSolver () |
Returns the LocalSolver object associated to this model. | |
LSExpression | CreateConstant (long value) |
Creates a constant expression representing the given value. | |
LSExpression | CreateConstant (double value) |
Creates a constant expression representing the given value. | |
LSExpression | CreateNativeFunction (LSNativeFunction function) |
Creates a native function. | |
LSExpression | CreateExpression (LSOperator op) |
Creates an expression of the given type. | |
LSExpression | CreateExpression (LSOperator op, LSExpression expr0) |
Creates an expression of the given type, with the given operand. | |
LSExpression | CreateExpression (LSOperator op, LSExpression expr0, LSExpression expr1) |
Creates an expression of the given type, with the given ordered operands. | |
LSExpression | CreateExpression (LSOperator op, LSExpression expr0, LSExpression expr1, LSExpression expr2) |
Creates an expression of the given type, with the given ordered operands. | |
LSExpression | Bool () |
Creates a boolean decision. | |
LSExpression | Float (double min, double max) |
Creates a float decision. | |
LSExpression | Int (long min, long max) |
Creates an integer decision. | |
LSExpression | Sum () |
Creates a sum expression. | |
LSExpression | Sum (IEnumerable< LSExpression > operands) |
Creates a sum expression. | |
LSExpression | Sum (params LSExpression[] operands) |
Creates a sum expression. | |
LSExpression | Sum (long a) |
Creates a sum expression. | |
LSExpression | Sum (double a) |
Creates a sum expression. | |
LSExpression | Sum (LSExpression a, LSExpression b) |
Creates a sum expression. | |
LSExpression | Sum (long a, LSExpression b) |
Creates a sum expression. | |
LSExpression | Sum (LSExpression a, long b) |
Creates a sum expression. | |
LSExpression | Sum (double a, LSExpression b) |
Creates a sum expression. | |
LSExpression | Sum (LSExpression a, double b) |
Creates a sum expression. | |
LSExpression | Sub (LSExpression a, LSExpression b) |
Creates a substraction expression. | |
LSExpression | Sub (long a, LSExpression b) |
Creates a substraction expression. | |
LSExpression | Sub (LSExpression a, long b) |
Creates a substraction expression. | |
LSExpression | Sub (double a, LSExpression b) |
Creates a substraction expression. | |
LSExpression | Sub (LSExpression a, double b) |
Creates a substraction expression. | |
LSExpression | Prod () |
Creates a product expression. | |
LSExpression | Prod (IEnumerable< LSExpression > operands) |
Creates a product expression. | |
LSExpression | Prod (params LSExpression[] operands) |
Creates a product expression. | |
LSExpression | Prod (long a) |
Creates a product expression. | |
LSExpression | Prod (double a) |
Creates a product expression. | |
LSExpression | Prod (LSExpression a, LSExpression b) |
Creates a product expression. | |
LSExpression | Prod (LSExpression a, long b) |
Creates a product expression. | |
LSExpression | Prod (long a, LSExpression b) |
Creates a product expression. | |
LSExpression | Prod (LSExpression a, double b) |
Creates a product expression. | |
LSExpression | Prod (double a, LSExpression b) |
Creates a product expression. | |
LSExpression | Max () |
Creates a maximum expression. | |
LSExpression | Max (IEnumerable< LSExpression > operands) |
Creates a maximum expression. | |
LSExpression | Max (params LSExpression[] operands) |
Creates a maximum expression. | |
LSExpression | Max (long a) |
Creates a maximum expression. | |
LSExpression | Max (double a) |
Creates a maximum expression. | |
LSExpression | Max (LSExpression a, LSExpression b) |
Creates a maximum expression. | |
LSExpression | Max (LSExpression a, long b) |
Creates a maximum expression. | |
LSExpression | Max (long a, LSExpression b) |
Creates a maximum expression. | |
LSExpression | Max (LSExpression a, double b) |
Creates a maximum expression. | |
LSExpression | Max (double a, LSExpression b) |
Creates a maximum expression. | |
LSExpression | Min () |
Creates a minimum expression. | |
LSExpression | Min (IEnumerable< LSExpression > operands) |
Creates a minimum expression. | |
LSExpression | Min (params LSExpression[] operands) |
Creates a minimum expression. | |
LSExpression | Min (long a) |
Creates a minimum expression. | |
LSExpression | Min (double a) |
Creates a minimum expression. | |
LSExpression | Min (LSExpression a, LSExpression b) |
Creates a minimum expression. | |
LSExpression | Min (LSExpression a, long b) |
Creates a minimum expression. | |
LSExpression | Min (long a, LSExpression b) |
Creates a minimum expression. | |
LSExpression | Min (LSExpression a, double b) |
Creates a minimum expression. | |
LSExpression | Min (double a, LSExpression b) |
Creates a minimum expression. | |
LSExpression | Eq (LSExpression a, LSExpression b) |
Creates an equality expression. | |
LSExpression | Eq (LSExpression a, long b) |
Creates an equality expression. | |
LSExpression | Eq (long a, LSExpression b) |
Creates an equality expression. | |
LSExpression | Eq (LSExpression a, double b) |
Creates an equality expression. | |
LSExpression | Eq (double a, LSExpression b) |
Creates an equality expression. | |
LSExpression | Neq (LSExpression a, LSExpression b) |
Creates a disequality expression. | |
LSExpression | Neq (LSExpression a, long b) |
Creates a disequality expression. | |
LSExpression | Neq (long a, LSExpression b) |
Creates a disequality expression. | |
LSExpression | Neq (LSExpression a, double b) |
Creates a disequality expression. | |
LSExpression | Neq (double a, LSExpression b) |
Creates a disequality expression. | |
LSExpression | Geq (LSExpression a, LSExpression b) |
Creates an inequality expression greater than or equal to. | |
LSExpression | Geq (LSExpression a, long b) |
Creates an inequality expression greater than or equal to. | |
LSExpression | Geq (long a, LSExpression b) |
Creates an inequality expression greater than or equal to. | |
LSExpression | Geq (LSExpression a, double b) |
Creates an inequality expression greater than or equal to. | |
LSExpression | Geq (double a, LSExpression b) |
Creates an inequality expression greater than or equal to. | |
LSExpression | Leq (LSExpression a, LSExpression b) |
Creates an inequality expression less than or equal to. | |
LSExpression | Leq (LSExpression a, long b) |
Creates an inequality expression less than or equal to. | |
LSExpression | Leq (long a, LSExpression b) |
Creates an inequality expression less than or equal to. | |
LSExpression | Leq (LSExpression a, double b) |
Creates an inequality expression less than or equal to. | |
LSExpression | Leq (double a, LSExpression b) |
Creates an inequality expression less than or equal to. | |
LSExpression | Gt (LSExpression a, LSExpression b) |
Creates an inequality expression greater than. | |
LSExpression | Gt (LSExpression a, long b) |
Creates an inequality expression greater than. | |
LSExpression | Gt (long a, LSExpression b) |
Creates an inequality expression greater than. | |
LSExpression | Gt (LSExpression a, double b) |
Creates an inequality expression greater than. | |
LSExpression | Gt (double a, LSExpression b) |
Creates an inequality expression greater than. | |
LSExpression | Lt (LSExpression a, LSExpression b) |
Creates an inequality expression less than. | |
LSExpression | Lt (LSExpression a, long b) |
Creates an inequality expression less than. | |
LSExpression | Lt (long a, LSExpression b) |
Creates an inequality expression less than. | |
LSExpression | Lt (LSExpression a, double b) |
Creates an inequality expression less than. | |
LSExpression | Lt (double a, LSExpression b) |
Creates an inequality expression less than. | |
LSExpression | If (LSExpression a, LSExpression b, LSExpression c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, LSExpression b, long c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, long b, LSExpression c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, long b, long c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, LSExpression b, double c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, double b, LSExpression c) |
Creates a ternary conditionnal expression. | |
LSExpression | If (LSExpression a, double b, double c) |
Creates a ternary conditionnal expression. | |
LSExpression | Not (LSExpression a) |
Creates a NOT expression. | |
LSExpression | And () |
Creates an AND expression. | |
LSExpression | And (IEnumerable< LSExpression > operands) |
Creates an AND expression. | |
LSExpression | And (params LSExpression[] operands) |
Creates an AND expression. | |
LSExpression | And (LSExpression a, LSExpression b) |
Creates an AND expression. | |
LSExpression | Or () |
Creates a OR expression. | |
LSExpression | Or (IEnumerable< LSExpression > operands) |
Creates a OR expression. | |
LSExpression | Or (params LSExpression[] operands) |
Creates a OR expression. | |
LSExpression | Or (LSExpression a, LSExpression b) |
Creates a OR expression. | |
LSExpression | Xor () |
Creates a XOR expression. | |
LSExpression | Xor (IEnumerable< LSExpression > operands) |
Creates a XOR expression. | |
LSExpression | Xor (params LSExpression[] operands) |
Creates a XOR expression. | |
LSExpression | Xor (LSExpression a, LSExpression b) |
Creates a XOR expression. | |
LSExpression | Abs (LSExpression a) |
Creates an absolute value expression. | |
LSExpression | Dist (LSExpression a, LSExpression b) |
Creates a distance expression. | |
LSExpression | Dist (LSExpression a, long b) |
Creates a distance expression. | |
LSExpression | Dist (long a, LSExpression b) |
Creates a distance expression. | |
LSExpression | Dist (LSExpression a, double b) |
Creates a distance expression. | |
LSExpression | Dist (double a, LSExpression b) |
Creates a distance expression. | |
LSExpression | Div (LSExpression a, LSExpression b) |
Creates a division expression. | |
LSExpression | Div (LSExpression a, long b) |
Creates a division expression. | |
LSExpression | Div (long a, LSExpression b) |
Creates a division expression. | |
LSExpression | Div (LSExpression a, double b) |
Creates a division expression. | |
LSExpression | Div (double a, LSExpression b) |
Creates a division expression. | |
LSExpression | Mod (LSExpression a, LSExpression b) |
Creates a modulo expression. | |
LSExpression | Mod (LSExpression a, long b) |
Creates a modulo expression. | |
LSExpression | Mod (long a, LSExpression b) |
Creates a modulo expression. | |
LSExpression | Array () |
Creates an array expression. | |
LSExpression | Array (IEnumerable< LSExpression > operands) |
Creates an array expression. | |
LSExpression | Array (IEnumerable< long > operands) |
Creates an array expression. | |
LSExpression | Array (IEnumerable< double > operands) |
Creates an array expression. | |
LSExpression | Array (params LSExpression[] operands) |
Creates an array expression. | |
LSExpression | Array (params long[] operands) |
Creates an array expression. | |
LSExpression | Array (params double[] operands) |
Creates an array expression. | |
LSExpression | At (LSExpression arrayExpr, params LSExpression[] indicesExpr) |
Creates a "at" expression. | |
LSExpression | At (LSExpression arrayExpr, long index) |
Creates a "at" expression. | |
LSExpression | Scalar (LSExpression a, LSExpression b) |
Creates a scalar product expression between 2 arrays. | |
LSExpression | Ceil (LSExpression a) |
Creates a ceil expression. | |
LSExpression | Floor (LSExpression a) |
Creates a floor expression. | |
LSExpression | Round (LSExpression a) |
Creates a round expression. | |
LSExpression | Sqrt (LSExpression a) |
Creates a square root expression. | |
LSExpression | Log (LSExpression a) |
Creates a natural logarithm expression. | |
LSExpression | Exp (LSExpression a) |
Creates an exponential expression. | |
LSExpression | Pow (LSExpression a, LSExpression b) |
Creates a power expression. | |
LSExpression | Pow (LSExpression a, long b) |
Creates a power expression. | |
LSExpression | Pow (long a, LSExpression b) |
Creates a power expression. | |
LSExpression | Pow (LSExpression a, double b) |
Creates a power expression. | |
LSExpression | Pow (double a, LSExpression b) |
Creates a power expression. | |
LSExpression | Cos (LSExpression a) |
Creates a cosine expression. | |
LSExpression | Sin (LSExpression a) |
Creates a sine expression. | |
LSExpression | Tan (LSExpression a) |
Creates a tangent expression. | |
LSExpression | Piecewise (LSExpression abscissae, LSExpression ordinates, LSExpression x) |
Creates a piecewise linear expression. | |
LSExpression | List (long a) |
Creates a list variable. | |
LSExpression | Count (LSExpression a) |
Creates a count expression. | |
LSExpression | IndexOf (LSExpression a, long b) |
Creates an indexOf expression. | |
LSExpression | IndexOf (LSExpression a, LSExpression b) |
Creates an indexOf expression. | |
LSExpression | Partition () |
Creates a partition expression. | |
LSExpression | Partition (params LSExpression[] operands) |
Creates a partition expression. | |
LSExpression | Disjoint () |
Creates a disjoint expression. | |
LSExpression | Disjoint (params LSExpression[] operands) |
Creates a disjoint expression. | |
LSExpression | Function (LSNativeFunction func) |
Creates a function expression. | |
LSExpression | Call () |
Creates a call expression. | |
LSExpression | Call (LSExpression expr0) |
Creates a call expression. | |
LSExpression | Call (LSExpression expr0, LSExpression expr1) |
Creates a call expression. | |
LSExpression | Call (LSExpression expr0, LSExpression expr1, LSExpression expr2) |
Creates a call expression. | |
LSExpression | Call (params LSExpression[] operands) |
Creates a call expression. | |
LSExpression | Call (IEnumerable< LSExpression > operands) |
Creates a call expression. | |
int | GetNbExpressions () |
Gets the number of expressions added to this model. | |
LSExpression | GetExpression (int exprIndex) |
Gets the expression with the given index in this model. | |
LSExpression | GetExpression (string name) |
Gets the expression with the given name. | |
int | GetNbDecisions () |
Gets the number of decisions in the model. | |
LSExpression | GetDecision (int decisionIndex) |
Gets the decision with the given index. | |
void | AddConstraint (LSExpression expr) |
Adds the given expression to the list of constraints. | |
void | Constraint (LSExpression expr) |
Shortcut for addConstraint(expr). | |
void | RemoveConstraint (LSExpression expr) |
Removes the given expression from the list of constraints. | |
void | RemoveConstraint (int constraintIndex) |
Removes the constraint at the given position in the list of constraints. | |
int | GetNbConstraints () |
Gets the number of constraints added to this model. | |
LSExpression | GetConstraint (int constraintIndex) |
Gets the constraint with the given index. | |
void | AddObjective (LSExpression expr, LSObjectiveDirection direction) |
Adds the given expression to the list of objectives to optimize. | |
void | Minimize (LSExpression expr) |
Shortcut for addObjective(expr, OD_Minimize). | |
void | Maximize (LSExpression expr) |
Shortcut for addObjective(expr, OD_Maximize). | |
void | RemoveObjective (int objectiveIndex) |
Removes the objective at the given position in the list of objectives. | |
int | GetNbObjectives () |
Gets the number of objectives added to this model. | |
LSExpression | GetObjective (int objectiveIndex) |
Gets the objective with the given index. | |
LSObjectiveDirection | GetObjectiveDirection (int objectiveIndex) |
Gets the direction of the objective with the given index. | |
int | GetNbOperands () |
Gets the number of operands in the model. | |
void | Close () |
Closes the model. | |
void | Open () |
Opens or reopens the model. | |
bool | IsClosed () |
Returns true if the model is closed, false otherwise. | |
override string | ToString () |
Returns a string representation of this model. |
LocalSolver localsolver.LSModel.GetLocalSolver | ( | ) |
Returns the LocalSolver object associated to this model.
LSExpression localsolver.LSModel.CreateConstant | ( | long | value | ) |
Creates a constant expression representing the given value.
Only allowed in state LSState::Modeling. Note that if a constant has been already created with the same value, this method can return the same expression, but it is not guaranteed. The exact behavior is implementation defined.
value | Value of the constant. |
LSExpression localsolver.LSModel.CreateConstant | ( | double | value | ) |
Creates a constant expression representing the given value.
Only allowed in state LSState::Modeling. Note that if a constant has been already created with the same value, this method can return the same expression, but it is not guaranteed. The exact behavior is implementation defined.
value | Value of the constant |
LSExpression localsolver.LSModel.CreateNativeFunction | ( | LSNativeFunction | 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 LSOperator::Call. The first operand must be your native function. The other operands must be LSExpressions. 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 LSExpressions or whatever) in that state or an exception will be thrown. The only accessible function is LocalSolver::Stop().
Note 2: Your functions must be thread-safe. According to the "nbThreads" parameter, LocalSolver can be multi-threaded. In that case, your native functions must be thread safe. If you cannot guarantee the thread-safety of your code, we strongly recommend you to limit the search of LocalSolver to one thread with LSParam::SetNbThreads.
function | Native function to call |
Since version 6.0
LSExpression localsolver.LSModel.CreateExpression | ( | LSOperator | op | ) |
Creates an expression of the given type.
The expression is created without operand. Only allowed in state LSState::Modeling. This method cannot be used to create constants: use LSModel::CreateConstant(long) or LSModel::CreateConstant(double) instead.
op | Type of expression to create. |
LSExpression localsolver.LSModel.CreateExpression | ( | LSOperator | op, |
LSExpression | expr0 | ||
) |
Creates an expression of the given type, with the given operand.
Only allowed in state LSState::Modeling. Useful for creating unary expressions. The operand can be a double, an integer or a previously declared LSExpression.
T0 | type of the operand to add. Types allowed: constant types or LSExpression. |
op | Type of expression to create. |
expr0 | Operand 0. |
LSExpression localsolver.LSModel.CreateExpression | ( | LSOperator | op, |
LSExpression | expr0, | ||
LSExpression | expr1 | ||
) |
Creates an expression of the given type, with the given ordered operands.
Only allowed in state LSState.Modeling. Useful for creating binary expressions. The operands can be doubles, integers or previously declared LSExpressions. It is also possible to use this method with iterators. In that case, expr0 and expr1 must be iterators of the same type, pointing respectively to the initial and final positions of the operands
T0 | type of the operand to add. Types allowed: constant types, LSExpression or iterator. |
T1 | type of the operand to add. Types allowed: constant types, LSExpression or iterator. |
op | Type of expression to create. |
expr0 | Operand 0. |
expr1 | Operand 1. |
LSExpression localsolver.LSModel.CreateExpression | ( | LSOperator | op, |
LSExpression | expr0, | ||
LSExpression | expr1, | ||
LSExpression | expr2 | ||
) |
Creates an expression of the given type, with the given ordered operands.
Only allowed in state LSState::Modeling. Useful for creating ternary expressions (in particular, LSOperator.If expressions). The operands can be doubles, integers or previously declared LSExpressions.
T0 | type of the operand to add. Types allowed: constant types or LSExpression. |
T1 | type of the operand to add. Types allowed: constant types or LSExpression. |
T2 | type of the operand to add. Types allowed: constant types or LSExpression. |
op | Type of expression to create. |
expr0 | Operand 0. |
expr1 | Operand 1. |
expr2 | Operand 2. |
LSExpression localsolver.LSModel.Bool | ( | ) |
Creates a boolean decision.
Binary decision with domain [0, 1].
Since version 5.5
LSExpression localsolver.LSModel.Float | ( | double | min, |
double | max | ||
) |
Creates a float decision.
Decision variable with domain [min, max].
Since version 5.5
LSExpression localsolver.LSModel.Int | ( | long | min, |
long | max | ||
) |
Creates an integer decision.
Decision variable with domain [min, max].
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | ) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | IEnumerable< LSExpression > | operands | ) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | params LSExpression[] | operands | ) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | long | a | ) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | double | a | ) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | long | a, |
LSExpression | b | ||
) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | LSExpression | a, |
long | b | ||
) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | double | a, |
LSExpression | b | ||
) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sum | ( | LSExpression | a, |
double | b | ||
) |
Creates a sum expression.
Since version 5.5
LSExpression localsolver.LSModel.Sub | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a substraction expression.
Since version 5.5
LSExpression localsolver.LSModel.Sub | ( | long | a, |
LSExpression | b | ||
) |
Creates a substraction expression.
Since version 5.5
LSExpression localsolver.LSModel.Sub | ( | LSExpression | a, |
long | b | ||
) |
Creates a substraction expression.
Since version 5.5
LSExpression localsolver.LSModel.Sub | ( | double | a, |
LSExpression | b | ||
) |
Creates a substraction expression.
Since version 5.5
LSExpression localsolver.LSModel.Sub | ( | LSExpression | a, |
double | b | ||
) |
Creates a substraction expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | ) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | IEnumerable< LSExpression > | operands | ) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | params LSExpression[] | operands | ) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | long | a | ) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | double | a | ) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | LSExpression | a, |
long | b | ||
) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | long | a, |
LSExpression | b | ||
) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | LSExpression | a, |
double | b | ||
) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Prod | ( | double | a, |
LSExpression | b | ||
) |
Creates a product expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | ) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | IEnumerable< LSExpression > | operands | ) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | params LSExpression[] | operands | ) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | long | a | ) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | double | a | ) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | LSExpression | a, |
long | b | ||
) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | long | a, |
LSExpression | b | ||
) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | LSExpression | a, |
double | b | ||
) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Max | ( | double | a, |
LSExpression | b | ||
) |
Creates a maximum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | ) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | IEnumerable< LSExpression > | operands | ) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | params LSExpression[] | operands | ) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | long | a | ) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | double | a | ) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | LSExpression | a, |
long | b | ||
) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | long | a, |
LSExpression | b | ||
) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | LSExpression | a, |
double | b | ||
) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Min | ( | double | a, |
LSExpression | b | ||
) |
Creates a minimum expression.
Since version 5.5
LSExpression localsolver.LSModel.Eq | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an equality expression.
Since version 5.5
LSExpression localsolver.LSModel.Eq | ( | LSExpression | a, |
long | b | ||
) |
Creates an equality expression.
Since version 5.5
LSExpression localsolver.LSModel.Eq | ( | long | a, |
LSExpression | b | ||
) |
Creates an equality expression.
Since version 5.5
LSExpression localsolver.LSModel.Eq | ( | LSExpression | a, |
double | b | ||
) |
Creates an equality expression.
Since version 5.5
LSExpression localsolver.LSModel.Eq | ( | double | a, |
LSExpression | b | ||
) |
Creates an equality expression.
Since version 5.5
LSExpression localsolver.LSModel.Neq | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a disequality expression.
Since version 5.5
LSExpression localsolver.LSModel.Neq | ( | LSExpression | a, |
long | b | ||
) |
Creates a disequality expression.
Since version 5.5
LSExpression localsolver.LSModel.Neq | ( | long | a, |
LSExpression | b | ||
) |
Creates a disequality expression.
Since version 5.5
LSExpression localsolver.LSModel.Neq | ( | LSExpression | a, |
double | b | ||
) |
Creates a disequality expression.
Since version 5.5
LSExpression localsolver.LSModel.Neq | ( | double | a, |
LSExpression | b | ||
) |
Creates a disequality expression.
Since version 5.5
LSExpression localsolver.LSModel.Geq | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Geq | ( | LSExpression | a, |
long | b | ||
) |
Creates an inequality expression greater than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Geq | ( | long | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Geq | ( | LSExpression | a, |
double | b | ||
) |
Creates an inequality expression greater than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Geq | ( | double | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Leq | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Leq | ( | LSExpression | a, |
long | b | ||
) |
Creates an inequality expression less than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Leq | ( | long | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Leq | ( | LSExpression | a, |
double | b | ||
) |
Creates an inequality expression less than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Leq | ( | double | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than or equal to.
Since version 5.5
LSExpression localsolver.LSModel.Gt | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than.
Since version 5.5
LSExpression localsolver.LSModel.Gt | ( | LSExpression | a, |
long | b | ||
) |
Creates an inequality expression greater than.
Since version 5.5
LSExpression localsolver.LSModel.Gt | ( | long | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than.
Since version 5.5
LSExpression localsolver.LSModel.Gt | ( | LSExpression | a, |
double | b | ||
) |
Creates an inequality expression greater than.
Since version 5.5
LSExpression localsolver.LSModel.Gt | ( | double | a, |
LSExpression | b | ||
) |
Creates an inequality expression greater than.
Since version 5.5
LSExpression localsolver.LSModel.Lt | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than.
Since version 5.5
LSExpression localsolver.LSModel.Lt | ( | LSExpression | a, |
long | b | ||
) |
Creates an inequality expression less than.
Since version 5.5
LSExpression localsolver.LSModel.Lt | ( | long | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than.
Since version 5.5
LSExpression localsolver.LSModel.Lt | ( | LSExpression | a, |
double | b | ||
) |
Creates an inequality expression less than.
Since version 5.5
LSExpression localsolver.LSModel.Lt | ( | double | a, |
LSExpression | b | ||
) |
Creates an inequality expression less than.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
LSExpression | b, | ||
LSExpression | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
LSExpression | b, | ||
long | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
long | b, | ||
LSExpression | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
long | b, | ||
long | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
LSExpression | b, | ||
double | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
double | b, | ||
LSExpression | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.If | ( | LSExpression | a, |
double | b, | ||
double | c | ||
) |
Creates a ternary conditionnal expression.
Since version 5.5
LSExpression localsolver.LSModel.Not | ( | LSExpression | a | ) |
Creates a NOT expression.
Since version 5.5
LSExpression localsolver.LSModel.And | ( | ) |
Creates an AND expression.
Since version 5.5
LSExpression localsolver.LSModel.And | ( | IEnumerable< LSExpression > | operands | ) |
Creates an AND expression.
Since version 5.5
LSExpression localsolver.LSModel.And | ( | params LSExpression[] | operands | ) |
Creates an AND expression.
Since version 5.5
LSExpression localsolver.LSModel.And | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an AND expression.
Since version 5.5
LSExpression localsolver.LSModel.Or | ( | ) |
Creates a OR expression.
Since version 5.5
LSExpression localsolver.LSModel.Or | ( | IEnumerable< LSExpression > | operands | ) |
Creates a OR expression.
Since version 5.5
LSExpression localsolver.LSModel.Or | ( | params LSExpression[] | operands | ) |
Creates a OR expression.
Since version 5.5
LSExpression localsolver.LSModel.Or | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a OR expression.
Since version 5.5
LSExpression localsolver.LSModel.Xor | ( | ) |
Creates a XOR expression.
Since version 5.5
LSExpression localsolver.LSModel.Xor | ( | IEnumerable< LSExpression > | operands | ) |
Creates a XOR expression.
Since version 5.5
LSExpression localsolver.LSModel.Xor | ( | params LSExpression[] | operands | ) |
Creates a XOR expression.
Since version 5.5
LSExpression localsolver.LSModel.Xor | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a XOR expression.
Since version 5.5
LSExpression localsolver.LSModel.Abs | ( | LSExpression | a | ) |
Creates an absolute value expression.
Since version 5.5
LSExpression localsolver.LSModel.Dist | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a distance expression.
Since version 5.5
LSExpression localsolver.LSModel.Dist | ( | LSExpression | a, |
long | b | ||
) |
Creates a distance expression.
Since version 5.5
LSExpression localsolver.LSModel.Dist | ( | long | a, |
LSExpression | b | ||
) |
Creates a distance expression.
Since version 5.5
LSExpression localsolver.LSModel.Dist | ( | LSExpression | a, |
double | b | ||
) |
Creates a distance expression.
Since version 5.5
LSExpression localsolver.LSModel.Dist | ( | double | a, |
LSExpression | b | ||
) |
Creates a distance expression.
Since version 5.5
LSExpression localsolver.LSModel.Div | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a division expression.
Since version 5.5
LSExpression localsolver.LSModel.Div | ( | LSExpression | a, |
long | b | ||
) |
Creates a division expression.
Since version 5.5
LSExpression localsolver.LSModel.Div | ( | long | a, |
LSExpression | b | ||
) |
Creates a division expression.
Since version 5.5
LSExpression localsolver.LSModel.Div | ( | LSExpression | a, |
double | b | ||
) |
Creates a division expression.
Since version 5.5
LSExpression localsolver.LSModel.Div | ( | double | a, |
LSExpression | b | ||
) |
Creates a division expression.
Since version 5.5
LSExpression localsolver.LSModel.Mod | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a modulo expression.
Since version 5.5
LSExpression localsolver.LSModel.Mod | ( | LSExpression | a, |
long | b | ||
) |
Creates a modulo expression.
Since version 5.5
LSExpression localsolver.LSModel.Mod | ( | long | a, |
LSExpression | b | ||
) |
Creates a modulo expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | IEnumerable< LSExpression > | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | IEnumerable< long > | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | IEnumerable< double > | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | params LSExpression[] | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | params long[] | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.Array | ( | params double[] | operands | ) |
Creates an array expression.
Since version 5.5
LSExpression localsolver.LSModel.At | ( | LSExpression | arrayExpr, |
params LSExpression[] | indicesExpr | ||
) |
Creates a "at" expression.
Since version 5.5
LSExpression localsolver.LSModel.At | ( | LSExpression | arrayExpr, |
long | index | ||
) |
Creates a "at" expression.
Since version 5.5
LSExpression localsolver.LSModel.Scalar | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a scalar product expression between 2 arrays.
Since version 5.5
LSExpression localsolver.LSModel.Ceil | ( | LSExpression | a | ) |
Creates a ceil expression.
Since version 5.5
LSExpression localsolver.LSModel.Floor | ( | LSExpression | a | ) |
Creates a floor expression.
Since version 5.5
LSExpression localsolver.LSModel.Round | ( | LSExpression | a | ) |
Creates a round expression.
Since version 5.5
LSExpression localsolver.LSModel.Sqrt | ( | LSExpression | a | ) |
Creates a square root expression.
Since version 5.5
LSExpression localsolver.LSModel.Log | ( | LSExpression | a | ) |
Creates a natural logarithm expression.
Since version 5.5
LSExpression localsolver.LSModel.Exp | ( | LSExpression | a | ) |
Creates an exponential expression.
Since version 5.5
LSExpression localsolver.LSModel.Pow | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates a power expression.
Since version 5.5
LSExpression localsolver.LSModel.Pow | ( | LSExpression | a, |
long | b | ||
) |
Creates a power expression.
Since version 5.5
LSExpression localsolver.LSModel.Pow | ( | long | a, |
LSExpression | b | ||
) |
Creates a power expression.
Since version 5.5
LSExpression localsolver.LSModel.Pow | ( | LSExpression | a, |
double | b | ||
) |
Creates a power expression.
Since version 5.5
LSExpression localsolver.LSModel.Pow | ( | double | a, |
LSExpression | b | ||
) |
Creates a power expression.
Since version 5.5
LSExpression localsolver.LSModel.Cos | ( | LSExpression | a | ) |
Creates a cosine expression.
Since version 5.5
LSExpression localsolver.LSModel.Sin | ( | LSExpression | a | ) |
Creates a sine expression.
Since version 5.5
LSExpression localsolver.LSModel.Tan | ( | LSExpression | a | ) |
Creates a tangent expression.
Since version 5.5
LSExpression localsolver.LSModel.Piecewise | ( | LSExpression | abscissae, |
LSExpression | ordinates, | ||
LSExpression | x | ||
) |
Creates a piecewise linear expression.
Since version 5.5
LSExpression localsolver.LSModel.List | ( | long | a | ) |
Creates a list variable.
Since version 5.5
LSExpression localsolver.LSModel.Count | ( | LSExpression | a | ) |
Creates a count expression.
Since version 5.5
LSExpression localsolver.LSModel.IndexOf | ( | LSExpression | a, |
long | b | ||
) |
Creates an indexOf expression.
Since version 5.5
LSExpression localsolver.LSModel.IndexOf | ( | LSExpression | a, |
LSExpression | b | ||
) |
Creates an indexOf expression.
Since version 5.5
LSExpression localsolver.LSModel.Partition | ( | ) |
Creates a partition expression.
Since version 5.5
LSExpression localsolver.LSModel.Partition | ( | params LSExpression[] | operands | ) |
Creates a partition expression.
Since version 5.5
LSExpression localsolver.LSModel.Disjoint | ( | ) |
Creates a disjoint expression.
Since version 5.5
LSExpression localsolver.LSModel.Disjoint | ( | params LSExpression[] | operands | ) |
Creates a disjoint expression.
Since version 5.5
LSExpression localsolver.LSModel.Function | ( | LSNativeFunction | func | ) |
Creates a function expression.
This method is a shortcut for CreateNativeFunction.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | ) |
Creates a call expression.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | LSExpression | expr0 | ) |
Creates a call expression.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | LSExpression | expr0, |
LSExpression | expr1 | ||
) |
Creates a call expression.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | LSExpression | expr0, |
LSExpression | expr1, | ||
LSExpression | expr2 | ||
) |
Creates a call expression.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | params LSExpression[] | operands | ) |
Creates a call expression.
Since version 6.0
LSExpression localsolver.LSModel.Call | ( | IEnumerable< LSExpression > | operands | ) |
Creates a call expression.
Since version 6.0
int localsolver.LSModel.GetNbExpressions | ( | ) |
Gets the number of expressions added to this model.
LSExpression localsolver.LSModel.GetExpression | ( | int | exprIndex | ) |
Gets the expression with the given index in this model.
exprIndex | Index of the expression. |
LSExpression localsolver.LSModel.GetExpression | ( | string | name | ) |
Gets the expression with the given name.
Throws an exception if no expression with the given name exists.
name | Name. |
int localsolver.LSModel.GetNbDecisions | ( | ) |
Gets the number of decisions in the model.
This corresponds to the number of decision variables declared in the model.
LSExpression localsolver.LSModel.GetDecision | ( | int | decisionIndex | ) |
Gets the decision with the given index.
decisionIndex | Index of the decision. |
void localsolver.LSModel.AddConstraint | ( | LSExpression | expr | ) |
Adds the given expression to the list of constraints.
It means that the value of this expression must be constrained to be equal to 1 in any solution found by the solver. Hence, only boolean expressions (that is, expressions whose value is boolean) can be constrained. Only allowed in state LSState::Modeling. If the expression is already a constraint, this method does nothing and returns immediately. Try to avoid hard constraints as much as possible, because LocalSolver (and more generally local search) is not suited for solving hardly constrained problems. In particular, banish constraints that are not surely satisfied in practice. Ideally, only combinatorial constraints (which induce the combinatorial structure of your problem) have to be set. All the other constraints can be relaxed as primary objectives in order to be "softly" satisfied (goal programming). For instance, constraint a <= b can be transformed into minimize max(b-a, 0).
expr | Expression. |
void localsolver.LSModel.Constraint | ( | LSExpression | expr | ) |
Shortcut for addConstraint(expr).
expr | Expression. |
Since version 5.5
void localsolver.LSModel.RemoveConstraint | ( | LSExpression | expr | ) |
Removes the given expression from the list of constraints.
If the expression was not constrained, this method does nothing and returns immediately. Only allowed in state LSState::Modeling.
expr | Expression. |
Since version 5.0
void localsolver.LSModel.RemoveConstraint | ( | int | constraintIndex | ) |
Removes the constraint at the given position in the list of constraints.
Only allowed in state LSState::Modeling.
constraintIndex | position of the constraint to remove. |
Since version 5.0
int localsolver.LSModel.GetNbConstraints | ( | ) |
Gets the number of constraints added to this model.
LSExpression localsolver.LSModel.GetConstraint | ( | int | constraintIndex | ) |
Gets the constraint with the given index.
constraintIndex | Index of the constraint. |
void localsolver.LSModel.AddObjective | ( | LSExpression | expr, |
LSObjectiveDirection | direction | ||
) |
Adds the given expression to the list of objectives to optimize.
A same expression can be added more than once. Only allowed in state LSState::Modeling. Note that the objectives will be optimized in the order in which they have been added to the model. It is useful for lexicographic multiobjective optimization, and more particularly for goal programming.
expr | Expression. |
direction | Optimization direction of this objective. |
void localsolver.LSModel.Minimize | ( | LSExpression | expr | ) |
Shortcut for addObjective(expr, OD_Minimize).
expr | Expression. |
Since version 5.5
void localsolver.LSModel.Maximize | ( | LSExpression | expr | ) |
Shortcut for addObjective(expr, OD_Maximize).
expr | Expression. |
Since version 5.5
void localsolver.LSModel.RemoveObjective | ( | int | objectiveIndex | ) |
Removes the objective at the given position in the list of objectives.
Note that the objectives created after the removed one have their index decreased by 1. Phases are not modified when an objective is removed. It is the user's responsibility to change the objective index of each phase to keep it coherent (with LSPhase::SetOptimizedObjective), or to disable it (with LSPhase::SetEnabled). Only allowed in state LSState::Modeling.
objectiveIndex | position of the objective to remove. |
Since version 5.0
int localsolver.LSModel.GetNbObjectives | ( | ) |
Gets the number of objectives added to this model.
LSExpression localsolver.LSModel.GetObjective | ( | int | objectiveIndex | ) |
Gets the objective with the given index.
objectiveIndex | Index of the objective. |
LSObjectiveDirection localsolver.LSModel.GetObjectiveDirection | ( | int | objectiveIndex | ) |
Gets the direction of the objective with the given index.
objectiveIndex | Index of the objective. |
int localsolver.LSModel.GetNbOperands | ( | ) |
Gets the number of operands in the model.
This corresponds to the number of operands for all expressions declared in the model. It is an analog of the number of non zeros in matrix model encountered in mathematical programming: it gives an hint about the size and the density of your model.
void localsolver.LSModel.Close | ( | ) |
Closes the model.
Only allowed in state LSState::Modeling. Once the model is closed, no expression, constraints or objectives can be added. The model must be closed before starting its resolution.
void localsolver.LSModel.Open | ( | ) |
Opens or reopens the model.
When this method is called, the solver is placed in state LSState::Modeling. Only allowed in state LSState::Stopped.
bool localsolver.LSModel.IsClosed | ( | ) |
Returns true if the model is closed, false otherwise.
override string localsolver.LSModel.ToString | ( | ) |
Returns a string representation of this model.
This representation provides:
Useful for debugging or logging purposes.