net.sf.cpsolver.exam.model
Class ExamInstructor

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Constraint
      extended by net.sf.cpsolver.exam.model.ExamInstructor

public class ExamInstructor
extends Constraint

An instructor.

Version:
ExamTT 1.1 (Examination Timetabling)
Copyright (C) 2008 Tomáš Müller
muller@unitime.org
Lazenska 391, 76314 Zlin, Czech Republic

This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version.

This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA

Field Summary
 
Fields inherited from class net.sf.cpsolver.ifs.model.Constraint
iAssignedVariables, iConstraintListeners, iId
 
Constructor Summary
ExamInstructor(ExamModel model, long id, String name)
           
 
Method Summary
 void afterAssigned(long iteration, Value value)
          An exam was assigned, update instructor assignment table
 void afterUnassigned(long iteration, Value value)
          An exam was unassigned, update instructor assignment table
 int compareTo(Object o)
          Compare two instructors (by instructor ids)
 void computeConflicts(Value value, Set conflicts)
          Compute conflicts between the given assignment of an exam and all the current assignments (of this instructor).
 boolean equals(Object o)
          Compare two instructors for equality
 Set getExams(ExamPeriod period)
          Exam(s) enrolled by the instructor that are scheduled in the given period
 Set getExamsADay(ExamPeriod period)
          Exam(s) enrolled by the instructor that are scheduled in the given day
 Set getExamsADay(int day)
          Exam(s) enrolled by the instructor that are scheduled in the given day
 String getName()
          Instructor name
 Vector getOwners()
          Courses and/or sections that this instructor is enrolled to
 int hashCode()
          Hash code
 boolean hasName()
          Instructor name
 boolean inConflict(Value value)
          Check whether there is a conflict between the given assignment of an exam and all the current assignments (of this instructor).
 boolean isAllowDirectConflicts()
          True when direct instructor conflicts are not allowed.
 boolean isAvailable(ExamPeriod period)
          True if the student is available (for examination timetabling) during the given period
 boolean isConsistent(Value value1, Value value2)
          True if the given exams can conflict (see isAllowDirectConflicts()), or if they are placed at different periods.
 boolean isHard()
          Returns true if the constraint is hard.
 void setAllowDirectConflicts(boolean allowDirectConflicts)
          Set to true when direct instructor conflicts are not allowed.
 void setAvailable(int period, boolean available)
          Set whether the student is available (for examination timetabling) during the given period
 String toString()
          Instructor name
 
Methods inherited from class net.sf.cpsolver.ifs.model.Constraint
addConstraintListener, addVariable, assigned, assignedVariables, constraintListeners, countAssignedVariables, countVariables, getDescription, getId, getModel, removeConstraintListener, removeVariable, setModel, unassigned, variables
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExamInstructor

public ExamInstructor(ExamModel model,
                      long id,
                      String name)
Method Detail

isAllowDirectConflicts

public boolean isAllowDirectConflicts()
True when direct instructor conflicts are not allowed.


setAllowDirectConflicts

public void setAllowDirectConflicts(boolean allowDirectConflicts)
Set to true when direct instructor conflicts are not allowed.


getExams

public Set getExams(ExamPeriod period)
Exam(s) enrolled by the instructor that are scheduled in the given period


getExamsADay

public Set getExamsADay(ExamPeriod period)
Exam(s) enrolled by the instructor that are scheduled in the given day


getExamsADay

public Set getExamsADay(int day)
Exam(s) enrolled by the instructor that are scheduled in the given day


computeConflicts

public void computeConflicts(Value value,
                             Set conflicts)
Compute conflicts between the given assignment of an exam and all the current assignments (of this instructor). Only not-allowed conflicts (see isAllowDirectConflicts()) are considered.

Specified by:
computeConflicts in class Constraint
Parameters:
value - value to be assigned to its varaible
conflicts - resultant set of conflicting values

inConflict

public boolean inConflict(Value value)
Check whether there is a conflict between the given assignment of an exam and all the current assignments (of this instructor). Only not-allowed conflicts (see isAllowDirectConflicts()) are considered.

Overrides:
inConflict in class Constraint

isConsistent

public boolean isConsistent(Value value1,
                            Value value2)
True if the given exams can conflict (see isAllowDirectConflicts()), or if they are placed at different periods.

Overrides:
isConsistent in class Constraint

afterAssigned

public void afterAssigned(long iteration,
                          Value value)
An exam was assigned, update instructor assignment table


afterUnassigned

public void afterUnassigned(long iteration,
                            Value value)
An exam was unassigned, update instructor assignment table


equals

public boolean equals(Object o)
Compare two instructors for equality

Overrides:
equals in class Constraint

hashCode

public int hashCode()
Hash code

Overrides:
hashCode in class Constraint

getName

public String getName()
Instructor name

Overrides:
getName in class Constraint

hasName

public boolean hasName()
Instructor name


toString

public String toString()
Instructor name

Overrides:
toString in class Object

compareTo

public int compareTo(Object o)
Compare two instructors (by instructor ids)


getOwners

public Vector getOwners()
Courses and/or sections that this instructor is enrolled to

Returns:
list of ExamOwner

isHard

public boolean isHard()
Description copied from class: Constraint
Returns true if the constraint is hard. Only hard constraints are allowed to unassign a variable when there is a conflict with a value that is being assigned

Overrides:
isHard in class Constraint

isAvailable

public boolean isAvailable(ExamPeriod period)
True if the student is available (for examination timetabling) during the given period

Parameters:
period - a period
Returns:
true if a student can attend an exam at the given period, false if otherwise

setAvailable

public void setAvailable(int period,
                         boolean available)
Set whether the student is available (for examination timetabling) during the given period

Parameters:
period - a period
available - true if a student can attend an exam at the given period, false if otherwise