|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.integer.var.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 |
Constructor Summary | |
---|---|
IntTerm(int capacity)
Constructor |
|
IntTerm(IntTerm t1)
Constructor by copy |
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 |
int |
getSize()
returns the term capacity |
IntVar |
getVariable(int index)
retrieve the i-th variable |
IntVar[] |
getVariables()
retrieve the array of variables |
java.lang.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 |
---|
protected final int[] coefficients
protected final IntVar[] variables
protected 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 copiedMethod Detail |
---|
public java.lang.String pretty()
public int[] getCoefficients()
public IntVar[] getVariables()
public int getCoefficient(int index)
index
- the index of the variable/coefficient in the expression
public IntVar getVariable(int index)
index
- the index of the variable/coefficient in the expression
public void setCoefficient(int index, int coef)
index
- the index of the variable/coefficient in the expressioncoef
- the coefficientpublic void setVariable(int index, IntVar var)
index
- the index of the variable/coefficient in the expressionvar
- the variablepublic int getSize()
public int getConstant()
public void setConstant(int constant)
constant
- the target value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |