public class LSModel
extends java.lang.Object
open()) or instantiate another LocalSolver environment to optimize
another model.LSExpression,
LSOperator| Modifier and Type | Method and Description |
|---|---|
LSExpression |
abs(LSExpression a)
Creates an absolute value expression.
|
void |
addConstraint(LSExpression expr)
Adds the given expression to the list of constraints.
|
void |
addObjective(LSExpression expr,
LSObjectiveDirection direction)
Adds the given expression to the list of objectives to optimize.
|
LSExpression |
and()
Creates an AND expression.
|
LSExpression |
and(java.lang.Iterable<LSExpression> operands)
Creates an AND expression.
|
LSExpression |
and(LSExpression... operands)
Creates an AND expression.
|
LSExpression |
and(LSExpression a,
LSExpression b)
Creates an AND expression.
|
LSExpression |
array()
Creates an array expression.
|
LSExpression |
array(double... operands)
Creates an array expression.
|
LSExpression |
array(float... operands)
Creates an array expression.
|
LSExpression |
array(int... operands)
Creates an array expression.
|
LSExpression |
array(long... operands)
Creates an array expression.
|
LSExpression |
array(LSExpression... operands)
Creates an array expression.
|
LSExpression |
array(java.lang.Object operands)
Creates an N-dimensional array expression.
|
LSExpression |
at(LSExpression arrayExpr,
long index)
Creates a "at" expression.
|
LSExpression |
at(LSExpression arrayExpr,
LSExpression... indicesExpr)
Creates a "at" expression for N-dimensional array.
|
LSExpression |
boolVar()
Creates a boolean decision.
|
LSExpression |
call()
Creates a call expression.
|
LSExpression |
call(java.lang.Iterable<LSExpression> operands)
Creates a call expression.
|
LSExpression |
call(LSExpression... operands)
Creates a call expression.
|
LSExpression |
call(LSExpression a)
Creates a call expression.
|
LSExpression |
call(LSExpression a,
LSExpression b)
Creates a call expression.
|
LSExpression |
call(LSExpression a,
LSExpression b,
LSExpression c)
Creates a call expression.
|
LSExpression |
ceil(LSExpression a)
Creates a ceil expression.
|
void |
close()
Closes the model.
|
void |
constraint(LSExpression expr)
Shortcut for addConstraint(expr).
|
LSExpression |
contains(LSExpression a,
long b)
Creates a contains expression.
|
LSExpression |
contains(LSExpression a,
LSExpression b)
Creates a contains expression.
|
LSExpression |
cos(LSExpression a)
Creates a cosine expression.
|
LSExpression |
count(LSExpression a)
Creates a count expression.
|
LSExpression |
createConstant(double value)
Creates a constant expression representing the given value.
|
LSExpression |
createConstant(long value)
Creates a constant expression representing the given value.
|
LSExpression |
createExpression(LSOperator op)
Creates an expression of the given type.
|
LSExpression |
createExpression(LSOperator op,
double expr0)
Creates an expression of the given type, with the given operand.
|
LSExpression |
createExpression(LSOperator op,
double[] operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
double expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
double expr1,
double expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
double expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
LSExpression expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
LSExpression expr1,
double expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
double expr0,
LSExpression expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
float[] operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
int[] operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
java.lang.Iterable<LSExpression> operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0)
Creates an expression of the given type, with the given operand.
|
LSExpression |
createExpression(LSOperator op,
long[] operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
long expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
long expr1,
long expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
long expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
LSExpression expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
LSExpression expr1,
long expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
long expr0,
LSExpression expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression... operands)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0)
Creates an expression of the given type, with the given operand.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
double expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
double expr1,
double expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
double expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
long expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
long expr1,
long expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
long expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
LSExpression expr1)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
LSExpression expr1,
double expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
LSExpression expr1,
long expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createExpression(LSOperator op,
LSExpression expr0,
LSExpression expr1,
LSExpression expr2)
Creates an expression of the given type, with the given operands.
|
LSExpression |
createFunction(int nbArgs,
LSFunction functor)
Creates a function with arguments.
|
LSExpression |
createFunction(LSFunction0 functor)
Creates a function without arguments.
|
LSExpression |
createFunction(LSFunction1 functor)
Creates a function with one arguments A function is a particular
expression composed of two parts:
The arguments of the function (which are also LSExpressions of type
LSOperator.Argument.
The body of the function. |
LSExpression |
createFunction(LSFunction2 functor)
Creates a function with two arguments.
|
LSExpression |
createFunction(LSFunction3 functor)
Creates a function with three arguments.
|
LSExpression |
createNativeFunction(LSNativeFunction func)
Creates a native function.
|
LSExpression |
disjoint()
Creates a disjoint expression.
|
LSExpression |
disjoint(java.lang.Iterable<LSExpression> operands)
Creates a disjoint expression.
|
LSExpression |
disjoint(LSExpression... operands)
Creates a disjoint expression.
|
LSExpression |
dist(double a,
LSExpression 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(LSExpression a,
long b)
Creates a distance expression.
|
LSExpression |
dist(LSExpression a,
LSExpression b)
Creates a distance expression.
|
LSExpression |
div(double a,
LSExpression 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(LSExpression a,
long b)
Creates a division expression.
|
LSExpression |
div(LSExpression a,
LSExpression b)
Creates a division expression.
|
LSExpression |
eq(double a,
LSExpression 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(LSExpression a,
long b)
Creates an equality expression.
|
LSExpression |
eq(LSExpression a,
LSExpression b)
Creates an equality expression.
|
boolean |
equals(java.lang.Object obj) |
LSExpression |
exp(LSExpression a)
Creates an exponential expression.
|
LSExpression |
floatVar(double lb,
double ub)
Creates a float decision.
|
LSExpression |
floor(LSExpression a)
Creates a floor expression.
|
LSExpression |
function(int nbArgs,
LSFunction functor)
Creates a function expression.
|
LSExpression |
function(LSFunction0 functor)
Creates a function expression.
|
LSExpression |
function(LSFunction1 functor)
Creates a function expression.
|
LSExpression |
function(LSFunction2 functor)
Creates a function expression.
|
LSExpression |
function(LSFunction3 functor)
Creates a function expression.
|
LSExpression |
geq(double a,
LSExpression 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(LSExpression a,
long b)
Creates an inequality expression greater than or equal to.
|
LSExpression |
geq(LSExpression a,
LSExpression b)
Creates an inequality expression greater than or equal to.
|
LSExpression |
getConstraint(int constraintIndex)
Gets the constraint with the given index.
|
LSExpression |
getDecision(int decisionIndex)
Gets the decision with the given index.
|
LSExpression |
getExpression(int exprIndex)
Gets the expression with the given index in this model.
|
LSExpression |
getExpression(java.lang.String name)
Gets the expression with the given index in this model.
|
LocalSolver |
getLocalSolver()
Returns the LocalSolver object associated to this model.
|
int |
getNbConstraints()
Gets the number of constraints added to this model.
|
int |
getNbDecisions()
Gets the number of decisions in the model.
|
int |
getNbExpressions()
Gets the number of expressions added to this model.
|
int |
getNbObjectives()
Gets the number of objectives added to this model.
|
int |
getNbOperands()
Gets the number of operands in the 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.
|
LSExpression |
gt(double a,
LSExpression 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(LSExpression a,
long b)
Creates an inequality expression greater than.
|
LSExpression |
gt(LSExpression a,
LSExpression b)
Creates an inequality expression greater than.
|
int |
hashCode() |
LSExpression |
iif(LSExpression a,
double b,
double c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
double b,
LSExpression c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
long b,
long c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
long b,
LSExpression c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
LSExpression b,
double c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
LSExpression b,
long c)
Creates a ternary conditional expression.
|
LSExpression |
iif(LSExpression a,
LSExpression b,
LSExpression c)
Creates a ternary conditional expression.
|
LSExpression |
indexOf(LSExpression a,
long b)
Creates an indexOf expression.
|
LSExpression |
indexOf(LSExpression a,
LSExpression b)
Creates an indexOf expression.
|
LSExpression |
intVar(long lb,
long ub)
Creates an integer decision.
|
boolean |
isClosed()
Returns true if the model is closed, false otherwise.
|
LSExpression |
leq(double a,
LSExpression 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(LSExpression a,
long b)
Creates an inequality expression less than or equal to.
|
LSExpression |
leq(LSExpression a,
LSExpression b)
Creates an inequality expression less than or equal to.
|
LSExpression |
listVar(long n)
Creates a list decision with the given length.
|
LSExpression |
log(LSExpression a)
Creates a log expression.
|
LSExpression |
lt(double a,
LSExpression 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(LSExpression a,
long b)
Creates an inequality expression less than.
|
LSExpression |
lt(LSExpression a,
LSExpression b)
Creates an inequality expression less than.
|
LSExpression |
max()
Creates a maximum expression.
|
LSExpression |
max(double a)
Creates a maximum expression.
|
LSExpression |
max(double a,
LSExpression b)
Creates a maximum expression.
|
LSExpression |
max(java.lang.Iterable<LSExpression> operands)
Creates a maximum expression.
|
LSExpression |
max(long a)
Creates a maximum expression.
|
LSExpression |
max(long a,
LSExpression b)
Creates a maximum expression.
|
LSExpression |
max(LSExpression... operands)
Creates a maximum expression.
|
LSExpression |
max(LSExpression a,
double b)
Creates a maximum expression.
|
LSExpression |
max(LSExpression a,
long b)
Creates a maximum expression.
|
LSExpression |
max(LSExpression a,
LSExpression b)
Creates a maximum expression.
|
void |
maximize(LSExpression expr)
Shortcut for addObjective(expr, OD_Maximize).
|
LSExpression |
min()
Creates a minimum expression.
|
LSExpression |
min(double a)
Creates a minimum expression.
|
LSExpression |
min(double a,
LSExpression b)
Creates a minimum expression.
|
LSExpression |
min(java.lang.Iterable<LSExpression> operands)
Creates a minimum expression.
|
LSExpression |
min(long a)
Creates a minimum expression.
|
LSExpression |
min(long a,
LSExpression b)
Creates a minimum expression.
|
LSExpression |
min(LSExpression... operands)
Creates a minimum expression.
|
LSExpression |
min(LSExpression a,
double b)
Creates a minimum expression.
|
LSExpression |
min(LSExpression a,
long b)
Creates a minimum expression.
|
LSExpression |
min(LSExpression a,
LSExpression b)
Creates a minimum expression.
|
void |
minimize(LSExpression expr)
Shortcut for addObjective(expr, OD_Minimize).
|
LSExpression |
mod(long a,
LSExpression b)
Creates a modulo expression.
|
LSExpression |
mod(LSExpression a,
long b)
Creates a modulo expression.
|
LSExpression |
mod(LSExpression a,
LSExpression b)
Creates a modulo expression.
|
LSExpression |
nativeFunction(LSNativeFunction func)
Creates a function expression.
|
LSExpression |
neq(double a,
LSExpression 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(LSExpression a,
long b)
Creates a disequality expression.
|
LSExpression |
neq(LSExpression a,
LSExpression b)
Creates a disequality expression.
|
LSExpression |
not(LSExpression a)
Creates a NOT expression.
|
void |
open()
Reopens the model.
|
LSExpression |
or()
Creates a OR expression.
|
LSExpression |
or(java.lang.Iterable<LSExpression> operands)
Creates a OR expression.
|
LSExpression |
or(LSExpression... operands)
Creates a OR expression.
|
LSExpression |
or(LSExpression a,
LSExpression b)
Creates a OR expression.
|
LSExpression |
partition()
Creates a partition expression.
|
LSExpression |
partition(java.lang.Iterable<LSExpression> operands)
Creates a partition expression.
|
LSExpression |
partition(LSExpression... operands)
Creates a partition expression.
|
LSExpression |
piecewise(LSExpression abscissae,
LSExpression ordinates,
LSExpression x)
Creates a piecewise linear expression.
|
LSExpression |
pow(double a,
LSExpression 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(LSExpression a,
long b)
Creates a power expression.
|
LSExpression |
pow(LSExpression a,
LSExpression b)
Creates a power expression.
|
LSExpression |
prod()
Creates a product expression.
|
LSExpression |
prod(double a)
Creates a product expression.
|
LSExpression |
prod(double a,
LSExpression b)
Creates a product expression.
|
LSExpression |
prod(java.lang.Iterable<LSExpression> operands)
Creates a product expression.
|
LSExpression |
prod(long a)
Creates a product expression.
|
LSExpression |
prod(long a,
LSExpression b)
Creates a product expression.
|
LSExpression |
prod(LSExpression... operands)
Creates a product expression.
|
LSExpression |
prod(LSExpression a,
double b)
Creates a product expression.
|
LSExpression |
prod(LSExpression a,
long b)
Creates a product expression.
|
LSExpression |
prod(LSExpression a,
LSExpression b)
Creates a product expression.
|
LSExpression |
range(long a,
long b)
Creates a range expression, where a is the lower bound (inclusive) and
b is the upper bound (exclusive).
|
LSExpression |
range(long a,
LSExpression b)
Creates a range expression, where a is the lower bound (inclusive) and
b is the upper bound (exclusive).
|
LSExpression |
range(LSExpression a,
long b)
Creates a range expression, where a is the lower bound (inclusive) and
b is the upper bound (exclusive).
|
LSExpression |
range(LSExpression a,
LSExpression b)
Creates a range expression, where a is the lower bound (inclusive) and
b is the upper bound (exclusive).
|
void |
removeConstraint(int constraintIndex)
Removes the constraint at the given position in the list of constraints.
|
void |
removeConstraint(LSExpression expr)
Removes the given expression from the list of constraints.
|
void |
removeObjective(int objectiveIndex)
Removes the objective at the given position in the list of objectives.
|
LSExpression |
round(LSExpression a)
Creates a rounding expression.
|
LSExpression |
scalar(LSExpression a,
LSExpression b)
Creates an expression for the scalar product between two arrays.
|
LSExpression |
setVar(long n)
Creates a set decision with the given length.
|
LSExpression |
sin(LSExpression a)
Creates a sine expression.
|
LSExpression |
sqrt(LSExpression a)
Creates a square root expression.
|
LSExpression |
sub(double a,
LSExpression b)
Creates a substraction expression.
|
LSExpression |
sub(long a,
LSExpression b)
Creates a substraction expression.
|
LSExpression |
sub(LSExpression a,
double b)
Creates a substraction expression.
|
LSExpression |
sub(LSExpression a,
long b)
Creates a substraction expression.
|
LSExpression |
sub(LSExpression a,
LSExpression b)
Creates a substraction expression.
|
LSExpression |
sum()
Creates a sum expression.
|
LSExpression |
sum(double a)
Creates a sum expression.
|
LSExpression |
sum(double a,
LSExpression b)
Creates a sum expression.
|
LSExpression |
sum(java.lang.Iterable<LSExpression> operands)
Creates a sum expression.
|
LSExpression |
sum(long a)
Creates a sum expression.
|
LSExpression |
sum(long a,
LSExpression b)
Creates a sum expression.
|
LSExpression |
sum(LSExpression... operands)
Creates a sum expression.
|
LSExpression |
sum(LSExpression a,
double b)
Creates a sum expression.
|
LSExpression |
sum(LSExpression a,
long b)
Creates a sum expression.
|
LSExpression |
sum(LSExpression a,
LSExpression b)
Creates a sum expression.
|
LSExpression |
tan(LSExpression a)
Creates a tangent expression.
|
java.lang.String |
toString()
Returns a String representation of this model.
|
LSExpression |
xor()
Creates a XOR expression.
|
LSExpression |
xor(java.lang.Iterable<LSExpression> operands)
Creates a XOR expression.
|
LSExpression |
xor(LSExpression... operands)
Creates a XOR expression.
|
LSExpression |
xor(LSExpression a,
LSExpression b)
Creates a XOR expression.
|
public LocalSolver getLocalSolver()
public LSExpression createConstant(long value)
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.public LSExpression createConstant(double value)
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.public LSExpression createExpression(LSOperator op)
LSState.Modeling. This
method cannot be used to create constants: use
createConstant(long) or createConstant(double) instead.op - Type of expression to create.public LSExpression createExpression(LSOperator op, LSExpression expr0)
LSState.Modeling. Useful for creating unary
expressions.op - Type of expression to create.expr0 - Operand 0.public LSExpression createExpression(LSOperator op, long expr0)
LSState.Modeling. Useful for creating unary
expressions.op - Type of expression to create.expr0 - Operand 0.public LSExpression createExpression(LSOperator op, double expr0)
LSState.Modeling. Useful for creating unary
expressions.op - Type of expression to create.expr0 - Operand 0.public LSExpression createExpression(LSOperator op, LSExpression expr0, LSExpression expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, long expr0, long expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, long expr0, LSExpression expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, LSExpression expr0, long expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, double expr0, double expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, double expr0, LSExpression expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, LSExpression expr0, double expr1)
LSState.Modeling. Useful for creating binary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.public LSExpression createExpression(LSOperator op, LSExpression expr0, LSExpression expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, long expr0, long expr1, long expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, long expr0, long expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, long expr0, LSExpression expr1, long expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, long expr0, LSExpression expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, long expr1, long expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, long expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, LSExpression expr1, long expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, double expr0, double expr1, double expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, double expr0, double expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, double expr0, LSExpression expr1, double expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, double expr0, LSExpression expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, double expr1, double expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, double expr1, LSExpression expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, LSExpression expr0, LSExpression expr1, double expr2)
LSState.Modeling. Useful for creating ternary
expressions.op - Type of expression to create.expr0 - Operand 0.expr1 - Operand 1.expr2 - Operand 2.public LSExpression createExpression(LSOperator op, java.lang.Iterable<LSExpression> operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createExpression(LSOperator op, LSExpression... operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createExpression(LSOperator op, int[] operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createExpression(LSOperator op, long[] operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createExpression(LSOperator op, float[] operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createExpression(LSOperator op, double[] operands)
LSState.Modeling. Useful for creating n-ary
expressions.op - Type of expression to create.operands - Operands to add.public LSExpression createNativeFunction(LSNativeFunction func)
Creates a native function. The argument must implement LSNativeFunction.
When the native function is called, the argument values will be made accessible to
your function through the native context.
Once you have instantiated it, you have to use call(LSExpression... operands) to call it in
your model.
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(int).
func - Native function to call.LSOperator.NativeFunctionpublic LSExpression createFunction(LSFunction0 functor)
LSOperator.Argument.functor - A function (LSFunction0) that returns an
LSExpression that will be used as the body of the new LocalSolver
function you want to create.LSOperator.Function.public LSExpression createFunction(LSFunction1 functor)
LSOperator.Argument.LSOperator.Argument. At the end of the evaluation
of your function, the returned LSExpression will be used as the body of
the LocalSolver function.functor - A function (LSFunction1) that accepts one
LSExpression as argument and returns an LSExpression
that will be used as the body of the new LocalSolver function you want
to create.LSOperator.Function.public LSExpression createFunction(LSFunction2 functor)
LSOperator.Argument.LSOperator.Argument that corresponds to the number of
arguments your function expects. At the end of the evaluation
of your function, the returned LSExpression will be used as the body of the
LocalSolver function.functor - A function (LSFunction2) that accepts two
LSExpression as arguments and returns an LSExpression
that will be used as the body of the new LocalSolver function you want
to create.LSOperator.Function.public LSExpression createFunction(LSFunction3 functor)
LSOperator.Argument.LSOperator.Argument that corresponds to the number of
arguments your function expects. At the end of the evaluation
of your function, the returned LSExpression will be used as the body of the
LocalSolver function.functor - A function (LSFunction3) that accepts three
LSExpression as arguments and returns an LSExpression
that will be used as the body of the new LocalSolver function you want
to create.LSOperator.Function.public LSExpression createFunction(int nbArgs, LSFunction functor)
LSOperator.Argument.LSOperator.Argument that corresponds to the number of
arguments you want and your function expects. At the end of the evaluation
of your function, the returned LSExpression will be used as the body of the
LocalSolver function.nbArgs - Number of arguments you want for your function.functor - A function (LSFunction) that accepts LSExpression
as arguments and returns an LSExpression that will be used
as the body of the new LocalSolver function you want to create.LSOperator.Function.public LSExpression boolVar()
createExpression(LSOperator.Bool).LSOperator.Bool,
createExpression(LSOperator)public LSExpression floatVar(double lb, double ub)
createExpression(LSOperator.Float, lb, ub).lb - Lower bound of the decision variable.ub - Upper bound of the decision variable.LSOperator.Float,
createExpression(LSOperator, double, double)public LSExpression intVar(long lb, long ub)
createExpression(LSOperator.Int, lb, ub).lb - Lower bound of the decision variable.ub - Upper bound of the decision variable.LSOperator.Int,
createExpression(LSOperator, long, long)public LSExpression sum()
createExpression(LSOperator.Sum).LSOperator.Sum,
createExpression(LSOperator)public LSExpression sum(long a)
createExpression(LSOperator.Sum, a).LSOperator.Sum,
createExpression(LSOperator, long)public LSExpression sum(double a)
createExpression(LSOperator.Sum, a).LSOperator.Sum,
createExpression(LSOperator, double)public LSExpression sum(LSExpression a, LSExpression b)
createExpression(LSOperator.Sum, a, b).LSOperator.Sum,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression sum(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Sum, operands).LSOperator.Sum,
createExpression(LSOperator, Iterable)public LSExpression sum(LSExpression... operands)
createExpression(LSOperator.Sum, operands).LSOperator.Sum,
createExpression(LSOperator, LSExpression...)public LSExpression sum(long a, LSExpression b)
createExpression(LSOperator.Sum, a, b).LSOperator.Sum,
createExpression(LSOperator, long, LSExpression)public LSExpression sum(LSExpression a, long b)
createExpression(LSOperator.Sum, a, b).LSOperator.Sum,
createExpression(LSOperator, LSExpression, long)public LSExpression sum(double a, LSExpression b)
createExpression(LSOperator.Sum, a, b).LSOperator.Sum,
createExpression(LSOperator, double, LSExpression)public LSExpression sum(LSExpression a, double b)
createExpression(LSOperator.Sum, a, b).LSOperator.Sum,
createExpression(LSOperator, LSExpression, double)public LSExpression sub(LSExpression a, LSExpression b)
createExpression(LSOperator.Sub, a, b).LSOperator.Sub,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression sub(long a, LSExpression b)
createExpression(LSOperator.Sub, a, b).LSOperator.Sub,
createExpression(LSOperator, long, LSExpression)public LSExpression sub(LSExpression a, long b)
createExpression(LSOperator.Sub, a, b).LSOperator.Sub,
createExpression(LSOperator, LSExpression, long)public LSExpression sub(double a, LSExpression b)
createExpression(LSOperator.Sub, a, b).LSOperator.Sub,
createExpression(LSOperator, double, LSExpression)public LSExpression sub(LSExpression a, double b)
createExpression(LSOperator.Sub, a, b).LSOperator.Sub,
createExpression(LSOperator, LSExpression, double)public LSExpression prod()
createExpression(LSOperator.Prod).LSOperator.Prod,
createExpression(LSOperator)public LSExpression prod(long a)
createExpression(LSOperator.Prod, a).LSOperator.Prod,
createExpression(LSOperator, long)public LSExpression prod(double a)
createExpression(LSOperator.Prod, a).LSOperator.Prod,
createExpression(LSOperator, double)public LSExpression prod(LSExpression a, LSExpression b)
createExpression(LSOperator.Prod, a, b).LSOperator.Prod,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression prod(LSExpression... operands)
createExpression(LSOperator.Prod, operands).LSOperator.Prod,
createExpression(LSOperator, LSExpression...)public LSExpression prod(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Prod, operands).LSOperator.Prod,
createExpression(LSOperator, Iterable)public LSExpression prod(LSExpression a, long b)
createExpression(LSOperator.Prod, a, b).LSOperator.Prod,
createExpression(LSOperator, LSExpression, long)public LSExpression prod(long a, LSExpression b)
createExpression(LSOperator.Prod, a, b).LSOperator.Prod,
createExpression(LSOperator, long, LSExpression)public LSExpression prod(LSExpression a, double b)
createExpression(LSOperator.Prod, a, b).LSOperator.Prod,
createExpression(LSOperator, LSExpression, double)public LSExpression prod(double a, LSExpression b)
createExpression(LSOperator.Prod, a, b).LSOperator.Prod,
createExpression(LSOperator, double, LSExpression)public LSExpression max()
createExpression(LSOperator.Max).LSOperator.Max,
createExpression(LSOperator)public LSExpression max(long a)
createExpression(LSOperator.Max, a).LSOperator.Max,
createExpression(LSOperator, long)public LSExpression max(double a)
createExpression(LSOperator.Max, a).LSOperator.Max,
createExpression(LSOperator, double)public LSExpression max(LSExpression a, LSExpression b)
createExpression(LSOperator.Max, a, b).LSOperator.Max,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression max(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Max, operands).LSOperator.Max,
createExpression(LSOperator, Iterable)public LSExpression max(LSExpression... operands)
createExpression(LSOperator.Max, operands).LSOperator.Max,
createExpression(LSOperator, LSExpression... operands)public LSExpression max(LSExpression a, long b)
createExpression(LSOperator.Max, a, b).LSOperator.Max,
createExpression(LSOperator, LSExpression, long)public LSExpression max(long a, LSExpression b)
createExpression(LSOperator.Max, a, b).LSOperator.Max,
createExpression(LSOperator, long, LSExpression)public LSExpression max(LSExpression a, double b)
createExpression(LSOperator.Max, a, b).LSOperator.Max,
createExpression(LSOperator, LSExpression, double)public LSExpression max(double a, LSExpression b)
createExpression(LSOperator.Max, a, b).LSOperator.Max,
createExpression(LSOperator, double, LSExpression)public LSExpression min()
createExpression(LSOperator.Min).LSOperator.Min,
createExpression(LSOperator)public LSExpression min(long a)
createExpression(LSOperator.Min, a).LSOperator.Min,
createExpression(LSOperator, long)public LSExpression min(double a)
createExpression(LSOperator.Min, a).LSOperator.Min,
createExpression(LSOperator, double)public LSExpression min(LSExpression a, LSExpression b)
createExpression(LSOperator.Min, a, b).LSOperator.Min,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression min(LSExpression... operands)
createExpression(LSOperator.Min, operands).LSOperator.Min,
createExpression(LSOperator, LSExpression...)public LSExpression min(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Min, operands).LSOperator.Min,
createExpression(LSOperator, Iterable)public LSExpression min(LSExpression a, long b)
createExpression(LSOperator.Min, a, b).LSOperator.Min,
createExpression(LSOperator, LSExpression, long)public LSExpression min(long a, LSExpression b)
createExpression(LSOperator.Min, a, b).LSOperator.Min,
createExpression(LSOperator, long, LSExpression)public LSExpression min(LSExpression a, double b)
LSOperator.Minpublic LSExpression min(double a, LSExpression b)
createExpression(LSOperator.Min, a, b).LSOperator.Min,
createExpression(LSOperator, double, LSExpression)public LSExpression eq(LSExpression a, LSExpression b)
createExpression(LSOperator.Eq, a, b).LSOperator.Eq,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression eq(LSExpression a, long b)
createExpression(LSOperator.Eq, a, b).LSOperator.Eq,
createExpression(LSOperator, LSExpression, long)public LSExpression eq(long a, LSExpression b)
createExpression(LSOperator.Eq, a, b).LSOperator.Eq,
createExpression(LSOperator, long, LSExpression)public LSExpression eq(LSExpression a, double b)
createExpression(LSOperator.Eq, a, b).LSOperator.Eq,
createExpression(LSOperator, LSExpression, double)public LSExpression eq(double a, LSExpression b)
createExpression(LSOperator.Eq, a, b).LSOperator.Eq,
createExpression(LSOperator, double, LSExpression)public LSExpression neq(LSExpression a, LSExpression b)
createExpression(LSOperator.Neq, a, b).LSOperator.Neq,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression neq(LSExpression a, long b)
createExpression(LSOperator.Neq, a, b).LSOperator.Neq,
createExpression(LSOperator, LSExpression, long)public LSExpression neq(long a, LSExpression b)
createExpression(LSOperator.Neq, a, b).LSOperator.Neq,
createExpression(LSOperator, long, LSExpression)public LSExpression neq(LSExpression a, double b)
createExpression(LSOperator.Neq, a, b).LSOperator.Neq,
createExpression(LSOperator, LSExpression, double)public LSExpression neq(double a, LSExpression b)
createExpression(LSOperator.Neq, a, b).LSOperator.Neq,
createExpression(LSOperator, double, LSExpression)public LSExpression geq(LSExpression a, LSExpression b)
createExpression(LSOperator.Geq, a, b).LSOperator.Geq,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression geq(LSExpression a, long b)
createExpression(LSOperator.Geq, a, b).LSOperator.Geq,
createExpression(LSOperator, LSExpression, long)public LSExpression geq(long a, LSExpression b)
createExpression(LSOperator.Geq, a, b).LSOperator.Geq,
createExpression(LSOperator, long, LSExpression)public LSExpression geq(LSExpression a, double b)
createExpression(LSOperator.Geq, a, b).LSOperator.Geq,
createExpression(LSOperator, LSExpression, double)public LSExpression geq(double a, LSExpression b)
createExpression(LSOperator.Geq, a, b).LSOperator.Geq,
createExpression(LSOperator, double, LSExpression)public LSExpression leq(LSExpression a, LSExpression b)
createExpression(LSOperator.Leq, a, b).LSOperator.Leq,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression leq(LSExpression a, long b)
createExpression(LSOperator.Leq, a, b).LSOperator.Leq,
createExpression(LSOperator, LSExpression, long)public LSExpression leq(long a, LSExpression b)
createExpression(LSOperator.Leq, a, b).LSOperator.Leq,
createExpression(LSOperator, long, LSExpression)public LSExpression leq(LSExpression a, double b)
createExpression(LSOperator.Leq, a, b).LSOperator.Leq,
createExpression(LSOperator, LSExpression, double)public LSExpression leq(double a, LSExpression b)
createExpression(LSOperator.Leq, a, b).LSOperator.Leq,
createExpression(LSOperator, double, LSExpression)public LSExpression gt(LSExpression a, LSExpression b)
createExpression(LSOperator.Gt, a, b).LSOperator.Gt,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression gt(LSExpression a, long b)
createExpression(LSOperator.Gt, a, b).LSOperator.Gt,
createExpression(LSOperator, LSExpression, long)public LSExpression gt(long a, LSExpression b)
createExpression(LSOperator.Gt, a, b).LSOperator.Gt,
createExpression(LSOperator, long, LSExpression)public LSExpression gt(LSExpression a, double b)
createExpression(LSOperator.Gt, a, b).LSOperator.Gt,
createExpression(LSOperator, LSExpression, double)public LSExpression gt(double a, LSExpression b)
createExpression(LSOperator.Gt, a, b).LSOperator.Gt,
createExpression(LSOperator, double, LSExpression)public LSExpression lt(LSExpression a, LSExpression b)
createExpression(LSOperator.Lt, a, b).LSOperator.Lt,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression lt(LSExpression a, long b)
createExpression(LSOperator.Lt, a, b).LSOperator.Lt,
createExpression(LSOperator, LSExpression, long)public LSExpression lt(long a, LSExpression b)
createExpression(LSOperator.Lt, a, b).LSOperator.Lt,
createExpression(LSOperator, long, LSExpression)public LSExpression lt(LSExpression a, double b)
createExpression(LSOperator.Lt, a, b).LSOperator.Lt,
createExpression(LSOperator, LSExpression, double)public LSExpression lt(double a, LSExpression b)
createExpression(LSOperator.Lt, a, b).LSOperator.Lt,
createExpression(LSOperator, double, LSExpression)public LSExpression iif(LSExpression a, LSExpression b, LSExpression c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, LSExpression, LSExpression)public LSExpression iif(LSExpression a, LSExpression b, long c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, LSExpression, long)public LSExpression iif(LSExpression a, long b, LSExpression c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, long, LSExpression)public LSExpression iif(LSExpression a, long b, long c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, long, long)public LSExpression iif(LSExpression a, LSExpression b, double c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, LSExpression, double)public LSExpression iif(LSExpression a, double b, LSExpression c)
createExpression(LSOperator.If, a, b, c).createExpression(LSOperator, LSExpression, double, LSExpression),
LSOperator.Ifpublic LSExpression iif(LSExpression a, double b, double c)
createExpression(LSOperator.If, a, b, c).LSOperator.If,
createExpression(LSOperator, LSExpression, double, double)public LSExpression not(LSExpression a)
createExpression(LSOperator.Not, a).LSOperator.Not,
createExpression(LSOperator, LSExpression)public LSExpression and()
createExpression(LSOperator.And).LSOperator.And,
createExpression(LSOperator)public LSExpression and(LSExpression a, LSExpression b)
createExpression(LSOperator.And, a, b).LSOperator.And,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression and(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.And, operands).LSOperator.And,
createExpression(LSOperator, Iterable)public LSExpression and(LSExpression... operands)
createExpression(LSOperator.And, operands).LSOperator.And,
createExpression(LSOperator, LSExpression...)public LSExpression or()
createExpression(LSOperator.Or).LSOperator.Or,
createExpression(LSOperator)public LSExpression or(LSExpression a, LSExpression b)
createExpression(LSOperator.Or, a, b).LSOperator.Or,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression or(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Or, operands).LSOperator.Or,
createExpression(LSOperator, Iterable)public LSExpression or(LSExpression... operands)
createExpression(LSOperator.Or, operands).LSOperator.Or,
createExpression(LSOperator, LSExpression...)public LSExpression xor()
createExpression(LSOperator.Xor).LSOperator.Xor,
createExpression(LSOperator)public LSExpression xor(LSExpression... operands)
createExpression(LSOperator.Xor, operands).LSOperator.Xor,
createExpression(LSOperator, LSExpression...)public LSExpression xor(LSExpression a, LSExpression b)
createExpression(LSOperator.Xor, a, b).LSOperator.Xor,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression xor(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Xor, operands).LSOperator.Xor,
createExpression(LSOperator, Iterable)public LSExpression abs(LSExpression a)
createExpression(LSOperator.Abs, a).LSOperator.Abs,
createExpression(LSOperator, LSExpression)public LSExpression dist(LSExpression a, LSExpression b)
createExpression(LSOperator.Dist, a, b).LSOperator.Dist,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression dist(LSExpression a, long b)
createExpression(LSOperator.Dist, a, b).LSOperator.Dist,
createExpression(LSOperator, LSExpression, long)public LSExpression dist(long a, LSExpression b)
createExpression(LSOperator.Dist, a, b).LSOperator.Dist,
createExpression(LSOperator, long, LSExpression)public LSExpression dist(LSExpression a, double b)
createExpression(LSOperator.Dist, a, b).LSOperator.Dist,
createExpression(LSOperator, LSExpression, double)public LSExpression dist(double a, LSExpression b)
createExpression(LSOperator.Dist, a, b).LSOperator.Dist,
createExpression(LSOperator, double, LSExpression)public LSExpression div(LSExpression a, LSExpression b)
createExpression(LSOperator.Div, a, b).LSOperator.Div,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression div(LSExpression a, long b)
createExpression(LSOperator.Div, a, b).LSOperator.Div,
createExpression(LSOperator, LSExpression, long)public LSExpression div(long a, LSExpression b)
createExpression(LSOperator.Div, a, b).LSOperator.Div,
createExpression(LSOperator, long, LSExpression)public LSExpression div(LSExpression a, double b)
createExpression(LSOperator.Div, a, b).LSOperator.Div,
createExpression(LSOperator, LSExpression, double)public LSExpression div(double a, LSExpression b)
createExpression(LSOperator.Div, a, b).LSOperator.Div,
createExpression(LSOperator, double, LSExpression)public LSExpression mod(LSExpression a, LSExpression b)
createExpression(LSOperator.Mod, a, b).LSOperator.Mod,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression mod(LSExpression a, long b)
createExpression(LSOperator.Mod, a, b).LSOperator.Mod,
createExpression(LSOperator, LSExpression, long)public LSExpression mod(long a, LSExpression b)
createExpression(LSOperator.Mod, a, b).LSOperator.Mod,
createExpression(LSOperator, long, LSExpression)public LSExpression array()
createExpression(LSOperator.Array).LSOperator.Array,
createExpression(LSOperator)public LSExpression array(java.lang.Object operands)
LSOperator.Arraypublic LSExpression array(int... operands)
createExpression(LSOperator.Array, operands).LSOperator.Array,
createExpression(LSOperator, int[])public LSExpression array(long... operands)
createExpression(LSOperator.Array, operands).LSOperator.Array,
createExpression(LSOperator, long[])public LSExpression array(float... operands)
createExpression(LSOperator.Array, operands).LSOperator.Array,
createExpression(LSOperator, float[])public LSExpression array(double... operands)
createExpression(LSOperator.Array, operands).LSOperator.Array,
createExpression(LSOperator, double[])public LSExpression array(LSExpression... operands)
createExpression(LSOperator.Array, operands).LSOperator.Array,
createExpression(LSOperator, LSExpression... operands)public LSExpression at(LSExpression arrayExpr, LSExpression... indicesExpr)
createExpression(LSOperator.At, arrayExpr, indicesExpr).LSOperator.At,
createExpression(LSOperator, LSExpression...)public LSExpression at(LSExpression arrayExpr, long index)
createExpression(LSOperator.At, arrayExpr, index).LSOperator.At,
createExpression(LSOperator, LSExpression, long)public LSExpression scalar(LSExpression a, LSExpression b)
createExpression(LSOperator.Scalar, a, b).LSOperator.Scalar,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression ceil(LSExpression a)
createExpression(LSOperator.Ceil, a).LSOperator.Ceil,
createExpression(LSOperator, LSExpression)public LSExpression floor(LSExpression a)
createExpression(LSOperator.Floor, a).LSOperator.Floor,
createExpression(LSOperator, LSExpression)public LSExpression round(LSExpression a)
createExpression(LSOperator.Round, a).LSOperator.Round,
createExpression(LSOperator, LSExpression)public LSExpression sqrt(LSExpression a)
createExpression(LSOperator.Sqrt, a).LSOperator.Sqrt,
createExpression(LSOperator, LSExpression)public LSExpression log(LSExpression a)
createExpression(LSOperator.Log, a).LSOperator.Log,
createExpression(LSOperator, LSExpression)public LSExpression exp(LSExpression a)
createExpression(LSOperator.Exp, a).LSOperator.Exp,
createExpression(LSOperator, LSExpression)public LSExpression pow(LSExpression a, LSExpression b)
createExpression(LSOperator.Pow, a, b).LSOperator.Pow,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression pow(LSExpression a, long b)
createExpression(LSOperator.Pow, a, b).LSOperator.Pow,
createExpression(LSOperator, LSExpression, long)public LSExpression pow(long a, LSExpression b)
createExpression(LSOperator.Pow, a, b).LSOperator.Pow,
createExpression(LSOperator, long, LSExpression)public LSExpression pow(LSExpression a, double b)
createExpression(LSOperator.Pow, a, b).LSOperator.Pow,
createExpression(LSOperator, LSExpression, double)public LSExpression pow(double a, LSExpression b)
createExpression(LSOperator.Pow, a, b).LSOperator.Pow,
createExpression(LSOperator, double, LSExpression)public LSExpression cos(LSExpression a)
createExpression(LSOperator.Cos, a).LSOperator.Cos,
createExpression(LSOperator, LSExpression)public LSExpression sin(LSExpression a)
createExpression(LSOperator.Sin, a).LSOperator.Sin,
createExpression(LSOperator, LSExpression)public LSExpression tan(LSExpression a)
createExpression(LSOperator.Tan, a).LSOperator.Tan,
createExpression(LSOperator, LSExpression)public LSExpression piecewise(LSExpression abscissae, LSExpression ordinates, LSExpression x)
createExpression(LSOperator.Piecewise, abscissae, ordinates, x).LSOperator.Piecewise,
createExpression(LSOperator, LSExpression, LSExpression, LSExpression)public LSExpression listVar(long n)
createExpression(LSOperator.List, n).LSOperator.List,
createExpression(LSOperator, long)public LSExpression setVar(long n)
createExpression(LSOperator.Set, n).LSOperator.Set,
createExpression(LSOperator, long)public LSExpression count(LSExpression a)
createExpression(LSOperator.Count, a).LSOperator.Count,
createExpression(LSOperator, LSExpression)public LSExpression indexOf(LSExpression a, long b)
createExpression(LSOperator.IndexOf, a, b).LSOperator.IndexOf,
createExpression(LSOperator, LSExpression, long)public LSExpression indexOf(LSExpression a, LSExpression b)
createExpression(LSOperator.IndexOf, a, b).LSOperator.IndexOf,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression contains(LSExpression a, long b)
createExpression(LSOperator.Contains, a, b).LSOperator.Contains,
createExpression(LSOperator, LSExpression, long)public LSExpression contains(LSExpression a, LSExpression b)
createExpression(LSOperator.Contains, a, b).LSOperator.Contains,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression partition()
createExpression(LSOperator.Partition).LSOperator.Partition,
createExpression(LSOperator)public LSExpression partition(LSExpression... operands)
createExpression(LSOperator.Partition, operands).LSOperator.Partition,
createExpression(LSOperator, LSExpression...)public LSExpression partition(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Partition, operands).LSOperator.Partition,
createExpression(LSOperator, Iterable)public LSExpression disjoint()
createExpression(LSOperator.Disjoint).LSOperator.Disjoint,
createExpression(LSOperator)public LSExpression disjoint(LSExpression... operands)
createExpression(LSOperator.Disjoint, operands).LSOperator.Disjoint,
createExpression(LSOperator, LSExpression... operands)public LSExpression disjoint(java.lang.Iterable<LSExpression> operands)
createExpression(LSOperator.Disjoint, operands).LSOperator.Disjoint,
createExpression(LSOperator, Iterable)public LSExpression nativeFunction(LSNativeFunction func)
createNativeFunction(func).LSOperator.NativeFunction,
createNativeFunction(localsolver.LSNativeFunction)public LSExpression function(int nbArgs, LSFunction functor)
createFunction(nbArgs, functor).LSOperator.Function,
createFunction(int, LSFunction)public LSExpression function(LSFunction0 functor)
createFunction(functor).LSOperator.Function,
createFunction(LSFunction0)public LSExpression function(LSFunction1 functor)
createFunction(functor).LSOperator.Function,
createFunction(LSFunction1)public LSExpression function(LSFunction2 functor)
createFunction(functor).LSOperator.Function,
createFunction(LSFunction2)public LSExpression function(LSFunction3 functor)
createFunction(functor).LSOperator.Function,
createFunction(LSFunction3)public LSExpression call()
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator)public LSExpression call(LSExpression a)
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator, LSExpression)public LSExpression call(LSExpression a, LSExpression b)
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression call(LSExpression a, LSExpression b, LSExpression c)
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator, LSExpression, LSExpression, LSExpression)public LSExpression call(LSExpression... operands)
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator, LSExpression...)public LSExpression call(java.lang.Iterable<LSExpression> operands)
LSOperator.Function or LSOperator.NativeFunction.
The other operands may be LSExpressions, booleans, integers, and doubles.
They are passed to the function as arguments.
This method is a shortcut for createExpression(LSOperator.Call).LSOperator.Call,
createExpression(LSOperator, Iterable)public LSExpression range(LSExpression a, LSExpression b)
createExpression(LSOperator.Range, a, b).LSOperator.Range,
createExpression(LSOperator, LSExpression, LSExpression)public LSExpression range(LSExpression a, long b)
createExpression(LSOperator.Range, a, b).LSOperator.Range,
createExpression(LSOperator, LSExpression, long)public LSExpression range(long a, LSExpression b)
createExpression(LSOperator.Range, a, b).LSOperator.Range,
createExpression(LSOperator, long, LSExpression)public LSExpression range(long a, long b)
createExpression(LSOperator.Range, a, b).LSOperator.Range,
createExpression(LSOperator, long, long)public int getNbExpressions()
public LSExpression getExpression(int exprIndex)
exprIndex - Index of the expression.public LSExpression getExpression(java.lang.String name)
name - Name of the expression.public int getNbDecisions()
public LSExpression getDecision(int decisionIndex)
decisionIndex - Index of the decision.public void addConstraint(LSExpression expr)
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.public void constraint(LSExpression expr)
expr - Expression.addConstraint(localsolver.LSExpression)public void removeConstraint(LSExpression expr)
LSState.Modeling.expr - Expression.public void removeConstraint(int constraintIndex)
LSState.Modeling.constraintIndex - position of the constraint to remove.public int getNbConstraints()
public LSExpression getConstraint(int constraintIndex)
constraintIndex - Index of the constraint.public void addObjective(LSExpression expr, LSObjectiveDirection direction)
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.public void minimize(LSExpression expr)
expr - Expression.addObjective(localsolver.LSExpression, localsolver.LSObjectiveDirection)public void maximize(LSExpression expr)
expr - Expression.addObjective(localsolver.LSExpression, localsolver.LSObjectiveDirection)public void removeObjective(int objectiveIndex)
LSPhase.setOptimizedObjective(int)), or to
disable it (with LSPhase.setEnabled(boolean)). Only allowed in state
LSState.Modeling.objectiveIndex - position of the objective to remove.public int getNbObjectives()
public LSExpression getObjective(int objectiveIndex)
objectiveIndex - Index of the objective.public LSObjectiveDirection getObjectiveDirection(int objectiveIndex)
objectiveIndex - Index of the objective.public int getNbOperands()
public void close()
LSState.Modeling. When this
method is called, the solver is placed in state LSState.Stopped.
The solution is reset and any initial solution is lost. Once the model is closed,
no expression, constraints or objectives can be added or removed unless the model
is reopened. The model must be closed before starting its resolution.public void open()
LSState.Stopped. When this
method is called, the solver is placed in state LSState.Modeling.
In this state, the model can be modified: it is possible to add new expressions,
constraints or objectives, modify expression operands, and remove existing
constraints and objectives. However, existing expressions cannot be deleted.
Note that the solution will be reset when the model is closed again.public boolean isClosed()
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object obj)
equals in class java.lang.Object