|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sf.cpsolver.ifs.model.Constraint<Exam,ExamPlacement>
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,
ExamPlacement value)
Given value is to be assigned to its varable. |
boolean |
check(ExamPlacement first,
ExamPlacement second)
Check assignments of the given exams |
void |
computeConflicts(ExamPlacement givenPlacement,
Set<ExamPlacement> 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(ExamPlacement givenPlacement)
Check for conflict -- there is a conflict if the other variable is assigned and check(ExamPlacement, ExamPlacement) is
false |
boolean |
isConsistent(ExamPlacement first,
ExamPlacement second)
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,
ExamPlacement value)
Given value is unassigned from its variable. |
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint |
---|
addConstraintListener, addVariable, assignedVariables, compareTo, 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<Exam,ExamPlacement>
public int getWeight()
public int getType()
public String getTypeString()
public String toString()
toString
in class Object
public void computeConflicts(ExamPlacement givenPlacement, Set<ExamPlacement> conflicts)
check(ExamPlacement, ExamPlacement)
is
false
computeConflicts
in class Constraint<Exam,ExamPlacement>
givenPlacement
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic boolean inConflict(ExamPlacement givenPlacement)
check(ExamPlacement, ExamPlacement)
is
false
inConflict
in class Constraint<Exam,ExamPlacement>
public boolean isConsistent(ExamPlacement first, ExamPlacement second)
check(ExamPlacement, ExamPlacement)
is
called
isConsistent
in class Constraint<Exam,ExamPlacement>
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<Exam,ExamPlacement>
public boolean isSatisfied()
public boolean isSatisfied(ExamPlacement p)
p
- exam assignment to be madepublic void assigned(long iteration, ExamPlacement value)
Constraint
assigned
in class Constraint<Exam,ExamPlacement>
public void unassigned(long iteration, ExamPlacement value)
Constraint
unassigned
in class Constraint<Exam,ExamPlacement>
public boolean isRoomRelated()
public boolean isPeriodRelated()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |