net.sf.cpsolver.studentsct.model
Class Section

java.lang.Object
  extended by net.sf.cpsolver.studentsct.model.Section
All Implemented Interfaces:
Comparable, Assignment

public class Section
extends Object
implements Assignment, Comparable

Representation of a class. Each section contains id, name, scheduling subpart, time/room placement, and a limit. Optionally, parent-child relation between sections can be defined.

Each student requesting a course needs to be enrolled in a class of each subpart of a selected configuration. In the case of parent-child relation between classes, if a student is enrolled in a section that has a parent section defined, he/she has to be enrolled in the parent section as well. If there is a parent-child relation between two sections, the same relation is defined on their subparts as well, i.e., if section A is a parent section B, subpart of section A isa parent of subpart of section B.

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

Constructor Summary
Section(long id, int limit, String name, Subpart subpart, Placement placement, String instructorIds, String instructorNames, Section parent)
          Constructor
 
Method Summary
 void assigned(Enrollment enrollment)
          Called when an enrollment with this section is assigned to a request
 int compareTo(Object o)
          Compare two sections, prefer sections with lower penalty and more open space
 Choice getChoice()
          A (student) choice representing this section.
 Set getEnrollments()
          Set of assigned enrollments
 double getEnrollmentWeight(Request excludeRequest)
          Enrollment weight -- weight of all requests which have an enrollment that contains this section, excluding the given one.
 long getId()
          Section id
 int getLimit()
          Section limit.
 String getLongName()
          Long name: subpart name + time long name + room names + instructor names
 double getMaxEnrollmentWeight()
          Maximal weight of a single enrollment in the section
 double getMinEnrollmentWeight()
          Minimal weight of a single enrollment in the section
 String getName()
          Section name
 int getNrRooms()
          Number of rooms in which the section meet.
 double getOnlineSectioningPenalty()
          Online sectioning penalty.
 Section getParent()
          Parent section of this section (can be null).
 double getPenalty()
          Return penalty which is added to an enrollment that contains this section.
 Placement getPlacement()
          Time/room placement of the section.
 Vector getRooms()
          Room placement -- list of RoomLocation
 double getSpaceExpected()
          Return the amount of space of this section that is expected to be taken by incoming students.
 double getSpaceHeld()
          Return the amount of space of this section that is held for incoming students.
 Subpart getSubpart()
          Scheduling subpart to which this section belongs
 TimeLocation getTime()
          Time placement of the section.
 boolean isOverlapping(Assignment assignment)
          True, if this section overlaps with the given assignment in time and space
 boolean isOverlapping(Set assignments)
          True, if this section overlaps with one of the given set of assignments in time and space
 void setLimit(int limit)
          Set section limit
 void setPenalty(double penalty)
          Set penalty which is added to an enrollment that contains this section.
 void setSpaceExpected(double spaceExpected)
          Set the amount of space of this section that is expected to be taken by incoming students.
 void setSpaceHeld(double spaceHeld)
          Set the amount of space of this section that is held for incoming students.
 String toString()
           
 void unassigned(Enrollment enrollment)
          Called when an enrollment with this section is unassigned from a request
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Section

public Section(long id,
               int limit,
               String name,
               Subpart subpart,
               Placement placement,
               String instructorIds,
               String instructorNames,
               Section parent)
Constructor

Parameters:
id - section unique id
limit - section limit, i.e., the maximal number of students that can be enrolled in this section at the same time
name - section name
subpart - subpart of this section
placement - time/room placement
instructorIds - instructor(s) id -- needed for getChoice()
instructorNames - instructor(s) name -- needed for getChoice()
parent - parent section -- if there is a parent section defined, a student that is enrolled in this section has to be enrolled in the parent section as well. Also, the same relation needs to be defined between subpart of this section and the subpart of the parent section
Method Detail

getId

public long getId()
Section id


getLimit

public int getLimit()
Section limit. This is defines the maximal number of students that can be enrolled into this section at the same time. It is -1 in the case of an unlimited section


setLimit

public void setLimit(int limit)
Set section limit


getName

public String getName()
Section name


getSubpart

public Subpart getSubpart()
Scheduling subpart to which this section belongs


getParent

public Section getParent()
Parent section of this section (can be null). If there is a parent section defined, a student that is enrolled in this section has to be enrolled in the parent section as well. Also, the same relation needs to be defined between subpart of this section and the subpart of the parent section.


getPlacement

public Placement getPlacement()
Time/room placement of the section. This can be null, for arranged sections.


getTime

public TimeLocation getTime()
Time placement of the section.

Specified by:
getTime in interface Assignment

getNrRooms

public int getNrRooms()
Number of rooms in which the section meet.

Specified by:
getNrRooms in interface Assignment

getRooms

public Vector getRooms()
Room placement -- list of RoomLocation

Specified by:
getRooms in interface Assignment
Returns:
list of RoomLocation

isOverlapping

public boolean isOverlapping(Assignment assignment)
True, if this section overlaps with the given assignment in time and space

Specified by:
isOverlapping in interface Assignment

isOverlapping

public boolean isOverlapping(Set assignments)
True, if this section overlaps with one of the given set of assignments in time and space

Specified by:
isOverlapping in interface Assignment

assigned

public void assigned(Enrollment enrollment)
Called when an enrollment with this section is assigned to a request

Specified by:
assigned in interface Assignment

unassigned

public void unassigned(Enrollment enrollment)
Called when an enrollment with this section is unassigned from a request

Specified by:
unassigned in interface Assignment

getEnrollments

public Set getEnrollments()
Set of assigned enrollments

Specified by:
getEnrollments in interface Assignment

getEnrollmentWeight

public double getEnrollmentWeight(Request excludeRequest)
Enrollment weight -- weight of all requests which have an enrollment that contains this section, excluding the given one. See Request.getWeight().


getMaxEnrollmentWeight

public double getMaxEnrollmentWeight()
Maximal weight of a single enrollment in the section


getMinEnrollmentWeight

public double getMinEnrollmentWeight()
Minimal weight of a single enrollment in the section


getLongName

public String getLongName()
Long name: subpart name + time long name + room names + instructor names


toString

public String toString()
Overrides:
toString in class Object

getChoice

public Choice getChoice()
A (student) choice representing this section.


getPenalty

public double getPenalty()
Return penalty which is added to an enrollment that contains this section.


setPenalty

public void setPenalty(double penalty)
Set penalty which is added to an enrollment that contains this section.


compareTo

public int compareTo(Object o)
Compare two sections, prefer sections with lower penalty and more open space

Specified by:
compareTo in interface Comparable

getSpaceHeld

public double getSpaceHeld()
Return the amount of space of this section that is held for incoming students. This attribute is computed during the batch sectioning (it is the overall weight of dummy students enrolled in this section) and it is being updated with each incomming student during the online sectioning.


setSpaceHeld

public void setSpaceHeld(double spaceHeld)
Set the amount of space of this section that is held for incoming students. See getSpaceHeld() for more info.


getSpaceExpected

public double getSpaceExpected()
Return the amount of space of this section that is expected to be taken by incoming students. This attribute is computed during the batch sectioning (for each dummy student that can attend this section (without any conflict with other enrollments of that student), 1 / x where x is the number of such sections of this subpart is added to this value). Also, this value is being updated with each incomming student during the online sectioning.


setSpaceExpected

public void setSpaceExpected(double spaceExpected)
Set the amount of space of this section that is expected to be taken by incoming students. See getSpaceExpected() for more info.


getOnlineSectioningPenalty

public double getOnlineSectioningPenalty()
Online sectioning penalty.