org.cpsolver.studentsct.model

## Class Enrollment

- java.lang.Object
- - org.cpsolver.ifs.model.Value<Request,Enrollment>
  - - org.cpsolver.studentsct.model.Enrollment

- All Implemented Interfaces:
    Comparable<Enrollment>, AssignmentComparable<Enrollment,Request,Enrollment>

      public class Enrollment
      extends Value<Request,Enrollment>

  Representation of an enrollment of a student into a course. A student needs to be enrolled in a section of each subpart of a selected configuration. When parent-child relation is defined among sections, if a student is enrolled in a section that has a parent section defined, he/she has be enrolled in the parent section as well. Also, the selected sections cannot overlap in time.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 2014 Tomáš Müller
    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/.

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.model.Value

      `iValue`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Enrollment(Request request, int priority, boolean noReservationPenalty, Course course, Config config, Set<? extends SctAssignment> assignments, Reservation reservation)` Constructor
    `Enrollment(Request request, int priority, Config config, Set<? extends SctAssignment> assignments, Assignment<Request,Enrollment> assignment)` Constructor
    `Enrollment(Request request, int priority, Course course, Config config, Set<? extends SctAssignment> assignments, Reservation reservation)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Set<DistanceConflict.Conflict>` | `distanceConflicts(Assignment<Request,Enrollment> assignment)` Distance conflicts, in which this enrollment is involved.
    `boolean` | `equals(Object o)` By default, comparison is made on unique ids
    `int` | `getAdjustedPriority()` Return adjusted enrollment priority, including priority bump provided by reservations (but ensuring that getting the course without a reservation is still better than getting an alternative)
    `String` | `getApproval()` Approval of the enrollment (only used by the online student sectioning)
    `Set<SctAssignment>` | `getAssignments()` List of assignments (selected sections)
    `Config` | `getConfig()` Config of the course request
    `Course` | `getCourse()` Course of the course request
    `float` | `getCredit()` Credit of this enrollment (using either `Course.getCreditValue()` or `Subpart.getCreditValue()` when course credit is not present)
    `int` | `getLimit()` Enrollment limit, i.e., the number of students that would be able to get into the offering using this enrollment (if all the sections are empty)
    `String` | `getName()` Enrollment name
    `int` | `getNrSlots()` Return total number of slots of all sections in the enrollment.
    `Offering` | `getOffering()` Offering of the course request
    `double` | `getPenalty()` Enrollment penalty -- sum of section penalties (see `Section.getPenalty()`)
    `int` | `getPriority()` Return enrollment priority
    `Request` | `getRequest()` Request
    `Reservation` | `getReservation()` Return reservation used for this enrollment
    `Set<Section>` | `getSections()` List of sections (only for course request)
    `Student` | `getStudent()` Student
    `Long` | `getTimeStamp()` Time stamp of the enrollment
    `int` | `getTruePriority()` Return enrollment priority, ignoring priority bump provided by reservations
    `void` | `guessReservation(Assignment<Request,Enrollment> assignment, boolean onlyAvailable)` Guess the reservation based on the enrollment
    `boolean` | `isAllowOverlap()` True if this enrollment can overlap with other enrollments of the student.
    `boolean` | `isCourseRequest()` True if the request is course request
    `boolean` | `isOverlapping(Enrollment enrl)` True when this enrollment is overlapping with the given enrollment
    `boolean` | `isSelected()` True if all the sections are selected
    `boolean` | `isWaitlisted()` True if all the sections are wait-listed
    `double` | `percentInitial()` Percent of sections that are initial
    `double` | `percentSameTime()` Percent of sections that have same time as the initial assignment
    `double` | `percentSelected()` Percent of sections that are selected
    `double` | `percentSelectedSameConfig()` Percent of sections that have the same configuration
    `double` | `percentSelectedSameSection()` Percent of sections that are selected
    `double` | `percentWaitlisted()` Percent of sections that are wait-listed
    `void` | `setApproval(String approval)` Approval of the enrollment (only used by the online student sectioning)
    `void` | `setReservation(Reservation reservation)` Set reservation for this enrollment
    `void` | `setTimeStamp(Long timeStamp)` Time stamp of the enrollment
    `Set<StudentQuality.Conflict>` | `studentQualityConflicts(Assignment<Request,Enrollment> assignment)`
    `Set<TimeOverlapsCounter.Conflict>` | `timeOverlappingConflicts(Assignment<Request,Enrollment> assignment)` Time overlapping conflicts, in which this enrollment is involved.
    `double` | `toDouble(Assignment<Request,Enrollment> assignment)` Enrollment value
    `double` | `toDouble(Assignment<Request,Enrollment> assignment, boolean precise)` Enrollment value
    `String` | `toString()`
    `String` | `toString(Assignment<Request,Enrollment> a)`

    - ### Methods inherited from class org.cpsolver.ifs.model.Value

      `compareTo, compareTo, conflicts, conflicts, getDescription, getExtra, getId, hashCode, isConsistent, setExtra, setVariable, toDouble, valueEquals, valueEquals, variable`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### Enrollment

          public Enrollment(Request request,
                            int priority,
                            boolean noReservationPenalty,
                            Course course,
                            Config config,
                            Set<? extends SctAssignment> assignments,
                            Reservation reservation)

      Constructor
      Parameters:
        `request` - course / free time request
        `priority` - zero for the course, one for the first alternative, two for the second alternative
        `noReservationPenalty` - when true +1 is added to priority (prefer enrollments with reservations)
        `course` - selected course
        `config` - selected configuration
        `assignments` - valid list of sections
        `reservation` - used reservation

    - #### Enrollment

          public Enrollment(Request request,
                            int priority,
                            Course course,
                            Config config,
                            Set<? extends SctAssignment> assignments,
                            Reservation reservation)

      Constructor
      Parameters:
        `request` - course / free time request
        `priority` - zero for the course, one for the first alternative, two for the second alternative
        `course` - selected course
        `config` - selected configuration
        `assignments` - valid list of sections
        `reservation` - used reservation

    - #### Enrollment

          public Enrollment(Request request,
                            int priority,
                            Config config,
                            Set<? extends SctAssignment> assignments,
                            Assignment<Request,Enrollment> assignment)

      Constructor
      Parameters:
        `request` - course / free time request
        `priority` - zero for the course, one for the first alternative, two for the second alternative
        `config` - selected configuration
        `assignments` - valid list of sections
        `assignment` - current assignment (to guess the reservation)

  - ### Method Detail

    - #### guessReservation

          public void guessReservation(Assignment<Request,Enrollment> assignment,
                                       boolean onlyAvailable)

      Guess the reservation based on the enrollment
      Parameters:
        `assignment` - current assignment
        `onlyAvailable` - use only reservation that have some space left in them

    - #### getStudent

          public Student getStudent()

      Student
      Returns:
        student

    - #### getRequest

          public Request getRequest()

      Request
      Returns:
        request

    - #### isCourseRequest

          public boolean isCourseRequest()

      True if the request is course request
      Returns:
        true if the request if course request

    - #### getOffering

          public Offering getOffering()

      Offering of the course request
      Returns:
        offering of the course request

    - #### getConfig

          public Config getConfig()

      Config of the course request
      Returns:
        config of the course request

    - #### getCourse

          public Course getCourse()

      Course of the course request
      Returns:
        course of the course request

    - #### getAssignments

          public Set<SctAssignment> getAssignments()

      List of assignments (selected sections)
      Returns:
        assignments (selected sections)

    - #### getSections

          public Set<Section> getSections()

      List of sections (only for course request)
      Returns:
        selected sections

    - #### isOverlapping

          public boolean isOverlapping(Enrollment enrl)

      True when this enrollment is overlapping with the given enrollment
      Parameters:
        `enrl` - other enrollment
      Returns:
        true if there is an overlap

    - #### percentWaitlisted

          public double percentWaitlisted()

      Percent of sections that are wait-listed
      Returns:
        percent of sections that are wait-listed

    - #### percentSelected

          public double percentSelected()

      Percent of sections that are selected
      Returns:
        percent of sections that are selected

    - #### percentSelectedSameSection

          public double percentSelectedSameSection()

      Percent of sections that are selected
      Returns:
        percent of sections that are selected

    - #### percentSelectedSameConfig

          public double percentSelectedSameConfig()

      Percent of sections that have the same configuration
      Returns:
        percent of sections that are selected

    - #### percentInitial

          public double percentInitial()

      Percent of sections that are initial
      Returns:
        percent of sections that of the initial enrollment

    - #### percentSameTime

          public double percentSameTime()

      Percent of sections that have same time as the initial assignment
      Returns:
        percent of sections that have same time as the initial assignment

    - #### isWaitlisted

          public boolean isWaitlisted()

      True if all the sections are wait-listed
      Returns:
        all the sections are wait-listed

    - #### isSelected

          public boolean isSelected()

      True if all the sections are selected
      Returns:
        all the sections are selected

    - #### getPenalty

          public double getPenalty()

      Enrollment penalty -- sum of section penalties (see `Section.getPenalty()`)
      Returns:
        online penalty

    - #### toDouble

          public double toDouble(Assignment<Request,Enrollment> assignment)

      Enrollment value
      Overrides:
        `toDouble` in class `Value<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment
      Returns:
        this value's contribution to the solution value

    - #### toDouble

          public double toDouble(Assignment<Request,Enrollment> assignment,
                                 boolean precise)

      Enrollment value
      Parameters:
        `assignment` - current assignment
        `precise` - if false, distance conflicts and time overlaps are ignored (i.e., much faster, but less precise computation)
      Returns:
        enrollment penalty

    - #### getName

          public String getName()

      Enrollment name
      Overrides:
        `getName` in class `Value<Request,Enrollment>`
      Returns:
        value name

    - #### toString

          public String toString(Assignment<Request,Enrollment> a)

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Value<Request,Enrollment>`

    - #### equals

          public boolean equals(Object o)

      Description copied from class: `Value`
      By default, comparison is made on unique ids
      Overrides:
        `equals` in class `Value<Request,Enrollment>`

    - #### distanceConflicts

          public Set<DistanceConflict.Conflict> distanceConflicts(Assignment<Request,Enrollment> assignment)

      Distance conflicts, in which this enrollment is involved.
      Parameters:
        `assignment` - current assignment
      Returns:
        distance conflicts

    - #### timeOverlappingConflicts

          public Set<TimeOverlapsCounter.Conflict> timeOverlappingConflicts(Assignment<Request,Enrollment> assignment)

      Time overlapping conflicts, in which this enrollment is involved.
      Parameters:
        `assignment` - current assignment
      Returns:
        time overlapping conflicts

    - #### studentQualityConflicts

          public Set<StudentQuality.Conflict> studentQualityConflicts(Assignment<Request,Enrollment> assignment)

    - #### getPriority

          public int getPriority()

      Return enrollment priority
      Returns:
        zero for the course, one for the first alternative, two for the second alternative

    - #### getTruePriority

          public int getTruePriority()

      Return enrollment priority, ignoring priority bump provided by reservations
      Returns:
        zero for the course, one for the first alternative, two for the second alternative

    - #### getAdjustedPriority

          public int getAdjustedPriority()

      Return adjusted enrollment priority, including priority bump provided by reservations (but ensuring that getting the course without a reservation is still better than getting an alternative)
      Returns:
        zero for the course, two for the first alternative, four for the second alternative; plus one when the no reservation penalty applies

    - #### getNrSlots

          public int getNrSlots()

      Return total number of slots of all sections in the enrollment.
      Returns:
        number of slots used

    - #### getReservation

          public Reservation getReservation()

      Return reservation used for this enrollment
      Returns:
        used reservation

    - #### setReservation

          public void setReservation(Reservation reservation)

      Set reservation for this enrollment
      Parameters:
        `reservation` - used reservation

    - #### getTimeStamp

          public Long getTimeStamp()

      Time stamp of the enrollment
      Returns:
        enrollment time stamp

    - #### setTimeStamp

          public void setTimeStamp(Long timeStamp)

      Time stamp of the enrollment
      Parameters:
        `timeStamp` - enrollment time stamp

    - #### getApproval

          public String getApproval()

      Approval of the enrollment (only used by the online student sectioning)
      Returns:
        consent approval

    - #### setApproval

          public void setApproval(String approval)

      Approval of the enrollment (only used by the online student sectioning)
      Parameters:
        `approval` - consent approval

    - #### isAllowOverlap

          public boolean isAllowOverlap()

      True if this enrollment can overlap with other enrollments of the student.
      Returns:
        can overlap with other enrollments of the student

    - #### getLimit

          public int getLimit()

      Enrollment limit, i.e., the number of students that would be able to get into the offering using this enrollment (if all the sections are empty)
      Returns:
        enrollment limit

    - #### getCredit

          public float getCredit()

      Credit of this enrollment (using either `Course.getCreditValue()` or `Subpart.getCreditValue()` when course credit is not present)
      Returns:
        credit of this enrollment