public class Resource extends Constraint<Activity,Location>
Modifier and Type | Field and Description |
---|---|
static int |
TYPE_CLASS |
static int |
TYPE_INSTRUCTOR |
static int |
TYPE_OTHER |
static int |
TYPE_ROOM |
iAssignedVariables, iConstraintListeners, iId
Constructor and Description |
---|
Resource(String id,
int type,
String name) |
Modifier and Type | Method and Description |
---|---|
void |
addDiscouragedSlot(int slot) |
void |
addDiscouragedSlot(int day,
int hour) |
void |
addProhibitedSlot(int slot) |
void |
addProhibitedSlot(int day,
int hour) |
void |
assigned(long iteration,
Location location)
Given value is to be assigned to its varable.
|
void |
computeConflicts(Location location,
Set<Location> conflicts)
The only method which has to be implemented by any constraint.
|
Set<Integer> |
getDiscouragedSlots() |
String |
getName()
Constraint's name -- for printing purposes
|
Set<Integer> |
getProhibitedSlots() |
String |
getResourceId() |
int |
getType() |
boolean |
inConflict(Location location)
Returns true if the given assignment is inconsistent with the existing
assignments respecting this constraint.
|
boolean |
isConsistent(Location l1,
Location l2)
Returns true if the given assignments are consistent respecting this
constraint.
|
boolean |
isDiscouragedSlot(int slot) |
boolean |
isDiscouragedSlot(int day,
int hour) |
boolean |
isProhibited(int day,
int hour,
int length) |
boolean |
isProhibitedSlot(int slot) |
boolean |
isProhibitedSlot(int day,
int hour) |
void |
setModel(Model<Activity,Location> model)
Sets the model which the constraint belongs to
|
void |
unassigned(long iteration,
Location location)
Given value is unassigned from its variable.
|
addConstraintListener, addVariable, assignedVariables, compareTo, constraintListeners, countAssignedVariables, countVariables, equals, getDescription, getId, getModel, hashCode, isHard, removeConstraintListener, removeVariable, variables
public static final int TYPE_ROOM
public static final int TYPE_INSTRUCTOR
public static final int TYPE_CLASS
public static final int TYPE_OTHER
public void setModel(Model<Activity,Location> model)
Constraint
setModel
in class Constraint<Activity,Location>
public String getResourceId()
public String getName()
Constraint
getName
in class Constraint<Activity,Location>
public int getType()
public Set<Integer> getProhibitedSlots()
public Set<Integer> getDiscouragedSlots()
public void addProhibitedSlot(int day, int hour)
public void addDiscouragedSlot(int day, int hour)
public boolean isProhibitedSlot(int day, int hour)
public boolean isDiscouragedSlot(int day, int hour)
public void addProhibitedSlot(int slot)
public void addDiscouragedSlot(int slot)
public boolean isProhibitedSlot(int slot)
public boolean isDiscouragedSlot(int slot)
public boolean isProhibited(int day, int hour, int length)
public void computeConflicts(Location location, Set<Location> conflicts)
Constraint
computeConflicts
in class Constraint<Activity,Location>
location
- value to be assigned to its varaibleconflicts
- resultant set of conflicting valuespublic boolean inConflict(Location location)
Constraint
MacPropagation
).inConflict
in class Constraint<Activity,Location>
public boolean isConsistent(Location l1, Location l2)
Constraint
MacPropagation
).isConsistent
in class Constraint<Activity,Location>
public void assigned(long iteration, Location location)
Constraint
assigned
in class Constraint<Activity,Location>
public void unassigned(long iteration, Location location)
Constraint
unassigned
in class Constraint<Activity,Location>