|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jpaul.Constraints.Constraint<SVar<T>,java.util.Set<T>> jpaul.Constraints.SetConstraints.IntersectConstraint<T>
public class IntersectConstraint<T>
IntersectConstraint
models a set intersection constraint.
Mathematically, such a constraint has the form:
vIn1 /\ vIn2 <= vDest
where /\
stands for set intersection,
<=
stands for set inclusion, and vIn1
,
vIn2
, vDest
are set-valued variables.
Field Summary |
---|
Fields inherited from class jpaul.Constraints.Constraint |
---|
AVG_COST, HIGH_COST, LOW_COST, VERY_LOW_COST |
Constructor Summary | |
---|---|
IntersectConstraint(SVar<T> vIn1,
SVar<T> vIn2,
SVar<T> vDest)
Creates a IntersectConstraint with the meaning
vIn1 /\ vIn2 <= vDest . |
Method Summary | |
---|---|
void |
action(SolAccessor<SVar<T>,java.util.Set<T>> sa)
Performs the action attached to this constraint. |
int |
cost()
Returns HIGH_COST . |
boolean |
equals(java.lang.Object o)
|
int |
hashCode()
|
java.util.Collection<SVar<T>> |
in()
|
java.util.Collection<SVar<T>> |
out()
|
Constraint<SVar<T>,java.util.Set<T>> |
rewrite(UnionFind<SVar<T>> uf)
We implemented rewrite(jpaul.DataStructs.UnionFind , equals(java.lang.Object) , and hashCode , such that constraints that are identical after
variable unification are not duplicated needlessly. |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public IntersectConstraint(SVar<T> vIn1, SVar<T> vIn2, SVar<T> vDest)
IntersectConstraint
with the meaning
vIn1 /\ vIn2 <= vDest
.
Method Detail |
---|
public java.util.Collection<SVar<T>> in()
in
in class Constraint<SVar<T>,java.util.Set<T>>
public java.util.Collection<SVar<T>> out()
out
in class Constraint<SVar<T>,java.util.Set<T>>
public int cost()
HIGH_COST
.
cost
in class Constraint<SVar<T>,java.util.Set<T>>
public void action(SolAccessor<SVar<T>,java.util.Set<T>> sa)
Constraint
sa.
get
.
sa.
join
to join the computed
values to several out-variables.
Note1: It is a serious mistake to write an
action
method that reads/modifies variables that
are not listed in the collections returned by
in()
/out()
. If you ever suspect
such an error, please set ConstraintSystem.CHECK_IN_OUT
to true
.
Note2: The solver initializes each variable to
null
(null
is considered equivalent
to the bottom element of the correspoding lattice). The body
of action
should be prepared to receive a
null
result from sa.get
.
action
in class Constraint<SVar<T>,java.util.Set<T>>
sa
- Provides access to the values of the variables that
are read/modified.public Constraint<SVar<T>,java.util.Set<T>> rewrite(UnionFind<SVar<T>> uf)
rewrite(jpaul.DataStructs.UnionFind>)
, equals(java.lang.Object)
, and hashCode
, such that constraints that are identical after
variable unification are not duplicated needlessly.
rewrite
in class Constraint<SVar<T>,java.util.Set<T>>
uf
- Union-find structure; for each variable
v
, uf.find(v)
is the representative
of its equivalence class.public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |