ttsolver.constraint
Class InstructorConstraint

java.lang.Object
  extended by ifs.model.Constraint
      extended by ttsolver.constraint.ResourceConstraint
          extended by ttsolver.constraint.InstructorConstraint

public class InstructorConstraint
extends ResourceConstraint

Instructor constraint.
Classes with this instructor can not overlap in time. Also, for back-to-back classes, there is the following reasoning:

Version:
1.0
Author:
Tomáš Müller

Field Summary
static double sDiscouragedLimit
          Back-to-back classes: maximal distance for discouraged prefernce
static double sNoPreferenceLimit
          Back-to-back classes: maximal distance for no prefernce
static double sProhibitedLimit
          Back-to-back classes: maximal distance for strongly discouraged prefernce (everything above is prohibited)
 
Fields inherited from class ttsolver.constraint.ResourceConstraint
iDays, iResource, iSlotsPerDay
 
Constructor Summary
InstructorConstraint(String id, String name, int slotsPerDay, int days)
          Constructor
 
Method Summary
 void computeConflicts(Value value, Set conflicts)
          The only method which has to be implemented by any constraint.
static int getDistancePreference(Placement p1, Placement p2)
          Back-to-back preference of two placements (3 means prohibited)
 int getPreference()
          Overall back-to-back preference of this instructor
 int getPreference(Value value)
          Back-to-back preference of the given placement
 int getWorstPreference()
          Worst back-to-back preference of this instructor
 boolean inConflict(Value value)
          Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint.
 boolean isConsistent(Value value1, Value value2)
          Returns true if the given assignments are consistent respecting this constraint.
 
Methods inherited from class ttsolver.constraint.ResourceConstraint
assigned, countUselessSlots, getDays, getName, getResource, getResourceId, getSlotsPerDay, printUsage, toString, unassigned
 
Methods inherited from class ifs.model.Constraint
addConstraintListener, addVariable, assignedVariables, countAssignedVariables, countVariables, getDescription, getId, getInfo, getModel, hashCode, isHard, removeConstraintListener, removeVariable, setModel, variables
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sNoPreferenceLimit

public static double sNoPreferenceLimit
Back-to-back classes: maximal distance for no prefernce


sDiscouragedLimit

public static double sDiscouragedLimit
Back-to-back classes: maximal distance for discouraged prefernce


sProhibitedLimit

public static double sProhibitedLimit
Back-to-back classes: maximal distance for strongly discouraged prefernce (everything above is prohibited)

Constructor Detail

InstructorConstraint

public InstructorConstraint(String id,
                            String name,
                            int slotsPerDay,
                            int days)
Constructor

Parameters:
id - instructor id
name - instructor name
slotsPerDay - number of slots per day
days - number of days
Method Detail

getDistancePreference

public static int getDistancePreference(Placement p1,
                                        Placement p2)
Back-to-back preference of two placements (3 means prohibited)


computeConflicts

public void computeConflicts(Value value,
                             Set conflicts)
Description copied from class: Constraint
The only method which has to be implemented by any constraint. It returns the values which needs to be unassigned in order to make this constraint consistent with the given value if it is assigned to its variable. The computed list of conflicting values is added to the given set of conflicts.

Overrides:
computeConflicts in class ResourceConstraint
Parameters:
value - value to be assigned to its varaible
conflicts - resultant set of conflicting values

inConflict

public boolean inConflict(Value value)
Description copied from class: Constraint
Returns true if the given assignment is inconsistent with the existing assignments respecting this constraint. This method is used by MAC (see MacPropagation).

Overrides:
inConflict in class ResourceConstraint

isConsistent

public boolean isConsistent(Value value1,
                            Value value2)
Description copied from class: Constraint
Returns true if the given assignments are consistent respecting this constraint. This method is used by MAC (see MacPropagation).

Overrides:
isConsistent in class ResourceConstraint

getPreference

public int getPreference(Value value)
Back-to-back preference of the given placement


getPreference

public int getPreference()
Overall back-to-back preference of this instructor


getWorstPreference

public int getWorstPreference()
Worst back-to-back preference of this instructor



Copyright © 2005 Tomáš Müller