public class SpreadConstraint extends Constraint<Lecture,Placement> implements WeakeningConstraint<Lecture,Placement>
DepartmentSpreadConstraint
for more details.Modifier and Type | Field and Description |
---|---|
static boolean |
USE_MOST_IMPROVEMENT_ADEPTS |
iAssignedVariables, iConstraintListeners, iId
Constructor and Description |
---|
SpreadConstraint(DataProperties config,
String name) |
SpreadConstraint(String name,
double spreadFactor,
int unassignmentsToWeaken,
boolean interactiveMode) |
Modifier and Type | Method and Description |
---|---|
void |
addVariable(Lecture lecture)
Add a variable to this constraint
|
void |
assigned(long iteration,
Placement placement)
Given value is to be assigned to its varable.
|
void |
computeConflicts(Placement placement,
Set<Placement> conflicts)
The only method which has to be implemented by any constraint.
|
Placement |
getAdept(Placement placement,
int[][] nrCourses,
Set<Placement> conflicts) |
List<Placement>[][] |
getCourses() |
protected Criterion<Lecture,Placement> |
getCriterion() |
int[][] |
getMaxCourses() |
int |
getMaxPenalty(Placement placement) |
String |
getName()
Constraint's name -- for printing purposes
|
int[][] |
getNrCourses() |
int |
getPenalty()
Department balancing penalty for this department
|
int |
getPenalty(Placement placement)
Department balancing penalty of the given placement
|
int |
getPenaltyEstimate() |
boolean |
inConflict(Placement placement)
Returns true if the given assignment is inconsistent with the existing
assignments respecting this constraint.
|
void |
init()
Initialize constraint (to be called after all variables are added to this
constraint)
|
boolean |
isConsistent(Placement p1,
Placement p2)
Returns true if the given assignments are consistent respecting this
constraint.
|
String |
toString() |
void |
unassigned(long iteration,
Placement placement)
Given value is unassigned from its variable.
|
void |
weaken()
Weaken the constraint.
|
void |
weaken(Placement value)
Weaken the constraint enough so that it can assign the given
value.
|
addConstraintListener, assignedVariables, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isHard, removeConstraintListener, removeVariable, setModel, variables
public static boolean USE_MOST_IMPROVEMENT_ADEPTS
public SpreadConstraint(String name, double spreadFactor, int unassignmentsToWeaken, boolean interactiveMode)
public SpreadConstraint(DataProperties config, String name)
protected Criterion<Lecture,Placement> getCriterion()
public void init()
public Placement getAdept(Placement placement, int[][] nrCourses, Set<Placement> conflicts)
public void computeConflicts(Placement placement, Set<Placement> conflicts)
Constraint
computeConflicts
in class Constraint<Lecture,Placement>
placement
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic boolean inConflict(Placement placement)
Constraint
MacPropagation
).inConflict
in class Constraint<Lecture,Placement>
public boolean isConsistent(Placement p1, Placement p2)
Constraint
MacPropagation
).isConsistent
in class Constraint<Lecture,Placement>
public void weaken()
WeakeningConstraint
weaken
in interface WeakeningConstraint<Lecture,Placement>
public void assigned(long iteration, Placement placement)
Constraint
assigned
in class Constraint<Lecture,Placement>
public void unassigned(long iteration, Placement placement)
Constraint
unassigned
in class Constraint<Lecture,Placement>
public String getName()
Constraint
getName
in class Constraint<Lecture,Placement>
public int getPenalty()
public int getPenaltyEstimate()
public int getMaxPenalty(Placement placement)
public int getPenalty(Placement placement)
public int[][] getMaxCourses()
public int[][] getNrCourses()
public List<Placement>[][] getCourses()
public void addVariable(Lecture lecture)
Constraint
addVariable
in class Constraint<Lecture,Placement>
public void weaken(Placement value)
WeakeningConstraint
weaken
in interface WeakeningConstraint<Lecture,Placement>