|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectchoco.Formula
public class Formula
a class that is used to represent a syntatic formula involving unknowns. It is not a propagator (formulas have no behaviors, no semantic) By defaut, an AbstractModeler creates formulas instead of constraints
Field Summary | |
---|---|
static int |
ALL_DIFFERENT
|
int |
constraintOperator
this slots characterizes the type of formula being stored (the predicate/relation/operator) |
static int |
EQUAL_XC
possible static values for the constraintOperator field |
static int |
EQUAL_XYC
|
static int |
GLOBAL_CARDINALITY
|
static int |
GREATER_OR_EQUAL_XC
|
static int |
GREATER_OR_EQUAL_XYC
|
static int |
INT_LIN_COMB
|
static int |
LESS_OR_EQUAL_XC
|
static int |
NOT_EQUAL_XC
|
static int |
NOT_EQUAL_XYC
|
static int |
NTH
|
static int |
OCCURRENCE
|
java.lang.Object[] |
parameters
storing the parameters of the constraint |
static int |
TIMES_XYZ
|
Var[] |
variables
storing the variables (IntVar, SetVar, ...) involved in the constraint |
Constructor Summary | |
---|---|
Formula(Var[] vars,
int[] coeffs,
int c1,
int c2,
int cop)
|
|
Formula(Var[] vars,
int[] coeffs,
int c1,
int c2,
int c3,
int cop)
|
|
Formula(Var v0,
int c,
int cop)
|
|
Formula(Var v0,
Var v1,
int c,
int cop)
|
|
Formula(Var v0,
Var v1,
Var v2,
int cop)
|
Method Summary | |
---|---|
java.lang.Object |
clone()
returns a copy of the constraint. |
int |
getConstraintIdx(int idx)
Network management: Among all listeners linked to the idx-th variable of c, find the index of constraint c. |
int |
getConstraintOperator()
|
int |
getNbVars()
Network management: Get the number of variables involved in the constraint. |
AbstractProblem |
getProblem()
Retrieves the problem of the entity. |
Var |
getVar(int i)
Network management: Accessing the ith variable of a constraint. |
int |
getVarIdxInOpposite(int i)
computes the index of the i-th variable in the counter-opposite of the constraint |
boolean |
isEquivalentTo(Constraint compareTo)
tests the equivalence (logical equality of the conditions) between two constraints. |
boolean |
isSatisfied()
Semantic: Testing if the constraint is satisfied. |
AbstractConstraint |
opposite()
computes the constraint modelling the counter-opposite condition of this |
java.lang.String |
pretty()
pretty printing of the object. |
void |
setConstraintIndex(int i,
int idx)
Network management: Storing that among all listeners linked to the i-th variable of c, this (the current constraint) is found at index idx. |
void |
setVar(int i,
Var v)
Network management: Setting (or overwriting) the ith variable of a constraint. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static int EQUAL_XC
public static int NOT_EQUAL_XC
public static int GREATER_OR_EQUAL_XC
public static int LESS_OR_EQUAL_XC
public static int EQUAL_XYC
public static int NOT_EQUAL_XYC
public static int GREATER_OR_EQUAL_XYC
public static int TIMES_XYZ
public static int INT_LIN_COMB
public static int OCCURRENCE
public static int ALL_DIFFERENT
public static int GLOBAL_CARDINALITY
public static int NTH
public int constraintOperator
public Var[] variables
public java.lang.Object[] parameters
Constructor Detail |
---|
public Formula(Var v0, int c, int cop)
public Formula(Var v0, Var v1, int c, int cop)
public Formula(Var v0, Var v1, Var v2, int cop)
public Formula(Var[] vars, int[] coeffs, int c1, int c2, int cop)
public Formula(Var[] vars, int[] coeffs, int c1, int c2, int c3, int cop)
Method Detail |
---|
public int getNbVars()
Constraint
getNbVars
in interface Constraint
public Var getVar(int i)
Constraint
getVar
in interface Constraint
i
- index of the variable in the constraintpublic void setVar(int i, Var v)
Constraint
setVar
in interface Constraint
i
- index of the variable in the constraintv
- the variable (may be an IntDomainVar, SetVar, RealVar, ...public boolean isSatisfied()
Constraint
isSatisfied
in interface Constraint
public AbstractConstraint opposite()
Constraint
opposite
in interface Constraint
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Constraint
clone
in interface Constraint
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public int getConstraintOperator()
public boolean isEquivalentTo(Constraint compareTo)
Constraint
isEquivalentTo
in interface Constraint
compareTo
- the constraint to be compared to
public int getVarIdxInOpposite(int i)
Constraint
getVarIdxInOpposite
in interface Constraint
i
- the index of the variable in the current constraint (this)
public void setConstraintIndex(int i, int idx)
Constraint
setConstraintIndex
in interface Constraint
i
- index of the variable in the constraintidx
- index of the constraint in the among all listeners linked to that variablepublic int getConstraintIdx(int idx)
Constraint
getConstraintIdx
in interface Constraint
idx
- index of the variable in the constraintpublic AbstractProblem getProblem()
Entity
getProblem
in interface Entity
public java.lang.String pretty()
Entity
pretty
in interface Entity
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |