Localsolver  5.5
localsolver.LSModel Class Reference

Detailed Description

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 Open()) or instantiate another LocalSolver environment to optimize another model.

LSExpression LSOperator

Public Member Functions

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

Member Function Documentation

LSExpression localsolver.LSModel.CreateConstant ( long  value)
inline

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.

Parameters
valueValue of the constant.
Returns
Created constant expression.
LSExpression localsolver.LSModel.CreateConstant ( double  value)
inline

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.

Parameters
valueValue of the constant
Returns
Created constant expression.
LSExpression localsolver.LSModel.CreateExpression ( LSOperator  op)
inline

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 CreateConstant(long) or CreateConstant(double) instead.

Parameters
opType of expression to create.
Returns
Created expression.
LSExpression localsolver.LSModel.CreateExpression ( LSOperator  op,
LSExpression  expr0 
)
inline

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.

Template Parameters
T0type of the operand to add. Types allowed: constant types or LSExpression.
Parameters
opType of expression to create.
expr0Operand 0.
Returns
Created expression.
LSExpression localsolver.LSModel.CreateExpression ( LSOperator  op,
LSExpression  expr0,
LSExpression  expr1 
)
inline

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

Template Parameters
T0type of the operand to add. Types allowed: constant types, LSExpression or iterator.
T1type of the operand to add. Types allowed: constant types, LSExpression or iterator.
Parameters
opType of expression to create.
expr0Operand 0.
expr1Operand 1.
Returns
Created expression.
LSExpression localsolver.LSModel.CreateExpression ( LSOperator  op,
LSExpression  expr0,
LSExpression  expr1,
LSExpression  expr2 
)
inline

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.

Template Parameters
T0type of the operand to add. Types allowed: constant types or LSExpression.
T1type of the operand to add. Types allowed: constant types or LSExpression.
T2type of the operand to add. Types allowed: constant types or LSExpression.
Parameters
opType of expression to create.
expr0Operand 0.
expr1Operand 1.
expr2Operand 2.
Returns
Created expression.
LSExpression localsolver.LSModel.Bool ( )
inline

Creates a boolean decision.

Binary decision with domain [0, 1].

LSOperator.Bool <since>5.5</since>

LSExpression localsolver.LSModel.Float ( double  min,
double  max 
)
inline

Creates a float decision.

Decision variable with domain [min, max].

LSOperator.Float <since>5.5</since>

LSExpression localsolver.LSModel.Int ( long  min,
long  max 
)
inline

Creates an integer decision.

Decision variable with domain [min, max].

LSOperator.Int <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( )
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( IEnumerable< LSExpression operands)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( params LSExpression[]  operands)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( long  a)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( double  a)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( LSExpression  a,
LSExpression  b 
)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( long  a,
LSExpression  b 
)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( LSExpression  a,
long  b 
)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( double  a,
LSExpression  b 
)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sum ( LSExpression  a,
double  b 
)
inline

Creates a sum expression.

LSOperator.Sum <since>5.5</since>

LSExpression localsolver.LSModel.Sub ( LSExpression  a,
LSExpression  b 
)
inline

Creates a substraction expression.

LSOperator.Sub <since>5.5</since>

LSExpression localsolver.LSModel.Sub ( long  a,
LSExpression  b 
)
inline

Creates a substraction expression.

LSOperator.Sub <since>5.5</since>

LSExpression localsolver.LSModel.Sub ( LSExpression  a,
long  b 
)
inline

Creates a substraction expression.

LSOperator.Sub <since>5.5</since>

LSExpression localsolver.LSModel.Sub ( double  a,
LSExpression  b 
)
inline

Creates a substraction expression.

LSOperator.Sub <since>5.5</since>

LSExpression localsolver.LSModel.Sub ( LSExpression  a,
double  b 
)
inline

Creates a substraction expression.

LSOperator.Sub <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( )
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( IEnumerable< LSExpression operands)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( params LSExpression[]  operands)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( long  a)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( double  a)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( LSExpression  a,
LSExpression  b 
)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( LSExpression  a,
long  b 
)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( long  a,
LSExpression  b 
)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( LSExpression  a,
double  b 
)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Prod ( double  a,
LSExpression  b 
)
inline

Creates a product expression.

LSOperator.Prod <since>5.5</since>

LSExpression localsolver.LSModel.Max ( )
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( IEnumerable< LSExpression operands)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( params LSExpression[]  operands)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( long  a)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( double  a)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( LSExpression  a,
LSExpression  b 
)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( LSExpression  a,
long  b 
)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( long  a,
LSExpression  b 
)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( LSExpression  a,
double  b 
)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Max ( double  a,
LSExpression  b 
)
inline

Creates a maximum expression.

LSOperator.Max <since>5.5</since>

LSExpression localsolver.LSModel.Min ( )
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( IEnumerable< LSExpression operands)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( params LSExpression[]  operands)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( long  a)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( double  a)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( LSExpression  a,
LSExpression  b 
)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( LSExpression  a,
long  b 
)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( long  a,
LSExpression  b 
)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( LSExpression  a,
double  b 
)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Min ( double  a,
LSExpression  b 
)
inline

Creates a minimum expression.

LSOperator.Min <since>5.5</since>

LSExpression localsolver.LSModel.Eq ( LSExpression  a,
LSExpression  b 
)
inline

Creates an equality expression.

LSOperator.Eq <since>5.5</since>

LSExpression localsolver.LSModel.Eq ( LSExpression  a,
long  b 
)
inline

Creates an equality expression.

LSOperator.Eq <since>5.5</since>

LSExpression localsolver.LSModel.Eq ( long  a,
LSExpression  b 
)
inline

Creates an equality expression.

LSOperator.Eq <since>5.5</since>

LSExpression localsolver.LSModel.Eq ( LSExpression  a,
double  b 
)
inline

Creates an equality expression.

LSOperator.Eq <since>5.5</since>

LSExpression localsolver.LSModel.Eq ( double  a,
LSExpression  b 
)
inline

Creates an equality expression.

LSOperator.Eq <since>5.5</since>

LSExpression localsolver.LSModel.Neq ( LSExpression  a,
LSExpression  b 
)
inline

Creates a disequality expression.

LSOperator.Neq <since>5.5</since>

LSExpression localsolver.LSModel.Neq ( LSExpression  a,
long  b 
)
inline

Creates a disequality expression.

LSOperator.Neq <since>5.5</since>

LSExpression localsolver.LSModel.Neq ( long  a,
LSExpression  b 
)
inline

Creates a disequality expression.

LSOperator.Neq <since>5.5</since>

LSExpression localsolver.LSModel.Neq ( LSExpression  a,
double  b 
)
inline

Creates a disequality expression.

LSOperator.Neq <since>5.5</since>

LSExpression localsolver.LSModel.Neq ( double  a,
LSExpression  b 
)
inline

Creates a disequality expression.

LSOperator.Neq <since>5.5</since>

LSExpression localsolver.LSModel.Geq ( LSExpression  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than or equal to.

LSOperator.Geq <since>5.5</since>

LSExpression localsolver.LSModel.Geq ( LSExpression  a,
long  b 
)
inline

Creates an inequality expression greater than or equal to.

LSOperator.Geq <since>5.5</since>

LSExpression localsolver.LSModel.Geq ( long  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than or equal to.

LSOperator.Geq <since>5.5</since>

LSExpression localsolver.LSModel.Geq ( LSExpression  a,
double  b 
)
inline

Creates an inequality expression greater than or equal to.

LSOperator.Geq <since>5.5</since>

LSExpression localsolver.LSModel.Geq ( double  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than or equal to.

LSOperator.Geq <since>5.5</since>

LSExpression localsolver.LSModel.Leq ( LSExpression  a,
LSExpression  b 
)
inline

Creates an inequality expression less than or equal to.

LSOperator.Leq <since>5.5</since>

LSExpression localsolver.LSModel.Leq ( LSExpression  a,
long  b 
)
inline

Creates an inequality expression less than or equal to.

LSOperator.Leq <since>5.5</since>

LSExpression localsolver.LSModel.Leq ( long  a,
LSExpression  b 
)
inline

Creates an inequality expression less than or equal to.

LSOperator.Leq <since>5.5</since>

LSExpression localsolver.LSModel.Leq ( LSExpression  a,
double  b 
)
inline

Creates an inequality expression less than or equal to.

LSOperator.Leq <since>5.5</since>

LSExpression localsolver.LSModel.Leq ( double  a,
LSExpression  b 
)
inline

Creates an inequality expression less than or equal to.

LSOperator.Leq <since>5.5</since>

LSExpression localsolver.LSModel.Gt ( LSExpression  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than.

LSOperator.Gt <since>5.5</since>

LSExpression localsolver.LSModel.Gt ( LSExpression  a,
long  b 
)
inline

Creates an inequality expression greater than.

LSOperator.Gt <since>5.5</since>

LSExpression localsolver.LSModel.Gt ( long  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than.

LSOperator.Gt <since>5.5</since>

LSExpression localsolver.LSModel.Gt ( LSExpression  a,
double  b 
)
inline

Creates an inequality expression greater than.

LSOperator.Gt <since>5.5</since>

LSExpression localsolver.LSModel.Gt ( double  a,
LSExpression  b 
)
inline

Creates an inequality expression greater than.

LSOperator.Gt <since>5.5</since>

LSExpression localsolver.LSModel.Lt ( LSExpression  a,
LSExpression  b 
)
inline

Creates an inequality expression less than.

LSOperator.Lt <since>5.5</since>

LSExpression localsolver.LSModel.Lt ( LSExpression  a,
long  b 
)
inline

Creates an inequality expression less than.

LSOperator.Lt <since>5.5</since>

LSExpression localsolver.LSModel.Lt ( long  a,
LSExpression  b 
)
inline

Creates an inequality expression less than.

LSOperator.Lt <since>5.5</since>

LSExpression localsolver.LSModel.Lt ( LSExpression  a,
double  b 
)
inline

Creates an inequality expression less than.

LSOperator.Lt <since>5.5</since>

LSExpression localsolver.LSModel.Lt ( double  a,
LSExpression  b 
)
inline

Creates an inequality expression less than.

LSOperator.Lt <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
LSExpression  b,
LSExpression  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
LSExpression  b,
long  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
long  b,
LSExpression  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
long  b,
long  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
LSExpression  b,
double  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
double  b,
LSExpression  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.If ( LSExpression  a,
double  b,
double  c 
)
inline

Creates a ternary conditionnal expression.

LSOperator.If <since>5.5</since>

LSExpression localsolver.LSModel.Not ( LSExpression  a)
inline

Creates a NOT expression.

LSOperator.Not <since>5.5</since>

LSExpression localsolver.LSModel.And ( )
inline

Creates an AND expression.

LSOperator.And <since>5.5</since>

LSExpression localsolver.LSModel.And ( IEnumerable< LSExpression operands)
inline

Creates an AND expression.

LSOperator.And <since>5.5</since>

LSExpression localsolver.LSModel.And ( params LSExpression[]  operands)
inline

Creates an AND expression.

LSOperator.And <since>5.5</since>

LSExpression localsolver.LSModel.And ( LSExpression  a,
LSExpression  b 
)
inline

Creates an AND expression.

LSOperator.And <since>5.5</since>

LSExpression localsolver.LSModel.Or ( )
inline

Creates a OR expression.

LSOperator.Or <since>5.5</since>

LSExpression localsolver.LSModel.Or ( IEnumerable< LSExpression operands)
inline

Creates a OR expression.

LSOperator.Or <since>5.5</since>

LSExpression localsolver.LSModel.Or ( params LSExpression[]  operands)
inline

Creates a OR expression.

LSOperator.Or <since>5.5</since>

LSExpression localsolver.LSModel.Or ( LSExpression  a,
LSExpression  b 
)
inline

Creates a OR expression.

LSOperator.Or <since>5.5</since>

LSExpression localsolver.LSModel.Xor ( )
inline

Creates a XOR expression.

LSOperator.Xor <since>5.5</since>

LSExpression localsolver.LSModel.Xor ( IEnumerable< LSExpression operands)
inline

Creates a XOR expression.

LSOperator.Xor <since>5.5</since>

LSExpression localsolver.LSModel.Xor ( params LSExpression[]  operands)
inline

Creates a XOR expression.

LSOperator.Xor <since>5.5</since>

LSExpression localsolver.LSModel.Xor ( LSExpression  a,
LSExpression  b 
)
inline

Creates a XOR expression.

LSOperator.Xor <since>5.5</since>

LSExpression localsolver.LSModel.Abs ( LSExpression  a)
inline

Creates an absolute value expression.

LSOperator.Abs <since>5.5</since>

LSExpression localsolver.LSModel.Dist ( LSExpression  a,
LSExpression  b 
)
inline

Creates a distance expression.

LSOperator.Dist <since>5.5</since>

LSExpression localsolver.LSModel.Dist ( LSExpression  a,
long  b 
)
inline

Creates a distance expression.

LSOperator.Dist <since>5.5</since>

LSExpression localsolver.LSModel.Dist ( long  a,
LSExpression  b 
)
inline

Creates a distance expression.

LSOperator.Dist <since>5.5</since>

LSExpression localsolver.LSModel.Dist ( LSExpression  a,
double  b 
)
inline

Creates a distance expression.

LSOperator.Dist <since>5.5</since>

LSExpression localsolver.LSModel.Dist ( double  a,
LSExpression  b 
)
inline

Creates a distance expression.

LSOperator.Dist <since>5.5</since>

LSExpression localsolver.LSModel.Div ( LSExpression  a,
LSExpression  b 
)
inline

Creates a division expression.

LSOperator.Div <since>5.5</since>

LSExpression localsolver.LSModel.Div ( LSExpression  a,
long  b 
)
inline

Creates a division expression.

LSOperator.Div <since>5.5</since>

LSExpression localsolver.LSModel.Div ( long  a,
LSExpression  b 
)
inline

Creates a division expression.

LSOperator.Div <since>5.5</since>

LSExpression localsolver.LSModel.Div ( LSExpression  a,
double  b 
)
inline

Creates a division expression.

LSOperator.Div <since>5.5</since>

LSExpression localsolver.LSModel.Div ( double  a,
LSExpression  b 
)
inline

Creates a division expression.

LSOperator.Div <since>5.5</since>

LSExpression localsolver.LSModel.Mod ( LSExpression  a,
LSExpression  b 
)
inline

Creates a modulo expression.

LSOperator.Mod <since>5.5</since>

LSExpression localsolver.LSModel.Mod ( LSExpression  a,
long  b 
)
inline

Creates a modulo expression.

LSOperator.Mod <since>5.5</since>

LSExpression localsolver.LSModel.Mod ( long  a,
LSExpression  b 
)
inline

Creates a modulo expression.

LSOperator.Mod <since>5.5</since>

LSExpression localsolver.LSModel.Array ( )
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( IEnumerable< LSExpression operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( IEnumerable< long >  operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( IEnumerable< double >  operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( params LSExpression[]  operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( params long[]  operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.Array ( params double[]  operands)
inline

Creates an array expression.

LSOperator.Array <since>5.5</since>

LSExpression localsolver.LSModel.At ( LSExpression  arrayExpr,
params LSExpression[]  indicesExpr 
)
inline

Creates a "at" expression.

LSOperator.At <since>5.5</since>

LSExpression localsolver.LSModel.At ( LSExpression  arrayExpr,
long  index 
)
inline

Creates a "at" expression.

See Also
LSOperator.At

Since version 5.5

LSExpression localsolver.LSModel.Scalar ( LSExpression  a,
LSExpression  b 
)
inline

Creates a scalar product expression between 2 arrays.

LSOperator.Scalar <since>5.5</since>

LSExpression localsolver.LSModel.Ceil ( LSExpression  a)
inline

Creates a ceil expression.

LSOperator.Ceil <since>5.5</since>

LSExpression localsolver.LSModel.Floor ( LSExpression  a)
inline

Creates a floor expression.

LSOperator.Floor <since>5.5</since>

LSExpression localsolver.LSModel.Round ( LSExpression  a)
inline

Creates a round expression.

LSOperator.Round <since>5.5</since>

LSExpression localsolver.LSModel.Sqrt ( LSExpression  a)
inline

Creates a square root expression.

LSOperator.Sqrt <since>5.5</since>

LSExpression localsolver.LSModel.Log ( LSExpression  a)
inline

Creates a natural logarithm expression.

LSOperator.Log <since>5.5</since>

LSExpression localsolver.LSModel.Exp ( LSExpression  a)
inline

Creates an exponential expression.

LSOperator.Exp <since>5.5</since>

LSExpression localsolver.LSModel.Pow ( LSExpression  a,
LSExpression  b 
)
inline

Creates a power expression.

LSOperator.Pow <since>5.5</since>

LSExpression localsolver.LSModel.Pow ( LSExpression  a,
long  b 
)
inline

Creates a power expression.

LSOperator.Pow <since>5.5</since>

LSExpression localsolver.LSModel.Pow ( long  a,
LSExpression  b 
)
inline

Creates a power expression.

LSOperator.Pow <since>5.5</since>

LSExpression localsolver.LSModel.Pow ( LSExpression  a,
double  b 
)
inline

Creates a power expression.

LSOperator.Pow <since>5.5</since>

LSExpression localsolver.LSModel.Pow ( double  a,
LSExpression  b 
)
inline

Creates a power expression.

LSOperator.Pow <since>5.5</since>

LSExpression localsolver.LSModel.Cos ( LSExpression  a)
inline

Creates a cosine expression.

LSOperator.Cos <since>5.5</since>

LSExpression localsolver.LSModel.Sin ( LSExpression  a)
inline

Creates a sine expression.

LSOperator.Sin <since>5.5</since>

LSExpression localsolver.LSModel.Tan ( LSExpression  a)
inline

Creates a tangent expression.

LSOperator.Tan <since>5.5</since>

LSExpression localsolver.LSModel.Piecewise ( LSExpression  abscissae,
LSExpression  ordinates,
LSExpression  x 
)
inline

Creates a piecewise linear expression.

LSOperator.Piecewise <since>5.5</since>

LSExpression localsolver.LSModel.List ( long  a)
inline

Creates a list variable.

LSOperator.List <since>5.5</since>

LSExpression localsolver.LSModel.Count ( LSExpression  a)
inline

Creates a count expression.

LSOperator.Count <since>5.5</since>

LSExpression localsolver.LSModel.IndexOf ( LSExpression  a,
long  b 
)
inline

Creates an indexOf expression.

LSOperator.IndexOf <since>5.5</since>

LSExpression localsolver.LSModel.IndexOf ( LSExpression  a,
LSExpression  b 
)
inline

Creates an indexOf expression.

LSOperator.IndexOf <since>5.5</since>

LSExpression localsolver.LSModel.Partition ( )
inline

Creates a partition expression.

LSOperator.Partition <since>5.5</since>

LSExpression localsolver.LSModel.Partition ( params LSExpression[]  operands)
inline

Creates a partition expression.

See Also
LSOperator.Partition

Since version 5.5

LSExpression localsolver.LSModel.Disjoint ( )
inline

Creates a disjoint expression.

LSOperator.Disjoint <since>5.5</since>

LSExpression localsolver.LSModel.Disjoint ( params LSExpression[]  operands)
inline

Creates a disjoint expression.

See Also
LSOperator.Disjoint

Since version 5.5

int localsolver.LSModel.GetNbExpressions ( )
inline

Gets the number of expressions added to this model.

Returns
Number of expressions.
LSExpression localsolver.LSModel.GetExpression ( int  exprIndex)
inline

Gets the expression with the given index in this model.

Parameters
exprIndexIndex of the expression.
Returns
Expression with the given index.
LSExpression localsolver.LSModel.GetExpression ( string  name)
inline

Gets the expression with the given name.

Throws an exception if no expression with the given name exists.

Parameters
nameName.
Returns
Expression with the given name.
int localsolver.LSModel.GetNbDecisions ( )
inline

Gets the number of decisions in the model.

This corresponds to the number of decision variables declared in the model.

Returns
Number of decisions.
LSExpression localsolver.LSModel.GetDecision ( int  decisionIndex)
inline

Gets the decision with the given index.

Parameters
decisionIndexIndex of the decision.
Returns
Decision with the given index.
void localsolver.LSModel.AddConstraint ( LSExpression  expr)
inline

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

Parameters
exprExpression.
void localsolver.LSModel.Constraint ( LSExpression  expr)
inline

Shortcut for addConstraint(expr).

Parameters
exprExpression.

LSModel.AddConstraint Since version 5.5

void localsolver.LSModel.RemoveConstraint ( LSExpression  expr)
inline

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.

Parameters
exprExpression.

Since version 5.0

void localsolver.LSModel.RemoveConstraint ( int  constraintIndex)
inline

Removes the constraint at the given position in the list of constraints.

Only allowed in state LSState.Modeling.

Parameters
constraintIndexposition of the constraint to remove.

Since version 5.0

int localsolver.LSModel.GetNbConstraints ( )
inline

Gets the number of constraints added to this model.

Returns
Number of constraints.
LSExpression localsolver.LSModel.GetConstraint ( int  constraintIndex)
inline

Gets the constraint with the given index.

Parameters
constraintIndexIndex of the constraint.
Returns
Constraint with the given index.
void localsolver.LSModel.AddObjective ( LSExpression  expr,
LSObjectiveDirection  direction 
)
inline

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.

Parameters
exprExpression.
directionOptimization direction of this objective.
void localsolver.LSModel.Minimize ( LSExpression  expr)
inline

Shortcut for addObjective(expr, OD_Minimize).

Parameters
exprExpression.

LSModel.AddObjective Since version 5.5

void localsolver.LSModel.Maximize ( LSExpression  expr)
inline

Shortcut for addObjective(expr, OD_Maximize).

Parameters
exprExpression.

LSModel.AddObjective Since version 5.5

void localsolver.LSModel.RemoveObjective ( int  objectiveIndex)
inline

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.

Parameters
objectiveIndexposition of the objective to remove.

Since version 5.0

int localsolver.LSModel.GetNbObjectives ( )
inline

Gets the number of objectives added to this model.

Returns
Number of objectives.
LSExpression localsolver.LSModel.GetObjective ( int  objectiveIndex)
inline

Gets the objective with the given index.

Parameters
objectiveIndexIndex of the objective.
Returns
Objective with the given index.
LSObjectiveDirection localsolver.LSModel.GetObjectiveDirection ( int  objectiveIndex)
inline

Gets the direction of the objective with the given index.

Parameters
objectiveIndexIndex of the objective.
Returns
Objective direction.
int localsolver.LSModel.GetNbOperands ( )
inline

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.

Returns
Number of operands.
void localsolver.LSModel.Close ( )
inline

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

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

Returns true if the model is closed, false otherwise.

Returns
True if the model is closed.
override string localsolver.LSModel.ToString ( )
inline

Returns a string representation of this model.

This representation provides:

  • The number of expressions, decisions, constraints, and objectives.
  • The density of the model. Useful for debugging or logging purposes.
Returns
String representation.