jopt.csp.variable
Interface CspMath


public interface CspMath

Interface for objects used to create advanced mathematical expressions


Method Summary
 CspDoubleExpr abs(CspDoubleExpr expr)
          Creates double expression representing |expr|
 CspFloatExpr abs(CspFloatExpr expr)
          Creates float expression representing |expr|
 CspIntExpr abs(CspIntExpr expr)
          Creates integer expression representing |expr|
 CspLongExpr abs(CspLongExpr expr)
          Creates long expression representing |expr|
 CspDoubleExpr acos(CspDoubleExpr x)
          Creates double expression representing arc cos(x) in radians
 CspDoubleExpr add(int a, CspDoubleExpr bexpr)
          Creates integer expression representing a+b
 CspFloatExpr add(int a, CspFloatExpr bexpr)
          Creates integer expression representing a+b
 CspIntExpr add(int a, CspIntExpr bexpr)
          Creates integer expression representing a+b
 CspLongExpr add(int a, CspLongExpr bexpr)
          Creates integer expression representing a+b
 CspConstraint allDifferent(CspGenericIntExpr expr)
          Constrains all elements of a generic variable to be different values
 CspConstraint allDifferent(CspGenericLongExpr expr)
          Constrains all elements of a generic variable to be different values
 CspConstraint allDifferent(CspIntExpr[] exprs)
          Constrains an array of variables to have different values
 CspConstraint allDifferent(CspLongExpr[] exprs)
          Constrains an array of variables to have different values
 CspDoubleExpr asin(CspDoubleExpr x)
          Creates double expression representing arc sin(x) in radians
 CspDoubleExpr atan(CspDoubleExpr x)
          Creates double expression representing arc sin(x) in radians
 CspDoubleExpr cos(CspDoubleExpr x)
          Creates double expression representing cos(x) in radians
 CspDoubleExpr divide(int a, CspDoubleExpr bexpr)
          Creates double expression representing a/b
 CspFloatExpr divide(int a, CspFloatExpr bexpr)
          Creates float expression representing a/b
 CspIntExpr divide(int a, CspIntExpr bexpr)
          Creates integer expression representing a/b
 CspLongExpr divide(int a, CspLongExpr bexpr)
          Creates long integer expression representing a/b
 CspDoubleExpr exp(CspDoubleExpr x)
          Creates double expression representing e^x where e is the natural logarithm base
 CspConstraint globalCardCount(CspGenericIntExpr expr, java.lang.Number[] vals, CspIntExpr[] count)
          A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression
 CspConstraint globalCardCount(CspGenericLongExpr expr, java.lang.Number[] vals, CspIntExpr[] count)
          A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression
 CspConstraint globalCardCount(CspIntExpr[] exprs, java.lang.Number[] vals, CspIntExpr[] count)
          A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression
 CspConstraint globalCardCount(CspLongExpr[] exprs, java.lang.Number[] vals, CspIntExpr[] count)
          A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression
 CspConstraint globalCardinality(CspGenericIntExpr expr, java.lang.Number[] vals, int[] lb, int[] ub)
          Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub
 CspConstraint globalCardinality(CspGenericLongExpr expr, java.lang.Number[] vals, int[] lb, int[] ub)
          Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub
 CspConstraint globalCardinality(CspIntExpr[] exprs, java.lang.Number[] vals, int[] lb, int[] ub)
          Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub
 CspConstraint globalCardinality(CspLongExpr[] exprs, java.lang.Number[] vals, int[] lb, int[] ub)
          Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub
 CspDoubleExpr log(CspDoubleExpr x)
          Creates double expression representing natural log(x)
 CspConstraint memberOfArray(CspIntExpr[] sources, CspIntExpr expr)
          Constrains a numeric expression to be a member of an array.
 CspConstraint memberOfArray(CspLongExpr[] sources, CspLongExpr expr)
          Constrains a numeric expression to be a member of an array.
 CspDoubleExpr multiply(int a, CspDoubleExpr bexpr)
          Creates double expression representing a*b
 CspFloatExpr multiply(int a, CspFloatExpr bexpr)
          Creates float expression representing a*b
 CspIntExpr multiply(int a, CspIntExpr bexpr)
          Creates integer expression representing a*b
 CspLongExpr multiply(int a, CspLongExpr bexpr)
          Creates long integer expression representing a*b
 CspConstraint notMemberOfArray(CspIntExpr[] sources, CspIntExpr expr)
          Constrains a numeric expression to not be a member of an array.
 CspConstraint notMemberOfArray(CspLongExpr[] sources, CspLongExpr expr)
          Constrains a numeric expression to not be a member of an array.
 CspDoubleExpr power(CspDoubleExpr x, CspDoubleExpr p)
          Creates double expression representing x^p
 CspDoubleExpr power(CspDoubleExpr x, double p)
          Creates double expression representing x^p
 CspDoubleExpr power(double x, CspDoubleExpr p)
          Creates double expression representing x^p
 CspDoubleExpr sin(CspDoubleExpr x)
          Creates double expression representing sin(x) in radians
 CspDoubleExpr square(CspDoubleExpr expr)
          Creates double expression representing expr^2
 CspFloatExpr square(CspFloatExpr expr)
          Creates float expression representing expr^2
 CspIntExpr square(CspIntExpr expr)
          Creates integer expression representing expr^2
 CspLongExpr square(CspLongExpr expr)
          Creates long integer expression representing expr^2
 CspDoubleExpr subtract(int a, CspDoubleExpr bexpr)
          Creates integer expression representing a-b
 CspFloatExpr subtract(int a, CspFloatExpr bexpr)
          Creates integer expression representing a-b
 CspIntExpr subtract(int a, CspIntExpr bexpr)
          Creates integer expression representing a-b
 CspLongExpr subtract(int a, CspLongExpr bexpr)
          Creates integer expression representing a-b
 CspDoubleExpr summation(CspGenericDoubleExpr x, CspGenericIndex[] indexRange, CspGenericIndexRestriction sourceIdxRestriction)
          Creates a variable equal to the summation of values in the generic variable.
 CspFloatExpr summation(CspGenericFloatExpr x, CspGenericIndex[] indexRange, CspGenericIndexRestriction sourceIdxRestriction)
          Creates a variable equal to the summation of values in the generic variable.
 CspIntExpr summation(CspGenericIntExpr x, CspGenericIndex[] indexRange, CspGenericIndexRestriction sourceIdxRestriction)
          Creates a variable equal to the summation of values in the generic variable.
 CspLongExpr summation(CspGenericLongExpr x, CspGenericIndex[] indexRange, CspGenericIndexRestriction sourceIdxRestriction)
          Creates a variable equal to the summation of values in the generic variable.
 CspDoubleExpr tan(CspDoubleExpr x)
          Creates double expression representing tan(x) in radians
 

Method Detail

add

public CspIntExpr add(int a,
                      CspIntExpr bexpr)
Creates integer expression representing a+b

Parameters:
a - constant to be added
bexpr - expression to be added to
Returns:
expression representing a + bexpr

add

public CspLongExpr add(int a,
                       CspLongExpr bexpr)
Creates integer expression representing a+b

Parameters:
a - constant to be added
bexpr - expression to be added to
Returns:
expression representing a + bexpr

add

public CspFloatExpr add(int a,
                        CspFloatExpr bexpr)
Creates integer expression representing a+b

Parameters:
a - constant to be added
bexpr - expression to be added to
Returns:
expression representing a + bexpr

add

public CspDoubleExpr add(int a,
                         CspDoubleExpr bexpr)
Creates integer expression representing a+b

Parameters:
a - constant to be added
bexpr - expression to be added to
Returns:
expression representing a + bexpr

subtract

public CspIntExpr subtract(int a,
                           CspIntExpr bexpr)
Creates integer expression representing a-b

Parameters:
a - constant to start with
bexpr - expression to be subtracted from constant
Returns:
expression representing a - bexpr

subtract

public CspLongExpr subtract(int a,
                            CspLongExpr bexpr)
Creates integer expression representing a-b

Parameters:
a - constant to start with
bexpr - expression to be subtracted from constant
Returns:
expression representing a - bexpr

subtract

public CspFloatExpr subtract(int a,
                             CspFloatExpr bexpr)
Creates integer expression representing a-b

Parameters:
a - constant to start with
bexpr - expression to be subtracted from constant
Returns:
expression representing a - bexpr

subtract

public CspDoubleExpr subtract(int a,
                              CspDoubleExpr bexpr)
Creates integer expression representing a-b

Parameters:
a - constant to start with
bexpr - expression to be subtracted from constant
Returns:
expression representing a - bexpr

multiply

public CspIntExpr multiply(int a,
                           CspIntExpr bexpr)
Creates integer expression representing a*b

Parameters:
a - constant valued factor of this multiplication
bexpr - expression factor of this multiplication
Returns:
expression representing a * bexpr

multiply

public CspLongExpr multiply(int a,
                            CspLongExpr bexpr)
Creates long integer expression representing a*b

Parameters:
a - constant valued factor of this multiplication
bexpr - expression factor of this multiplication
Returns:
expression representing a * bexpr

multiply

public CspFloatExpr multiply(int a,
                             CspFloatExpr bexpr)
Creates float expression representing a*b

Parameters:
a - constant valued factor of this multiplication
bexpr - expression factor of this multiplication
Returns:
expression representing a * bexpr

multiply

public CspDoubleExpr multiply(int a,
                              CspDoubleExpr bexpr)
Creates double expression representing a*b

Parameters:
a - constant valued factor of this multiplication
bexpr - expression factor of this multiplication
Returns:
expression representing a * bexpr

divide

public CspIntExpr divide(int a,
                         CspIntExpr bexpr)
Creates integer expression representing a/b

Parameters:
a - constant dividend of this divide operation
bexpr - expression divisor of this divide operation
Returns:
expression representing a / bexpr

divide

public CspLongExpr divide(int a,
                          CspLongExpr bexpr)
Creates long integer expression representing a/b

Parameters:
a - constant dividend of this divide operation
bexpr - expression divisor of this divide operation
Returns:
expression representing a / bexpr

divide

public CspFloatExpr divide(int a,
                           CspFloatExpr bexpr)
Creates float expression representing a/b

Parameters:
a - constant dividend of this divide operation
bexpr - expression divisor of this divide operation
Returns:
expression representing a / bexpr

divide

public CspDoubleExpr divide(int a,
                            CspDoubleExpr bexpr)
Creates double expression representing a/b

Parameters:
a - constant dividend of this divide operation
bexpr - expression divisor of this divide operation
Returns:
expression representing a / bexpr

abs

public CspIntExpr abs(CspIntExpr expr)
Creates integer expression representing |expr|

Parameters:
expr - expression of which to obtain the absolute value
Returns:
expression representing the absolute value of expr

abs

public CspLongExpr abs(CspLongExpr expr)
Creates long expression representing |expr|

Parameters:
expr - expression of which to obtain the absolute value
Returns:
expression representing the absolute value of expr

abs

public CspFloatExpr abs(CspFloatExpr expr)
Creates float expression representing |expr|

Parameters:
expr - expression of which to obtain the absolute value
Returns:
expression representing the absolute value of expr

abs

public CspDoubleExpr abs(CspDoubleExpr expr)
Creates double expression representing |expr|

Parameters:
expr - expression of which to obtain the absolute value
Returns:
expression representing the absolute value of expr

square

public CspIntExpr square(CspIntExpr expr)
Creates integer expression representing expr^2

Parameters:
expr - expression of which to obtain the square value
Returns:
expression representing the square of expr

square

public CspLongExpr square(CspLongExpr expr)
Creates long integer expression representing expr^2

Parameters:
expr - expression of which to obtain the square value
Returns:
expression representing the square of expr

square

public CspFloatExpr square(CspFloatExpr expr)
Creates float expression representing expr^2

Parameters:
expr - expression of which to obtain the square value
Returns:
expression representing the square of expr

square

public CspDoubleExpr square(CspDoubleExpr expr)
Creates double expression representing expr^2

Parameters:
expr - expression of which to obtain the square value
Returns:
expression representing the square of expr

power

public CspDoubleExpr power(CspDoubleExpr x,
                           double p)
Creates double expression representing x^p

Parameters:
x - base value of this exponent
p - value of the power of which to raise x
Returns:
expression representing x^p

power

public CspDoubleExpr power(CspDoubleExpr x,
                           CspDoubleExpr p)
Creates double expression representing x^p

Parameters:
x - base value of this exponent
p - value of the power of which to raise x
Returns:
expression representing x^p

power

public CspDoubleExpr power(double x,
                           CspDoubleExpr p)
Creates double expression representing x^p

Parameters:
x - base value of this exponent
p - value of the power of which to raise x
Returns:
expression representing x^p

exp

public CspDoubleExpr exp(CspDoubleExpr x)
Creates double expression representing e^x where e is the natural logarithm base

Parameters:
x - value of the power of which to raise e
Returns:
expression representing e^x

log

public CspDoubleExpr log(CspDoubleExpr x)
Creates double expression representing natural log(x)

Parameters:
x - value of which to take the natural log
Returns:
expression representing ln(x)

cos

public CspDoubleExpr cos(CspDoubleExpr x)
Creates double expression representing cos(x) in radians

Parameters:
x - value of which to take cosine of
Returns:
expression representing cos(x)

acos

public CspDoubleExpr acos(CspDoubleExpr x)
Creates double expression representing arc cos(x) in radians

Parameters:
x - value of which to take arccosine of
Returns:
expression representing arccos(x)

sin

public CspDoubleExpr sin(CspDoubleExpr x)
Creates double expression representing sin(x) in radians

Parameters:
x - value of which to take sine of
Returns:
expression representing sin(x)

asin

public CspDoubleExpr asin(CspDoubleExpr x)
Creates double expression representing arc sin(x) in radians

Parameters:
x - value of which to take arcsine of
Returns:
expression representing arcsin(x)

tan

public CspDoubleExpr tan(CspDoubleExpr x)
Creates double expression representing tan(x) in radians

Parameters:
x - value of which to take tangent of
Returns:
expression representing tan(x)

atan

public CspDoubleExpr atan(CspDoubleExpr x)
Creates double expression representing arc sin(x) in radians

Parameters:
x - value of which to take arctangent of
Returns:
expression representing arctan(x)

allDifferent

public CspConstraint allDifferent(CspIntExpr[] exprs)
Constrains an array of variables to have different values

Parameters:
exprs - array of expression objects that you would like to guarantee distinct
Returns:
constraint forcing each expression to be unique

allDifferent

public CspConstraint allDifferent(CspLongExpr[] exprs)
Constrains an array of variables to have different values

Parameters:
exprs - array of expression objects that you would like to guarantee distinct
Returns:
constraint forcing each expression to be unique

allDifferent

public CspConstraint allDifferent(CspGenericIntExpr expr)
Constrains all elements of a generic variable to be different values

Parameters:
expr - generic expression whose elements need to be different
Returns:
constraint forcing each element of the specified generic to be unique

allDifferent

public CspConstraint allDifferent(CspGenericLongExpr expr)
Constrains all elements of a generic variable to be different values

Parameters:
expr - generic expression whose elements need to be different
Returns:
constraint forcing each element of the specified generic to be unique

globalCardinality

public CspConstraint globalCardinality(CspIntExpr[] exprs,
                                       java.lang.Number[] vals,
                                       int[] lb,
                                       int[] ub)
Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

Parameters:
exprs - - collection of expressions whose elements need to occur at least lb and at most ub times
vals - - the list of values that have been bounded to occur a certain number of times
lb - - lower bound representing the minimum number of times that the val at the corresponding index occurs
ub - - upper bound representing the maximum number of times that the val at the corresponding index occurs
Returns:
- a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

globalCardinality

public CspConstraint globalCardinality(CspLongExpr[] exprs,
                                       java.lang.Number[] vals,
                                       int[] lb,
                                       int[] ub)
Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

Parameters:
exprs - - generic expression whose elements need to occur at least lb and at most ub times
vals - - the list of values that have been bounded to occur a certain number of times
lb - - lower bound representing the minimum number of times that the val at the corresponding index occurs
ub - - upper bound representing the maximum number of times that the val at the corresponding index occurs
Returns:
- a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

globalCardinality

public CspConstraint globalCardinality(CspGenericIntExpr expr,
                                       java.lang.Number[] vals,
                                       int[] lb,
                                       int[] ub)
Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

Parameters:
expr - - generic expression whose elements need to occur at least lb and at most ub times
vals - - the list of values that have been bounded to occur a certain number of times
lb - - lower bound representing the minimum number of times that the val at the corresponding index occurs
ub - - upper bound representing the maximum number of times that the val at the corresponding index occurs
Returns:
- a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

globalCardinality

public CspConstraint globalCardinality(CspGenericLongExpr expr,
                                       java.lang.Number[] vals,
                                       int[] lb,
                                       int[] ub)
Generates a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

Parameters:
expr - - collection of expressions whose elements need to occur at least lb and at most ub times
vals - - the list of values that have been bounded to occur a certain number of times
lb - - lower bound representing the minimum number of times that the val at the corresponding index occurs
ub - - upper bound representing the maximum number of times that the val at the corresponding index occurs
Returns:
- a constraint that will cause the number of times vals occurs in exprs to be at least lb and at most ub

globalCardCount

public CspConstraint globalCardCount(CspIntExpr[] exprs,
                                     java.lang.Number[] vals,
                                     CspIntExpr[] count)
A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

Parameters:
exprs - - the expressions whose values we will count
vals - - the values we are concerned about counting
count - - the int expression representing the number of occurrends of the corresponding value in exprs
Returns:
-A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

globalCardCount

public CspConstraint globalCardCount(CspLongExpr[] exprs,
                                     java.lang.Number[] vals,
                                     CspIntExpr[] count)
A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

Parameters:
exprs - - the expressions whose values we will count
vals - - the values we are concerned about counting
count - - the int expression representing the number of occurrends of the corresponding value in exprs
Returns:
-A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

globalCardCount

public CspConstraint globalCardCount(CspGenericIntExpr expr,
                                     java.lang.Number[] vals,
                                     CspIntExpr[] count)
A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

Parameters:
expr - - generic expression whose values we will count
vals - - the values we are concerned about counting
count - - the int expression representing the number of occurrends of the corresponding value in expr
Returns:
-A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

globalCardCount

public CspConstraint globalCardCount(CspGenericLongExpr expr,
                                     java.lang.Number[] vals,
                                     CspIntExpr[] count)
A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

Parameters:
expr - - generic expression whose values we will count
vals - - the values we are concerned about counting
count - - the int expression representing the number of occurrends of the corresponding value in expr
Returns:
-A constraint that will count the number of occurrence of certain values and store that number in the corresponding count int expression

memberOfArray

public CspConstraint memberOfArray(CspIntExpr[] sources,
                                   CspIntExpr expr)
Constrains a numeric expression to be a member of an array. This function does not support generic expressions.

Parameters:
sources - collection of expressions that expr must be a member of
expr - expression that must be a member of sources
Returns:
constraint constraining expr to be a member of sources

notMemberOfArray

public CspConstraint notMemberOfArray(CspLongExpr[] sources,
                                      CspLongExpr expr)
Constrains a numeric expression to not be a member of an array. This function does not support generic expressions.

Parameters:
sources - collection of expressions that expr must not be a member of
expr - expression that must not be a member of sources
Returns:
constraint constraining expr to not be a member of sources

notMemberOfArray

public CspConstraint notMemberOfArray(CspIntExpr[] sources,
                                      CspIntExpr expr)
Constrains a numeric expression to not be a member of an array. This function does not support generic expressions.

Parameters:
sources - collection of expressions that expr must not be a member of
expr - expression that must not be a member of sources
Returns:
constraint constraining expr to not be a member of sources

memberOfArray

public CspConstraint memberOfArray(CspLongExpr[] sources,
                                   CspLongExpr expr)
Constrains a numeric expression to be a member of an array. This function does not support generic expressions.

Parameters:
sources - collection of expressions that expr must not be a member of
expr - expression that must not be a member of sources
Returns:
constraint constraining expr to not be a member of sources

summation

public CspIntExpr summation(CspGenericIntExpr x,
                            CspGenericIndex[] indexRange,
                            CspGenericIndexRestriction sourceIdxRestriction)
Creates a variable equal to the summation of values in the generic variable. All indices in given range must exist in the variable X. If additional indices exist in X not used within the range, the returned expression will be a generic expression that is indexed on the leftover indices.

Parameters:
x - Generic variable summation is over
indexRange - Indices within generic variable X that summation is over
sourceIdxRestriction - Optional restriction of values placed on source index ranges
Returns:
Expression that is equal to summation of X

summation

public CspLongExpr summation(CspGenericLongExpr x,
                             CspGenericIndex[] indexRange,
                             CspGenericIndexRestriction sourceIdxRestriction)
Creates a variable equal to the summation of values in the generic variable. All indices in given range must exist in the variable X. If additional indices exist in X not used within the range, the returned expression will be a generic expression that is indexed on the leftover indices.

Parameters:
x - Generic variable summation is over
indexRange - Indices within generic variable X that summation is over
sourceIdxRestriction - Optional restriction of values placed on source index ranges
Returns:
Expression that is equal to summation of X

summation

public CspFloatExpr summation(CspGenericFloatExpr x,
                              CspGenericIndex[] indexRange,
                              CspGenericIndexRestriction sourceIdxRestriction)
Creates a variable equal to the summation of values in the generic variable. All indices in given range must exist in the variable X. If additional indices exist in X not used within the range, the returned expression will be a generic expression that is indexed on the leftover indices.

Parameters:
x - Generic variable summation is over
indexRange - Indices within generic variable X that summation is over
sourceIdxRestriction - Optional restriction of values placed on source index ranges
Returns:
Expression that is equal to summation of X

summation

public CspDoubleExpr summation(CspGenericDoubleExpr x,
                               CspGenericIndex[] indexRange,
                               CspGenericIndexRestriction sourceIdxRestriction)
Creates a variable equal to the summation of values in the generic variable. All indices in given range must exist in the variable X. If additional indices exist in X not used within the range, the returned expression will be a generic expression that is indexed on the leftover indices.

Parameters:
x - Generic variable summation is over
indexRange - Indices within generic variable X that summation is over
sourceIdxRestriction - Optional restriction of values placed on source index ranges
Returns:
Expression that is equal to summation of X