choco
Interface Constraint

All Superinterfaces:
java.lang.Cloneable, Entity
All Known Subinterfaces:
BoolConstraint, CompositeConstraint, DecisionConstraint, IntConstraint, MixedConstraint, PalmConstraint, PalmMixedConstraint, Propagator, RealConstraint, SetConstraint, SymbolicDecision
All Known Implementing Classes:
AbstractBinBoolConstraint, AbstractBinBoolConstraintWithCounterOpposite, AbstractBinCompositeConstraint, AbstractBinIntConstraint, AbstractBinRealIntConstraint, AbstractBinSetConstraint, AbstractBinSetIntConstraint, AbstractBipartiteFlow, AbstractBipartiteGraph, AbstractBipartiteMatching, AbstractCompositeConstraint, AbstractConstraint, AbstractDecision, AbstractIntConstraint, AbstractLargeBoolConstraint, AbstractLargeBoolConstraintWithCounterOpposite, AbstractLargeCompositeConstraint, AbstractLargeIntConstraint, AbstractLargeRealConstraint, AbstractMixedConstraint, AbstractPalmBinIntConstraint, AbstractPalmLargeIntConstraint, AbstractPalmSplit, AbstractPalmTernIntConstraint, AbstractPalmUnIntConstraint, AbstractPalmUnRealConstraint, AbstractSetConstraint, AbstractTernIntConstraint, AbstractTernSetConstraint, AbstractUnIntConstraint, AbstractUnRealConstraint, AbstractUnSetConstraint, AC2001BinConstraint, AC3BinConstraint, AC4BinConstraint, AllDifferent, Assignment, BinConjunction, BinDisjunction, BooleanChanneling, BoundAllDiff, Cardinality, ConstantConstraint, CspBinConstraint, CspLargeConstraint, Cumulative, Disjoint, Element, ElementV, EqualXC, EqualXYC, Equation, Equiv, Formula, GAC2001LargeConstraint, GlobalCardinality, GreaterOrEqualXC, GreaterOrEqualXYC, Guard, IntLinComb, InverseChanneling, LargeConjunction, LargeDisjunction, LessOrEqualXC, Lex, MemberX, MemberXY, MixedCstElt, MixedEqXY, NogoodConstraint, NotEqualXC, NotEqualXYC, NotMemberX, NotMemberXY, Occurrence, PalmAllDifferent, PalmAssignment, PalmCardinality, PalmElt, PalmElt2D, PalmEqualXC, PalmEqualXYC, PalmEquation, PalmGreaterOrEqualXC, PalmGreaterOrEqualXYC, PalmIntLinComb, PalmLessOrEqualXC, PalmMixedCstElt, PalmMixedEqXY, PalmNotEqualXC, PalmNotEqualXYC, PalmOccurence, PalmSplitLeft, PalmSplitRight, SetCard, SetIntersection, TimesXYZ

public interface Constraint
extends Entity, java.lang.Cloneable


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 getNbVars()
          Network management: Get the number of variables involved in the constraint.
 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
 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 interface choco.Entity
getProblem, pretty
 

Method Detail

getNbVars

int getNbVars()
Network management: Get the number of variables involved in the constraint.


getVar

Var getVar(int i)
Network management: Accessing the ith variable of a constraint.

Parameters:
i - index of the variable in the constraint

setVar

void setVar(int i,
            Var v)
Network management: Setting (or overwriting) the ith variable of a constraint.

Parameters:
i - index of the variable in the constraint
v - the variable (may be an IntDomainVar, SetVar, RealVar, ...

isSatisfied

boolean isSatisfied()
Semantic: Testing if the constraint is satisfied. Note that all variables involved in the constraint must be instantiated when this method is called.


opposite

AbstractConstraint opposite()
computes the constraint modelling the counter-opposite condition of this

Returns:
a new constraint (modelling the opposite condition)

clone

java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
returns a copy of the constraint. This copy is a new object, may be a recursive copy in case of composite constraints. The original and the copy share the same variables & plugins

Returns:
Throws:
java.lang.CloneNotSupportedException

isEquivalentTo

boolean isEquivalentTo(Constraint compareTo)
tests the equivalence (logical equality of the conditions) between two constraints. In particular whenever c1.equals(c2), then c1.isEquivalent(c2).

Parameters:
compareTo - the constraint to be compared to
Returns:
true if and only if the constraints model the same logical condition.

getVarIdxInOpposite

int getVarIdxInOpposite(int i)
computes the index of the i-th variable in the counter-opposite of the constraint

Parameters:
i - the index of the variable in the current constraint (this)
Returns:
the index of the variable in the opposite constraint (this.opposite())

setConstraintIndex

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.

Parameters:
i - index of the variable in the constraint
idx - index of the constraint in the among all listeners linked to that variable

getConstraintIdx

int getConstraintIdx(int idx)
Network management: Among all listeners linked to the idx-th variable of c, find the index of constraint c.

Parameters:
idx - index of the variable in the constraint