|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.cp.solver.variables.integer.IntTerm
public class IntTerm
Implements linear terms: Sigma_i(a_i*X_i), where a_i are search coefficients, and X_i are search domain variable
Field Summary | |
---|---|
protected int[] |
coefficients
The coefficients |
protected int |
constant
the integer constant involved in the term |
protected int |
nbVars
number of variables involved in the term |
protected IntVar[] |
variables
The variables |
static IntTerm |
ZERO
A constant denoting a null integer term. |
Constructor Summary | |
---|---|
|
IntTerm(int capacity)
Constructor |
|
IntTerm(int[] lc,
IntVar[] lv)
|
|
IntTerm(IntTerm t1)
Constructor by copy |
protected |
IntTerm(IntTerm t1,
int nbMore,
boolean moreFirst)
|
|
IntTerm(IntVar[] lv)
|
Method Summary | |
---|---|
int |
getCoefficient(int index)
retrieve the i-th coefficient |
int[] |
getCoefficients()
retrieve the array of coefficients |
int |
getConstant()
returns the integer constant involved in the linear term |
IntDomainVar |
getIntDVar(int index)
|
int[] |
getOppositeCoefficients()
|
int |
getSize()
returns the term capacity |
IntVar |
getVariable(int index)
retrieve the i-th variable |
IntVar[] |
getVariables()
retrieve the array of variables |
boolean |
isBinary()
|
boolean |
isBinaryMinus()
|
boolean |
isBinaryPlus()
|
boolean |
isConstant()
|
boolean |
isUnary()
|
static IntTerm |
minus(int coeff,
IntVar var,
IntTerm t1)
|
static IntTerm |
minus(IntTerm t1,
IntTerm t2)
|
static IntTerm |
opposite(IntTerm t1)
|
static IntTerm |
plus(IntTerm t1,
int coeff,
IntVar var,
boolean varFirst)
|
static IntTerm |
plus(IntTerm t1,
IntTerm t2)
|
String |
pretty()
Pretty print of the expression |
void |
setCoefficient(int index,
int coef)
sets the i-th coefficient |
void |
setConstant(int constant)
sets the integer constant involved in the linear term |
void |
setVariable(int index,
IntVar var)
sets the i-th variable |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final IntTerm ZERO
protected final int[] coefficients
protected final IntVar[] variables
protected final int nbVars
protected int constant
Constructor Detail |
---|
public IntTerm(int capacity)
capacity
- number of variables that will be involved in the termpublic IntTerm(IntTerm t1)
t1
- the IntTerm to be copiedpublic IntTerm(int[] lc, IntVar[] lv)
public IntTerm(IntVar[] lv)
protected IntTerm(IntTerm t1, int nbMore, boolean moreFirst)
Method Detail |
---|
public static IntTerm opposite(IntTerm t1)
public static IntTerm plus(IntTerm t1, int coeff, IntVar var, boolean varFirst)
public static IntTerm minus(int coeff, IntVar var, IntTerm t1)
public static IntTerm plus(IntTerm t1, IntTerm t2)
public static IntTerm minus(IntTerm t1, IntTerm t2)
public final boolean isConstant()
public final boolean isUnary()
public final boolean isBinary()
public final boolean isBinaryMinus()
public final boolean isBinaryPlus()
public String pretty()
public final int[] getCoefficients()
public final IntVar[] getVariables()
public final int getCoefficient(int index)
index
- the index of the variable/coefficient in the expression
public final IntVar getVariable(int index)
index
- the index of the variable/coefficient in the expression
public final IntDomainVar getIntDVar(int index)
public final void setCoefficient(int index, int coef)
index
- the index of the variable/coefficient in the expressioncoef
- the coefficientpublic final void setVariable(int index, IntVar var)
index
- the index of the variable/coefficient in the expressionvar
- the variablepublic final int getSize()
public final int getConstant()
public final void setConstant(int constant)
constant
- the target valuepublic final int[] getOppositeCoefficients()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |