public class JenrlConstraint extends BinaryConstraintWithContext<Lecture,Placement,JenrlConstraint.JenrlConstraintContext> implements WeakeningConstraint<Lecture,Placement>
Modifier and Type | Class and Description |
---|---|
class |
JenrlConstraint.JenrlConstraintContext |
iConstraintListeners, iId
sMaxSize
Constructor and Description |
---|
JenrlConstraint()
Constructor
|
Modifier and Type | Method and Description |
---|---|
boolean |
areStudentConflictsCommitted() |
boolean |
areStudentConflictsDistance(Assignment<Lecture,Placement> assignment) |
boolean |
areStudentConflictsDistance(Assignment<Lecture,Placement> assignment,
Placement value) |
boolean |
areStudentConflictsHard() |
boolean |
areStudentConflictsWorkday(Assignment<Lecture,Placement> assignment,
Placement value) |
void |
computeConflicts(Assignment<Lecture,Placement> assignment,
Placement value,
Set<Placement> conflicts)
The only method which has to be implemented by any constraint.
|
JenrlConstraint.JenrlConstraintContext |
createAssignmentContext(Assignment<Lecture,Placement> assignment)
Create a new assignment context for the given assignment.
|
void |
decJenrl(Assignment<Lecture,Placement> assignment,
Student student)
Decrement the number of joined enrollments (during student final
sectioning)
|
Set<Student> |
getInstructors() |
long |
getJenrl()
Number of joined enrollments (during student final sectioning)
|
double |
getJenrlWeight(Student student) |
String |
getName()
Constraint's name -- for printing purposes
|
int |
getNrInstructors() |
int |
getNrStudents() |
Set<Student> |
getStudents() |
void |
incJenrl(Assignment<Lecture,Placement> assignment,
Student student)
Increment the number of joined enrollments (during student final
sectioning)
|
boolean |
inConflict(Assignment<Lecture,Placement> assignment,
Placement value)
Returns true if the given assignment is inconsistent with the existing
assignments respecting this constraint.
|
boolean |
isHard()
Returns true if the constraint is hard.
|
boolean |
isInConflict(Assignment<Lecture,Placement> assignment)
True if the given two lectures overlap in time
|
static boolean |
isInConflict(Placement p1,
Placement p2,
DistanceMetric m,
int workDayLimit)
Returns true if the given placements are overlapping or they are
back-to-back and too far for students.
|
boolean |
isOfTheSameProblem() |
boolean |
isToBeIgnored()
Returns true if there is
IgnoreStudentConflictsConstraint between the two lectures. |
double |
jenrl() |
long |
jenrl(Assignment<Lecture,Placement> assignment,
Lecture variable,
Placement value)
Number of joined enrollments if the given value is assigned to the given
variable
|
double |
priority() |
void |
setModel(Model<Lecture,Placement> model)
Sets the model which the constraint belongs to
|
String |
toString() |
void |
weaken(Assignment<Lecture,Placement> assignment)
Weaken the constraint.
|
void |
weaken(Assignment<Lecture,Placement> assignment,
Placement value)
Weaken the constraint enough so that it can assign the given
value.
|
assigned, getAssignmentContextReference, getContext, getContext, setAssignmentContextReference, unassigned
addVariable, another, first, isFirst, second
addConstraintListener, assignedVariables, compareTo, computeConflictsNoForwardCheck, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isConsistent, removeConstraintListener, removeVariable, variables
public JenrlConstraint()
public void setModel(Model<Lecture,Placement> model)
Constraint
setModel
in class BinaryConstraintWithContext<Lecture,Placement,JenrlConstraint.JenrlConstraintContext>
model
- problem modelpublic void computeConflicts(Assignment<Lecture,Placement> assignment, Placement value, Set<Placement> conflicts)
Constraint
computeConflicts
in class Constraint<Lecture,Placement>
assignment
- current assignmentvalue
- value to be assigned to its variableconflicts
- resultant set of conflicting valuespublic boolean inConflict(Assignment<Lecture,Placement> assignment, Placement value)
Constraint
MacPropagation
).inConflict
in class Constraint<Lecture,Placement>
assignment
- current assignmentvalue
- given valuepublic static boolean isInConflict(Placement p1, Placement p2, DistanceMetric m, int workDayLimit)
p1
- first placementp2
- second placementm
- distance metricsworkDayLimit
- limit on the work-daypublic long jenrl(Assignment<Lecture,Placement> assignment, Lecture variable, Placement value)
assignment
- current assignmentvariable
- a classvalue
- class placement under considerationpublic boolean isInConflict(Assignment<Lecture,Placement> assignment)
assignment
- current assignmentpublic void incJenrl(Assignment<Lecture,Placement> assignment, Student student)
assignment
- current assignmentstudent
- student added in between the two classes of this constraintpublic double getJenrlWeight(Student student)
public void decJenrl(Assignment<Lecture,Placement> assignment, Student student)
assignment
- current assignmentstudent
- student removed from between the two classes of this constraintpublic long getJenrl()
public double jenrl()
public double priority()
public int getNrStudents()
public Set<Student> getStudents()
public int getNrInstructors()
public Set<Student> getInstructors()
public boolean isHard()
Constraint
isHard
in class Constraint<Lecture,Placement>
public String getName()
Constraint
getName
in class Constraint<Lecture,Placement>
public boolean areStudentConflictsHard()
public boolean areStudentConflictsDistance(Assignment<Lecture,Placement> assignment)
public boolean areStudentConflictsCommitted()
public boolean areStudentConflictsDistance(Assignment<Lecture,Placement> assignment, Placement value)
public boolean areStudentConflictsWorkday(Assignment<Lecture,Placement> assignment, Placement value)
public boolean isOfTheSameProblem()
public void weaken(Assignment<Lecture,Placement> assignment)
WeakeningConstraint
weaken
in interface WeakeningConstraint<Lecture,Placement>
assignment
- current assignmentpublic void weaken(Assignment<Lecture,Placement> assignment, Placement value)
WeakeningConstraint
weaken
in interface WeakeningConstraint<Lecture,Placement>
assignment
- current assignmentvalue
- a conflicting value to be assignedpublic boolean isToBeIgnored()
IgnoreStudentConflictsConstraint
between the two lectures.public JenrlConstraint.JenrlConstraintContext createAssignmentContext(Assignment<Lecture,Placement> assignment)
HasAssignmentContext
createAssignmentContext
in interface HasAssignmentContext<Lecture,Placement,JenrlConstraint.JenrlConstraintContext>
assignment
- an assignment for which there needs to be an assignment context