net.sf.cpsolver.studentsct.model
Class Section

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

public class Section
extends Object
implements Assignment, Comparable<Section>

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.2 (Student Sectioning)
Copyright (C) 2007 - 2010 Tomas Muller
muller@unitime.org
http://muller.unitime.org

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 3 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 see http://www.gnu.org/licenses/.

Constructor Summary
Section(long id, int limit, String name, Subpart subpart, Placement placement, String instructorIds, String instructorNames, Section parent)
          Constructor
 
Method Summary
 void addIgnoreConflictWith(long sectionId)
          Add section id of a section that student conflicts are to be ignored with
 void assigned(Enrollment enrollment)
          Called when an enrollment with this section is assigned to a request
 void clearReservationCache()
          Clear reservation information that was cached on this section
 int compareById(Assignment a)
          Sections first, then by Request.getId()
 int compareTo(Section s)
          Compare two sections, prefer sections with lower penalty and more open space
 boolean equals(Object o)
           
 Choice getChoice()
          A (student) choice representing this section.
 Set<Enrollment> 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
 Set<Long> getIgnoreConflictWithSectionIds()
          Returns a set of ids of sections that student conflicts are to be ignored with (between this section and the others)
 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
 String getName(long courseId)
          Return course-dependent section name
 Map<Long,String> getNameByCourse()
          Return course-dependent section names
 String getNote()
          Section note
 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.
 List<Reservation> getReservations()
          Get reservations for this section
 List<RoomLocation> getRooms()
          Room placement -- list of RoomLocation
 List<Reservation> getSectionReservations()
          Get reservations that require this section
 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.
 double getTotalUnreservedSpace()
          Total space in the section that cannot be used by any section reservation
 double getUnreservedSpace(Request excludeRequest)
          Available space in the section that is not reserved by any section reservation
 int hashCode()
           
 boolean isAllowOverlap()
          Return true if overlaps are allowed, but the number of overlapping slots should be minimized.
 boolean isOverlapping(Assignment assignment)
          True, if this section overlaps with the given assignment in time and space
 boolean isOverlapping(Set<? extends Assignment> assignments)
          True, if this section overlaps with one of the given set of assignments in time and space
 boolean isToIgnoreStudentConflictsWith(long sectionId)
          Returns true if student conflicts between this section and the given one are to be ignored
 void setLimit(int limit)
          Set section limit
 void setName(long courseId, String name)
          Set course-dependent section name
 void setName(String name)
          Set section name
 void setNote(String note)
          Section note
 void setPenalty(double penalty)
          Set penalty which is added to an enrollment that contains this section.
 void setPlacement(Placement placement)
          Set time/room placement of the 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, finalize, getClass, 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

Specified by:
getId in interface Assignment

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


setName

public void setName(String name)
Set 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.


setPlacement

public void setPlacement(Placement placement)
Set 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 List<RoomLocation> 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<? extends Assignment> 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<Enrollment> 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(Section s)
Compare two sections, prefer sections with lower penalty and more open space

Specified by:
compareTo in interface Comparable<Section>

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.


isAllowOverlap

public boolean isAllowOverlap()
Return true if overlaps are allowed, but the number of overlapping slots should be minimized. This can be changed on the subpart, using Subpart.setAllowOverlap(boolean).

Specified by:
isAllowOverlap in interface Assignment

compareById

public int compareById(Assignment a)
Sections first, then by Request.getId()

Specified by:
compareById in interface Assignment

getUnreservedSpace

public double getUnreservedSpace(Request excludeRequest)
Available space in the section that is not reserved by any section reservation

Parameters:
excludeRequest - excluding given request (if not null)

getTotalUnreservedSpace

public double getTotalUnreservedSpace()
Total space in the section that cannot be used by any section reservation


getReservations

public List<Reservation> getReservations()
Get reservations for this section


getSectionReservations

public List<Reservation> getSectionReservations()
Get reservations that require this section


clearReservationCache

public void clearReservationCache()
Clear reservation information that was cached on this section


getName

public String getName(long courseId)
Return course-dependent section name


setName

public void setName(long courseId,
                    String name)
Set course-dependent section name


getNameByCourse

public Map<Long,String> getNameByCourse()
Return course-dependent section names


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

getNote

public String getNote()
Section note


setNote

public void setNote(String note)
Section note


addIgnoreConflictWith

public void addIgnoreConflictWith(long sectionId)
Add section id of a section that student conflicts are to be ignored with


isToIgnoreStudentConflictsWith

public boolean isToIgnoreStudentConflictsWith(long sectionId)
Returns true if student conflicts between this section and the given one are to be ignored


getIgnoreConflictWithSectionIds

public Set<Long> getIgnoreConflictWithSectionIds()
Returns a set of ids of sections that student conflicts are to be ignored with (between this section and the others)



Copyright © 2014 UniTime LLC. All Rights Reserved.