net.sf.cpsolver.studentsct.model
Class CourseRequest

java.lang.Object
  extended by net.sf.cpsolver.ifs.model.Variable
      extended by net.sf.cpsolver.studentsct.model.Request
          extended by net.sf.cpsolver.studentsct.model.CourseRequest
All Implemented Interfaces:
Comparable

public class CourseRequest
extends Request

Representation of a request of a student for one or more course. A student requests one of the given courses, preferably the first one.

Version:
StudentSct 1.1 (Student Sectioning)
Copyright (C) 2007 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
static double sAltValue
          Enrollment value: value * sAltValue ^ index, where index is zero for the first course, one for the second course etc.
static boolean sSameTimePrecise
           
 
Fields inherited from class net.sf.cpsolver.studentsct.model.Request
sCacheValues
 
Fields inherited from class net.sf.cpsolver.ifs.model.Variable
iValue
 
Constructor Summary
CourseRequest(long id, int priority, boolean alternative, Student student, Vector courses, boolean waitlist)
          Constructor
 
Method Summary
 void clearCache()
          Clear cached min/max penalties and cached bound
 Vector computeEnrollments()
          Return all possible enrollments.
 Vector computeRandomEnrollments(int limitEachConfig)
          Return a subset of all enrollments -- randomly select only up to limitEachConfig enrollments of each config.
 Enrollment createEnrollment(Set sections)
          Create enrollment for the given list of sections.
 Vector getAvaiableEnrollments()
          Return all enrollments that are available
 TreeSet getAvaiableEnrollmentsSkipSameTime()
          Return all enrollments that are available, pick only the first section of the sections with the same time (of each subpart, Section comparator is used)
 double getBound()
          Estimated bound for this request -- it estimates the smallest value among all possible enrollments
 Config getConfig(long configId)
          Return configuration of the requested courses with the given id
 Course getCourse(long courseId)
          Return course of the requested courses with the given id
 Vector getCourses()
          List of requested courses (in the correct order -- first is the requested course, second is the first alternative, etc.)
 Vector getEnrollmentsSkipSameTime()
          Return all possible enrollments.
 double getMaxPenalty()
          Maximal penalty (maximum of Offering.getMaxPenalty() among requested courses)
 double getMinPenalty()
          Minimal penalty (minimum of Offering.getMinPenalty() among requested courses)
 String getName()
          Request name: A for alternative, 1 + priority, (w) when waitlist, list of course names
 Section getSection(long sectionId)
          Return section of the requested courses with the given id
 Set getSelectedChoices()
          Selected choices
 Vector getSelectedEnrollments(boolean availableOnly)
          Return all enrollments that are selected (isSelected(Section) is true)
 Subpart getSubpart(long subpartId)
          Return subpart of the requested courses with the given id
 Set getWaitlistedChoices()
          Wait-listed choices
 boolean isSelected(Section section)
          Return true when the given section is selected (i.e., its choice is among selected choices)
 boolean isWaitlist()
          True if the student can be put on a wait-list (no alternative course request will be given instead)
 boolean isWaitlisted(Section section)
          Return true when the given section is wait-listed (i.e., its choice is among wait-listed choices)
 String toString()
           
 
Methods inherited from class net.sf.cpsolver.studentsct.model.Request
assign, compareTo, getId, getPriority, getStudent, getWeight, isAlternative, setPriority, setWeight, unassign, values
 
Methods inherited from class net.sf.cpsolver.ifs.model.Variable
addContstraint, addVariableListener, constraints, constraintVariables, countAssignments, equals, getAssignment, getBestAssignment, getBestAssignmentIteration, getDescription, getExtra, getInitialAssignment, getModel, getVariableListeners, hardConstraints, hasAssignment, hashCode, hasInitialAssignment, hasValues, lastAssignmentIteration, lastUnassignmentIteration, removeContstraint, removeInitialValue, removeValue, removeVariableListener, setBestAssignment, setExtra, setInitialAssignment, setModel, setValues, softConstraints
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

sAltValue

public static double sAltValue
Enrollment value: value * sAltValue ^ index, where index is zero for the first course, one for the second course etc.


sSameTimePrecise

public static boolean sSameTimePrecise
Constructor Detail

CourseRequest

public CourseRequest(long id,
                     int priority,
                     boolean alternative,
                     Student student,
                     Vector courses,
                     boolean waitlist)
Constructor

Parameters:
id - request unique id
priority - request priority
alternative - true if the request is alternative (alternative request can be assigned instead of a non-alternative course requests, if it is left unassigned)
student - appropriate student
courses - list of requested courses (in the correct order -- first is the requested course, second is the first alternative, etc.)
waitlist - true if the student can be put on a waitlist (no alternative course request will be given instead)
Method Detail

getCourses

public Vector getCourses()
List of requested courses (in the correct order -- first is the requested course, second is the first alternative, etc.)


createEnrollment

public Enrollment createEnrollment(Set sections)
Create enrollment for the given list of sections. The list of sections needs to be correct, i.e., a section for each subpart of a configuration of one of the requested courses.


computeEnrollments

public Vector computeEnrollments()
Return all possible enrollments.

Specified by:
computeEnrollments in class Request

computeRandomEnrollments

public Vector computeRandomEnrollments(int limitEachConfig)
Return a subset of all enrollments -- randomly select only up to limitEachConfig enrollments of each config.


getAvaiableEnrollments

public Vector getAvaiableEnrollments()
Return all enrollments that are available


getSelectedEnrollments

public Vector getSelectedEnrollments(boolean availableOnly)
Return all enrollments that are selected (isSelected(Section) is true)

Parameters:
availableOnly - pick only available sections

getAvaiableEnrollmentsSkipSameTime

public TreeSet getAvaiableEnrollmentsSkipSameTime()
Return all enrollments that are available, pick only the first section of the sections with the same time (of each subpart, Section comparator is used)


getEnrollmentsSkipSameTime

public Vector getEnrollmentsSkipSameTime()
Return all possible enrollments.


getWaitlistedChoices

public Set getWaitlistedChoices()
Wait-listed choices


isWaitlisted

public boolean isWaitlisted(Section section)
Return true when the given section is wait-listed (i.e., its choice is among wait-listed choices)


getSelectedChoices

public Set getSelectedChoices()
Selected choices


isSelected

public boolean isSelected(Section section)
Return true when the given section is selected (i.e., its choice is among selected choices)


getName

public String getName()
Request name: A for alternative, 1 + priority, (w) when waitlist, list of course names

Overrides:
getName in class Variable

isWaitlist

public boolean isWaitlist()
True if the student can be put on a wait-list (no alternative course request will be given instead)


toString

public String toString()
Overrides:
toString in class Variable

getCourse

public Course getCourse(long courseId)
Return course of the requested courses with the given id


getConfig

public Config getConfig(long configId)
Return configuration of the requested courses with the given id


getSubpart

public Subpart getSubpart(long subpartId)
Return subpart of the requested courses with the given id


getSection

public Section getSection(long sectionId)
Return section of the requested courses with the given id


getMinPenalty

public double getMinPenalty()
Minimal penalty (minimum of Offering.getMinPenalty() among requested courses)


getMaxPenalty

public double getMaxPenalty()
Maximal penalty (maximum of Offering.getMaxPenalty() among requested courses)


clearCache

public void clearCache()
Clear cached min/max penalties and cached bound


getBound

public double getBound()
Estimated bound for this request -- it estimates the smallest value among all possible enrollments

Specified by:
getBound in class Request