|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.cpsolver.ifs.model.Constraint net.sf.cpsolver.exam.model.ExamDistributionConstraint
public class ExamDistributionConstraint
Distribution binary constraint.
The following binary distribution constraints are implemented
Field Summary | |
---|---|
static int |
sDistDifferentPeriod
Different period constraint type |
static int |
sDistDifferentRoom
Different room constraint type |
static int |
sDistPrecedence
Precedence constraint type |
static int |
sDistPrecedenceRev
Precedence constraint type (reverse order) |
static int |
sDistSamePeriod
Same period constraint type |
static int |
sDistSameRoom
Same room constraint type |
static String[] |
sDistType
Distribution type name |
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint |
---|
iAssignedVariables, iConstraintListeners, iId |
Constructor Summary | |
---|---|
ExamDistributionConstraint(long id,
int type,
boolean hard,
int weight)
Constructor |
|
ExamDistributionConstraint(long id,
String type,
boolean hard,
int weight)
Constructor |
|
ExamDistributionConstraint(long id,
String type,
String pref)
Constructor |
Method Summary | |
---|---|
void |
assigned(long iteration,
Value value)
Given value is to be assigned to its varable. |
boolean |
check(ExamPlacement first,
ExamPlacement second)
Check assignments of the given exams |
void |
computeConflicts(Value value,
Set conflicts)
Compute conflicts -- there is a conflict if the other variable is assigned and check(ExamPlacement, ExamPlacement) is false |
boolean |
equals(Object o)
Compare with other constraint for equality |
int |
getType()
Constraint type |
String |
getTypeString()
Constraint type name |
int |
getWeight()
If not hard, penalty for violation |
boolean |
inConflict(Value value)
Check for conflict -- there is a conflict if the other variable is assigned and check(ExamPlacement, ExamPlacement) is false |
boolean |
isConsistent(Value value1,
Value value2)
Consistency check -- check(ExamPlacement, ExamPlacement) is called |
boolean |
isHard()
True if hard (must be satisfied), false for soft (should be satisfied) |
boolean |
isPeriodRelated()
True if the constraint is related to periods |
boolean |
isRoomRelated()
True if the constraint is related to rooms |
boolean |
isSatisfied()
Return true if this is hard constraint or this is a soft constraint without any violation |
boolean |
isSatisfied(ExamPlacement p)
Return true if this is hard constraint or this is a soft constraint without any violation |
String |
toString()
String representation -- constraint type name (exam 1, exam 2) |
void |
unassigned(long iteration,
Value value)
Given value is unassigned from its varable. |
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint |
---|
addConstraintListener, addVariable, assignedVariables, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, getName, hashCode, removeConstraintListener, removeVariable, setModel, variables |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int sDistSameRoom
public static final int sDistDifferentRoom
public static final int sDistSamePeriod
public static final int sDistDifferentPeriod
public static final int sDistPrecedence
public static final int sDistPrecedenceRev
public static final String[] sDistType
Constructor Detail |
---|
public ExamDistributionConstraint(long id, int type, boolean hard, int weight)
id
- constraint unique idtype
- constraint typehard
- true if the constraint is hard (cannot be violated)weight
- if not hard, penalty for violationpublic ExamDistributionConstraint(long id, String type, String pref)
id
- constraint unique idtype
- constraint type (EX_SAME_PREF, EX_SAME_ROOM, or EX_PRECEDENCE)pref
- preference (R/P for required/prohibited, or -2, -1, 0, 1, 2 for preference (from preferred to discouraged))public ExamDistributionConstraint(long id, String type, boolean hard, int weight)
id
- constraint unique idtype
- constraint type nameMethod Detail |
---|
public boolean isHard()
isHard
in class Constraint
public int getWeight()
public int getType()
public String getTypeString()
public String toString()
toString
in class Object
public void computeConflicts(Value value, Set conflicts)
check(ExamPlacement, ExamPlacement)
is false
computeConflicts
in class Constraint
value
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic boolean inConflict(Value value)
check(ExamPlacement, ExamPlacement)
is false
inConflict
in class Constraint
public boolean isConsistent(Value value1, Value value2)
check(ExamPlacement, ExamPlacement)
is called
isConsistent
in class Constraint
public boolean check(ExamPlacement first, ExamPlacement second)
first
- assignment of the first examsecond
- assignment of the second exam
public boolean equals(Object o)
equals
in class Constraint
public boolean isSatisfied()
public boolean isSatisfied(ExamPlacement p)
p
- exam assignment to be madepublic void assigned(long iteration, Value value)
Constraint
assigned
in class Constraint
public void unassigned(long iteration, Value value)
Constraint
unassigned
in class Constraint
public boolean isRoomRelated()
public boolean isPeriodRelated()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |