net.sf.cpsolver.studentsct

## Class StudentSectioningModel

- java.lang.Object
- - net.sf.cpsolver.ifs.model.Model<Request,Enrollment>
  - - net.sf.cpsolver.studentsct.StudentSectioningModel

-     public class StudentSectioningModel
      extends Model<Request,Enrollment>

  Student sectioning model.
  Version:
    StudentSct 1.2 (Student Sectioning)
    Copyright (C) 2007 - 2010 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
    Modifier and Type | Field and Description
    --- | ---
    `protected double` | `iProjectedStudentWeight`
    `protected static DecimalFormat` | `sDecimalFormat`

    - ### Fields inherited from class net.sf.cpsolver.ifs.model.Model

      `iAssignedVariables, iPerturbVariables, iUnassignedVariables, sDoubleFormat, sPercentageFormat, sTimeFormat`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StudentSectioningModel(DataProperties properties)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `add(DistanceConflict.Conflict c)`
    `void` | `add(TimeOverlapsCounter.Conflict c)`
    `void` | `addLinkedSections(Collection<Section> sections)` Link sections using `LinkedSections`
    `void` | `addLinkedSections(Section... sections)` Link sections using `LinkedSections`
    `void` | `addOffering(Offering offering)` Add an offering into the model
    `void` | `addStudent(Student student)` Add a student into the model
    `void` | `addVariable(Request request)` Adds a variable to the model
    `void` | `afterAssigned(long iteration, Enrollment enrollment)` Called after an enrollment was assigned to a request.
    `void` | `afterUnassigned(long iteration, Enrollment enrollment)` Called before an enrollment was unassigned from a request.
    `double` | `avg(double w1, double w2)` Quadratic average of two weights.
    `double` | `avgNrRequests()` Average number of requests per student (see `Student.getRequests()` )
    `double` | `avgUnassignPriority()` Average priority of unassigned requests (see `Request.getPriority()`)
    `void` | `clearOnlineSectioningInfos()` Empty online student sectioning infos for all sections (see `Section.getSpaceExpected()` and `Section.getSpaceHeld()`).
    `void` | `computeOnlineSectioningInfos()` Compute online student sectioning infos for all sections (see `Section.getSpaceExpected()` and `Section.getSpaceHeld()`).
    `Set<Student>` | `getCompleteStudents()` Students with complete schedules (see `Student.isComplete()`)
    `DistanceConflict` | `getDistanceConflict()` Return distance conflict extension
    `Map<String,String>` | `getExtendedInfo()` Model extended info.
    `Map<String,String>` | `getInfo()` Model info
    `List<LinkedSections>` | `getLinkedSections()` List of linked sections
    `int` | `getMaxDomainSize()` Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit.
    `int` | `getNrAssignedLastLikeRequests(boolean precise)` Number of requests from projected (`Student.isDummy()` equals true) students that are assigned.
    `int` | `getNrAssignedRealRequests(boolean precise)` Number of requests from real (`Student.isDummy()` equals false) students that are assigned.
    `int` | `getNrCompleteLastLikeStudents(boolean precise)` Number of last like (`Student.isDummy()` equals true) students with a complete schedule (`Student.isComplete()` equals true).
    `int` | `getNrCompleteRealStudents(boolean precise)` Number of real (`Student.isDummy()` equals false) students with a complete schedule (`Student.isComplete()` equals true).
    `int` | `getNrLastLikeRequests(boolean precise)` Number of requests from projected (`Student.isDummy()` equals true) students.
    `int` | `getNrLastLikeStudents(boolean precise)` Number of last like (`Student.isDummy()` equals true) students.
    `int` | `getNrRealRequests(boolean precise)` Number of requests from real (`Student.isDummy()` equals false) students.
    `int` | `getNrRealStudents(boolean precise)` Number of real (`Student.isDummy()` equals false) students.
    `List<Offering>` | `getOfferings()` List of offerings
    `DataProperties` | `getProperties()` Configuration
    `boolean` | `getReservationCanAssignOverTheLimit()` Return true if reservation that has `Reservation.canAssignOverLimit()` can assign enrollments over the limit
    `List<Student>` | `getStudents()` Students
    `StudentWeights` | `getStudentWeights()` Return student weighting model
    `TimeOverlapsCounter` | `getTimeOverlaps()` Return time overlaps extension
    `double` | `getTotalRequestWeight()` Sum of weights of all requests (see `Request.getWeight()`).
    `double` | `getTotalValue()` Overall solution value
    `double` | `getTotalValue(boolean precise)` Overall solution value
    `double` | `getUnassignedRequestWeight()` Sum of weights of all requests that are not assigned (see `Request.getWeight()`).
    `int` | `nrComplete()` Number of students with complete schedule
    `void` | `remove(DistanceConflict.Conflict c)`
    `void` | `remove(TimeOverlapsCounter.Conflict c)`
    `void` | `removeStudent(Student student)` Remove a student from the model
    `void` | `removeVariable(Request request)` Removes a variable from the model
    `void` | `requestWeightsChanged()` Recompute cached request weights
    `void` | `restoreBest()`
    `void` | `setDistanceConflict(DistanceConflict dc)` Set distance conflict extension
    `void` | `setMaxDomainSize(int maxDomainSize)` Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit.
    `void` | `setStudentWeights(StudentWeights weights)` Set student weighting model
    `void` | `setTimeOverlaps(TimeOverlapsCounter toc)` Set time overlaps extension
    `String` | `toString()`

    - ### Methods inherited from class net.sf.cpsolver.ifs.model.Model

      `addConstraint, addCriterion, addGlobalConstraint, addModelListener, assignedVariables, beforeAssigned, beforeUnassigned, bestUnassignedVariables, clearBest, conflictConstraints, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, getBestPerturbations, getBestUnassignedVariables, getCriteria, getCriterion, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, globalConstraints, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, restoreBest, saveBest, unassignedHardConstraints, unassignedVariables, variables, variablesWithInitialValue, weaken`

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

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

- - ### Field Detail

    - #### sDecimalFormat

          protected static DecimalFormat sDecimalFormat

    - #### iProjectedStudentWeight

          protected double iProjectedStudentWeight

  - ### Constructor Detail

    - #### StudentSectioningModel

          public StudentSectioningModel(DataProperties properties)

      Constructor
      Parameters:
        `properties` - configuration

  - ### Method Detail

    - #### getReservationCanAssignOverTheLimit

          public boolean getReservationCanAssignOverTheLimit()

      Return true if reservation that has `Reservation.canAssignOverLimit()` can assign enrollments over the limit

    - #### getStudentWeights

          public StudentWeights getStudentWeights()

      Return student weighting model

    - #### setStudentWeights

          public void setStudentWeights(StudentWeights weights)

      Set student weighting model

    - #### getStudents

          public List<Student> getStudents()

      Students

    - #### getCompleteStudents

          public Set<Student> getCompleteStudents()

      Students with complete schedules (see `Student.isComplete()`)

    - #### addStudent

          public void addStudent(Student student)

      Add a student into the model

    - #### addVariable

          public void addVariable(Request request)

      Description copied from class: `Model`
      Adds a variable to the model
      Overrides:
        `addVariable` in class `Model<Request,Enrollment>`

    - #### requestWeightsChanged

          public void requestWeightsChanged()

      Recompute cached request weights

    - #### removeStudent

          public void removeStudent(Student student)

      Remove a student from the model

    - #### removeVariable

          public void removeVariable(Request request)

      Description copied from class: `Model`
      Removes a variable from the model
      Overrides:
        `removeVariable` in class `Model<Request,Enrollment>`

    - #### getOfferings

          public List<Offering> getOfferings()

      List of offerings

    - #### addOffering

          public void addOffering(Offering offering)

      Add an offering into the model

    - #### addLinkedSections

          public void addLinkedSections(Section... sections)

      Link sections using `LinkedSections`

    - #### addLinkedSections

          public void addLinkedSections(Collection<Section> sections)

      Link sections using `LinkedSections`

    - #### getLinkedSections

          public List<LinkedSections> getLinkedSections()

      List of linked sections

    - #### nrComplete

          public int nrComplete()

      Number of students with complete schedule

    - #### getInfo

          public Map<String,String> getInfo()

      Model info
      Overrides:
        `getInfo` in class `Model<Request,Enrollment>`

    - #### getTotalValue

          public double getTotalValue(boolean precise)

      Overall solution value

    - #### getTotalValue

          public double getTotalValue()

      Overall solution value
      Overrides:
        `getTotalValue` in class `Model<Request,Enrollment>`

    - #### afterAssigned

          public void afterAssigned(long iteration,
                                    Enrollment enrollment)

      Called after an enrollment was assigned to a request. The list of complete students and the overall solution value are updated.
      Overrides:
        `afterAssigned` in class `Model<Request,Enrollment>`

    - #### afterUnassigned

          public void afterUnassigned(long iteration,
                                      Enrollment enrollment)

      Called before an enrollment was unassigned from a request. The list of complete students and the overall solution value are updated.
      Overrides:
        `afterUnassigned` in class `Model<Request,Enrollment>`

    - #### getProperties

          public DataProperties getProperties()

      Configuration

    - #### clearOnlineSectioningInfos

          public void clearOnlineSectioningInfos()

      Empty online student sectioning infos for all sections (see `Section.getSpaceExpected()` and `Section.getSpaceHeld()`).

    - #### computeOnlineSectioningInfos

          public void computeOnlineSectioningInfos()

      Compute online student sectioning infos for all sections (see `Section.getSpaceExpected()` and `Section.getSpaceHeld()`).

    - #### getUnassignedRequestWeight

          public double getUnassignedRequestWeight()

      Sum of weights of all requests that are not assigned (see `Request.getWeight()`).

    - #### getTotalRequestWeight

          public double getTotalRequestWeight()

      Sum of weights of all requests (see `Request.getWeight()`).

    - #### setDistanceConflict

          public void setDistanceConflict(DistanceConflict dc)

      Set distance conflict extension

    - #### getDistanceConflict

          public DistanceConflict getDistanceConflict()

      Return distance conflict extension

    - #### setTimeOverlaps

          public void setTimeOverlaps(TimeOverlapsCounter toc)

      Set time overlaps extension

    - #### getTimeOverlaps

          public TimeOverlapsCounter getTimeOverlaps()

      Return time overlaps extension

    - #### avgUnassignPriority

          public double avgUnassignPriority()

      Average priority of unassigned requests (see `Request.getPriority()`)

    - #### avgNrRequests

          public double avgNrRequests()

      Average number of requests per student (see `Student.getRequests()` )

    - #### getNrLastLikeStudents

          public int getNrLastLikeStudents(boolean precise)

      Number of last like (`Student.isDummy()` equals true) students.

    - #### getNrRealStudents

          public int getNrRealStudents(boolean precise)

      Number of real (`Student.isDummy()` equals false) students.

    - #### getNrCompleteLastLikeStudents

          public int getNrCompleteLastLikeStudents(boolean precise)

      Number of last like (`Student.isDummy()` equals true) students with a complete schedule (`Student.isComplete()` equals true).

    - #### getNrCompleteRealStudents

          public int getNrCompleteRealStudents(boolean precise)

      Number of real (`Student.isDummy()` equals false) students with a complete schedule (`Student.isComplete()` equals true).

    - #### getNrLastLikeRequests

          public int getNrLastLikeRequests(boolean precise)

      Number of requests from projected (`Student.isDummy()` equals true) students.

    - #### getNrRealRequests

          public int getNrRealRequests(boolean precise)

      Number of requests from real (`Student.isDummy()` equals false) students.

    - #### getNrAssignedLastLikeRequests

          public int getNrAssignedLastLikeRequests(boolean precise)

      Number of requests from projected (`Student.isDummy()` equals true) students that are assigned.

    - #### getNrAssignedRealRequests

          public int getNrAssignedRealRequests(boolean precise)

      Number of requests from real (`Student.isDummy()` equals false) students that are assigned.

    - #### getExtendedInfo

          public Map<String,String> getExtendedInfo()

      Model extended info. Some more information (that is more expensive to compute) is added to an ordinary `Model.getInfo()`.
      Overrides:
        `getExtendedInfo` in class `Model<Request,Enrollment>`

    - #### restoreBest

          public void restoreBest()

      Overrides:
        `restoreBest` in class `Model<Request,Enrollment>`

    - #### toString

          public String toString()

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

    - #### avg

          public double avg(double w1,
                            double w2)

      Quadratic average of two weights.

    - #### add

          public void add(DistanceConflict.Conflict c)

    - #### remove

          public void remove(DistanceConflict.Conflict c)

    - #### add

          public void add(TimeOverlapsCounter.Conflict c)

    - #### remove

          public void remove(TimeOverlapsCounter.Conflict c)

    - #### getMaxDomainSize

          public int getMaxDomainSize()

      Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit.

    - #### setMaxDomainSize

          public void setMaxDomainSize(int maxDomainSize)

      Maximal domain size (i.e., number of enrollments of a course request), -1 if there is no limit.