public enum LSOperator extends java.lang.Enum<LSOperator>
LSModel,
LSExpression| Enum Constant and Description |
|---|
Abs
Absolute value.
|
And
And.
|
Argument
Argument of a function.
|
Array
Array.
|
At
Returns the element at specific coordinates of an array or a list.
|
Bool
Boolean decision.
|
Call
Call a particular function.
|
Ceil
Ceil.
|
Const
Constant.
|
Contains
Contains.
|
Cos
Cosine.
|
Count
The number of elements in an array, a collection or an interval.
|
Cover
Cover.
|
Deprecated
Deprecated.
This operator is deprecated. Using it will raise an error.
|
Disjoint
Disjoint.
|
Dist
Distance between two numbers.
|
Div
Division.
|
End
The end of a non-void interval.
|
Eq
Equal.
|
Exp
Base-e exponential.
|
ExternalFunction
External function.
|
Find
Find.
|
Float
Float decision.
|
Floor
Floor.
|
Geq
Greater than or equal to.
|
Gt
Strictly greater than.
|
If
If-Then-Else.
|
IndexOf
The index of a value in a list (-1 if the value is not in the list).
|
Int
Integer decision variable.
|
Interval
Interval decision variable.
|
LambdaFunction
Lambda function.
|
Length
The length of a non-void interval.
|
Leq
Lower than or equal to.
|
List
A list is an ordered collection of integers within a range
[0, n-1] where n is the unique argument of this
operator. |
Log
Natural logarithm (base-e).
|
Lt
Strictly lower than.
|
Max
Maximum.
|
Min
Minimum.
|
Mod
Modulo (remainder of the integer division).
|
Neq
Not equal to.
|
Not
Not.
|
Or
Or.
|
Partition
Partition.
|
Piecewise
Piecewise-linear function operator.
|
Pow
Power operator.
|
Prod
Product.
|
Range
Range expression.
|
Round
Round.
|
Scalar
Scalar product.
|
Set
A set is an unordered collection of integers within a range
[0, n-1] where n is the unique argument of this
operator. |
Sin
Sine.
|
Sort
Sort operator takes a one-dimensional array of integers or doubles as
input and returns an array sorted by ascending values.
|
Sqrt
Square root.
|
Start
The start of a non-void interval.
|
Sub
Substraction.
|
Sum
Sum.
|
Tan
Tangent.
|
Xor
Exclusive or (also called "xor").
|
| Modifier and Type | Method and Description |
|---|---|
static LSOperator |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static LSOperator[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final LSOperator Bool
{0,1}.public static final LSOperator Float
[lb, ub]).
The bounds must be constants (integers or doubles).public static final LSOperator Const
LSModel.createExpression(localsolver.LSOperator) or LSExpression.addOperand(localsolver.LSExpression).
They can also be created with the dedicated function LSModel.createConstant(long).public static final LSOperator Sum
Sum. N-ary arithmetic operator. SUM(e1, e2, ..., eN) is
equal to the sum of all operands e1, e2, ..., eN. This
operator returns an integer if all the operands are booleans or integers
and a double as soon as one operand is a double.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will sum all the values computed and returned by the
function.
public static final LSOperator Sub
SUB(x, y) is equal to the value of x - y.
This operator returns an integer if the two operands are booleans or
integers, and a double as soon as one operand is a double.public static final LSOperator Prod
Product. N-ary arithmetic operator. PROD(e1, e2, ..., eN)
is equal to the product of all operands e1, e2, ..., eN.
This operator returns an integer if all the operands are booleans or
integers, and a double as soon as one operand is a double.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will compute the product of all the values returned by
the function.
public static final LSOperator Max
Maximum. N-ary arithmetic operator. MAX(e1, e2, ..., eN)
is equal to the maximum value among all operands
e1, e2, ..., eN.
This operator returns an integer if all the operands are booleans or
integers, and a double as soon as one operand is a double.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will find the maximum value among all the values
returned by the function.
public static final LSOperator Min
Minimum. N-ary arithmetic operator. MIN(e1, e2, ..., eN)
is equal to the minimum value among all operands
e1, e2, ..., eN.
This operator returns an integer if all the operands are booleans or
integers, and a double as soon as one operand is a double.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will find the minimum value among all the values
returned by the function.
public static final LSOperator Eq
EQ(a,b) = 1 if a == b, and 0 otherwise.
This operator returns a boolean.public static final LSOperator Neq
NEQ(a,b) = 1 if a != b, and 0 otherwise.
This operator returns a boolean.public static final LSOperator Geq
GEQ(a,b) = 1 if a >= b, and 0 otherwise.
This operator returns a boolean.public static final LSOperator Leq
LEQ(a,b) = 1 if a <= b, and 0 otherwise.
This operator returns a boolean.public static final LSOperator Gt
GT(a,b) = 1 if a > b, and 0 otherwise.
Can be used to compare two intervals, in that case
GT(a, b) = 1 if start(a) >= end(b), and 0 otherwise.
Undefined if a or b is void.
This operator returns a boolean.public static final LSOperator Lt
LT(a, b) = 1 if a < b, and 0 otherwise.
Can be used to compare two intervals, in that case
LT(a, b) = 1 if end(a) <= start(b), and 0 otherwise.
Undefined if a or b is void.
This operator returns a boolean.public static final LSOperator If
IF(a, b, c) is equal to b if a = 1,
and c otherwise. The first operand must be a boolean
(that is, equal to 0 or 1).
This operator returns a boolean if the three operands are booleans,
an integer if the second and third operands are integers, and a double
if the second or the third operand is a double.public static final LSOperator Not
NOT(a) = 1 - a.
The operand must be boolean (that is, equal to 0 or 1).
This operator returns a boolean.public static final LSOperator And
And. N-ary logical operator. AND(e1, e2, ..., eN)
is equal to 1 (true) if all the operands e1, e2, ..., eN are
1, and 0 otherwise.
All the operands must be boolean (that is, equal to 0 or 1).
This operator returns a boolean.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will return 1 if all the values returned by the function
are 1 and 0 otherwise.
public static final LSOperator Or
Or. N-ary logical operator. OR(e1, e2, ..., eN) is equal to 0 (false)
if all operands e1, e2, ..., eN are 0, and 1 otherwise.
All the operands must be boolean (that is, equal to 0 or 1).
This operator returns a boolean.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will return 0 if all the values returned by the function
are 0 and 1 otherwise.
public static final LSOperator Xor
Exclusive or (also called "xor"). N-ary logical operator.
XOR(e1, e2, ..., eN) is equal to 0 if the number of operands with
value 1 among e1, e2, ..., eN is even, and 1 otherwise.
Remarkable case: XOR(a,b) = 1 if a == b, and
0 otherwise. All the operands must be boolean (that is, equal to 0 or 1).
This operator returns a boolean.
This operator can also be used with intervals, List
or Set to create expressions with a dynamic number of operands.
In that case, this operator becomes a binary operator that takes an interval,
a list or a set as first operand and a LambdaFunction as second
operand. The operator will call the function on each value of the interval,
list or set and will return 0 if the number of value 1 returned by the
function is even, and 1 otherwise.
public static final LSOperator Abs
ABS(e) = e >= 0 ? e : -e.
This operator returns an integer if the operand is a boolean or an integer,
and a double otherwise.public static final LSOperator Dist
DIST(a,b) = ABS(a-b).
This operator returns an integer if the two operands are booleans or integers,
and a double as soon as one of the operand is a double.public static final LSOperator Div
public static final LSOperator Mod
MOD(a, b) = r such that a = q * b + r with
q, r integers, r, a
have the same sign and |r| < |b|.
The operands must be integers or booleans. This operator returns an integer.public static final LSOperator Array
Array. An array is a collection of elements. Indexes begin at 0.
It could be used with operators like At or Scalar.
An array doesn't have a value by itself, but can contain operands
of type boolean, integer, double, array (for multi-dimensional arrays) or
collection (list or set). In the latter case, the collections must share
the same domain and same type (either list or set).
All the elements of an array must be of the same type.
With intervals
This operator can also be used with intervals
to create an array with a dynamic number of elements. In that case,
this operator becomes a binary operator that takes an interval as first
operand and a LambdaFunction. The operator will call the
function on each value of the interval and the returned values will be
used to populate the array.
public static final LSOperator At
Returns the element at specific coordinates of an array or a list.
For arraysThe first operand must be the array and the other operands must be the coordinates of the element to get. The number of coordinates depends on the dimension of the array. Thus AT(myArray, i) returns the i element of the one-dimensional array myArray. This operator returns a boolean, an integer or a double according to the type of the operands in the array. If one of the specified coordinate is out of range, the evaluation of the expression will fail.
For listsThe first operand must be the list and the second operand must be the index of the element to get. If the index is out of range (index < 0 or index > count(list)), the evaluation of the expression will not fail but will return -1.
public static final LSOperator Scalar
SCALAR(a, x) = sum(a[i]*x[i]) where
a and x are two one-dimensional arrays. This
operator returns an integer or a double according to the type of the
operands in the arrays.public static final LSOperator Ceil
public static final LSOperator Floor
public static final LSOperator Round
public static final LSOperator Sqrt
public static final LSOperator Log
public static final LSOperator Exp
public static final LSOperator Pow
POW(x, y) is equals to the value of
x to the power of y. The operands can be
booleans, integers or doubles. This operator returns a double.public static final LSOperator Cos
public static final LSOperator Sin
public static final LSOperator Tan
public static final LSOperator Int
[lb, ub]).
The bounds must be integer constants.public static final LSOperator Piecewise
Piecewise-linear function operator. The piecewise linear function is defined by two arrays of numbers giving the breakpoints of the function. This operator has exactly 3 operands: The first two operands must be two arrays of equal sizes (necessarily larger or equal to 2). These arrays must contain constant numbers (integers or doubles). The first array must contain numbers in ascending order. The third operand must be an integer or a double expression. The evaluation of the piecewise will fail if the value of the third operand is strictly smaller that the first element of the first array, or strictly larger than the last element of the first array. This operator returns a double.
PIECEWISE(x,y,z) returns the image of z by the function defined by
geometric points (x[0],y[0]), (x[1],y[1]), ..., (x[n-1],y[n-1]),
For instance PIECEWISE(ARRAY(0, 50, 100), ARRAY(0, 10, 100), 75)
returns 55.
Discontinuities are allowed in the definition of the function, that
is to say that two geometric points can share the same x-coordinate.
By convention the value taken by the function at such a discontinuous
point is the one associated to the last occurrence of this
x-coordinate in array x. For instance
PIECEWISE(ARRAY(0, 50, 50, 100), ARRAY(0, 0.1, 0.9, 1), 50)
returns 0.9.
public static final LSOperator List
A list is an ordered collection of integers within a range
[0, n-1] where n is the unique argument of this
operator. Mathematically a list is a permutation of a subset of
[0, n-1]. This operator takes exactly one operand: a strictly
positive integer constant. All values in the list will be pairwise
different, non negative and strictly smaller that this number.
The elements of the list can be accessed individually with the operator At.
public static final LSOperator Count
public static final LSOperator IndexOf
public static final LSOperator Partition
PARTITION(c1, c2, ..., cN)
is true if all lists or sets c1, c2, ..., cN form a partition
of their common domain.
All the operands must be collections of the same type (either list or set)
and on the same range. These collections can be stored in a LSArray that
will be passed as argument of the partition:
PARTITION(array(c1, c2, ..., cN)).public static final LSOperator Disjoint
DISJOINT(c1, c2, ..., cN)
is true if all lists or sets c1, c2, ..., cN are pairwise
disjoint.
All the operands must be collections of the same type (either list or set)
and on the same range. These collections can be stored in a LSArray that
will be passed as argument of the disjoint:
DISJOINT(array(c1, c2, ..., cN)).public static final LSOperator ExternalFunction
LSModel.createIntExternalFunction(localsolver.LSIntExternalFunction) or
LSModel.createDoubleExternalFunction(localsolver.LSDoubleExternalFunction).LSIntExternalFunction,
LSDoubleExternalFunctionpublic static final LSOperator Call
ExternalFunction or LambdaFunction).
The other operands are passed to the function as arguments.
If the function is not a external function, the number of operands
must match the number of arguments of the function.public static final LSOperator LambdaFunction
LSModel.createLambdaFunction(localsolver.LSLambdaFunction0).public static final LSOperator Argument
LSModel.createLambdaFunction(localsolver.LSLambdaFunction0).public static final LSOperator Range
Range expression. This operator takes exactly two integer operands. The first one is the lower bound (inclusive), the second one is the upper bound (exclusive).
A range has an interval value and can be
used with N-ary operators like Sum, Prod,
Min, Max, Or, And,
Xor or Array to create expressions that have a
dynamic number of operands.
public static final LSOperator Contains
Contains. contains(expr, v) is true if and only if the
expression expr contains the value v.
This operator takes exactly two arguments: the first one is a collection
(List or Set), an interval or an Array of collections, the
second one is the integer expression searched.
If ``expr`` is an array, all its collections must be of the same type
and on the same range.
public static final LSOperator Set
A set is an unordered collection of integers within a range
[0, n-1] where n is the unique argument of this
operator. This operator takes exactly one operand: a strictly positive
integer constant. All values in the set will be pairwise different, non
negative and strictly smaller that this number.
Contrary to the List operator, elements in a set are not ordered
and cannot be indexed with At. Sets can only be manipulated
with lambdas and n-ary operators like Sum, Min, And, etc..
public static final LSOperator Deprecated
public static final LSOperator Cover
COVER(c1, c2, ..., cN) is
true if all values in the domain are at least in one list or set
c1, c2, ..., cN.
All the operands must be collections of the same type (either list or set)
and on the same range. These collections can be stored in a LSArray that will
be passed as argument of the cover: COVER(array(c1, c2, ..., cN)).public static final LSOperator Find
find(a, v) returns the position of the collection in
the array a that contains the value v.
If the value is not in any collections of the array, it returns -1.
This operator takes exactly two arguments: the first one is an
Array of collections, the second one is the value searched.
All the collections of the array must be of the same type and
on the same range.public static final LSOperator Sort
public static final LSOperator Interval
[minStart, maxEnd).
Its start is inclusive and its end is exclusive.public static final LSOperator Start
public static final LSOperator End
public static final LSOperator Length
public static LSOperator[] values()
for (LSOperator c : LSOperator.values()) System.out.println(c);
public static LSOperator valueOf(java.lang.String name)
name - the name of the enum constant to be returned.java.lang.IllegalArgumentException - if this enum type has no constant with the specified namejava.lang.NullPointerException - if the argument is null