org.cpsolver.studentsct.online

## Class OnlineSectioningModel

- java.lang.Object
- - org.cpsolver.ifs.model.Model<V,T>
  - - org.cpsolver.ifs.assignment.context.ModelWithContext<Request,Enrollment,StudentSectioningModel.StudentSectioningModelContext>
    - - org.cpsolver.studentsct.StudentSectioningModel
      - - org.cpsolver.studentsct.online.OnlineSectioningModel

- All Implemented Interfaces:
    CanHoldContext, CanInheritContext<Request,Enrollment,StudentSectioningModel.StudentSectioningModelContext>, HasAssignmentContext<Request,Enrollment,StudentSectioningModel.StudentSectioningModelContext>
  Direct Known Subclasses:
    Test.TestModel

      public class OnlineSectioningModel
      extends StudentSectioningModel

  An online model. A simple extension of the `OnlineSectioningModel` class that allows to set the over-expected criterion (see `OverExpectedCriterion`). This class is particularly useful in passing the over-expected criterion to the online sectioning algorithms and heuristics.
  The over-expected criterion can be passed as a constructor parameter, or given using the OverExpectedCriterion.Class parameter. It defaults to `AvoidUnbalancedWhenNoExpectations`.
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 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.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class org.cpsolver.studentsct.StudentSectioningModel

      `StudentSectioningModel.StudentSectioningModelContext`

    - ### Nested classes/interfaces inherited from class org.cpsolver.ifs.assignment.context.ModelWithContext

      `ModelWithContext.ContextUpdateType`

  - ### Field Summary

    - ### Fields inherited from class org.cpsolver.studentsct.StudentSectioningModel

      `iProjectedStudentWeight, sDecimalFormat`

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

      `sDoubleFormat, sPercentageFormat, sTimeFormat`

    - ### Fields inherited from interface org.cpsolver.ifs.assignment.context.CanHoldContext

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `OnlineSectioningModel(DataProperties properties)`
    `OnlineSectioningModel(DataProperties config, OverExpectedCriterion criterion)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getKeepInitialAssignments()` Return true if the inital assignments are to be kept unchanged
    `double` | `getOverExpected(Assignment<Request,Enrollment> assignment, Enrollment[] enrollment, int index, Section section, Request request)` Expectation penalty, to be minimized
    `double` | `getOverExpected(Assignment<Request,Enrollment> assignment, Enrollment selection, Enrollment value, Set<Enrollment> conflicts)` Expectation penalty, to be minimized.
    `double` | `getOverExpected(Assignment<Request,Enrollment> assignment, Section section, Request request)` Expectation penalty, to be minimized (computed using `OverExpectedCriterion.getOverExpected(Assignment, Section, Request)`)
    `OverExpectedCriterion` | `getOverExpectedCriterion()` Get over-expected criterion
    `void` | `setOverExpectedCriterion(OverExpectedCriterion overExpectedCriterion)` Set over-expected criterion

    - ### Methods inherited from class org.cpsolver.studentsct.StudentSectioningModel

      `addLinkedSections, addLinkedSections, addLinkedSections, addLinkedSections, addOffering, addStudent, addVariable, avg, avgNrRequests, avgUnassignPriority, clearOnlineSectioningInfos, computeOnlineSectioningInfos, createAssignmentContext, createInheritedAssignment, getBestAssignedCourseRequestWeight, getDistanceConflict, getDistanceMetric, getExtendedInfo, getInfo, getLinkedSections, getMaxDomainSize, getNbrStudents, getNrAssignedLastLikeRequests, getNrAssignedRealRequests, getNrCompleteLastLikeStudents, getNrCompleteRealStudents, getNrLastLikeRequests, getNrLastLikeStudents, getNrRealRequests, getNrRealStudents, getOfferings, getProperties, getReservationCanAssignOverTheLimit, getStudentQuality, getStudents, getStudentsWithAccommodation, getStudentWeights, getTimeOverlaps, getTotalRequestWeight, getTotalValue, getTotalValue, getUnassignedRequestWeight, inheritAssignmentContext, isMPP, recomputeTotalValue, removeStudent, removeVariable, requestWeightsChanged, restoreBest, saveBest, setDistanceConflict, setMaxDomainSize, setStudentQuality, setStudentQuality, setStudentWeights, setTimeOverlaps, toString`

    - ### Methods inherited from class org.cpsolver.ifs.assignment.context.ModelWithContext

      `afterAssigned, afterUnassigned, beforeAssigned, beforeUnassigned, getAssignmentContextReference, getContext, getContext, getContextUpdateType, setAssignmentContextReference, setContextUpdateType`

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

      `addConstraint, addCriterion, addGlobalConstraint, addModelListener, afterAssigned, afterUnassigned, assignedVariables, assignedVariables, beforeAssigned, beforeUnassigned, bestUnassignedVariables, bestUnassignedVariables, clearAssignmentContexts, clearBest, conflictConstraints, conflictValues, conflictValues, constraints, countConstraints, countGlobalConstraints, countVariables, createAssignmentContexts, createReference, getBestPerturbations, getBestUnassignedVariables, getBestValue, getCriteria, getCriterion, getDefaultAssignment, getEmptyAssignment, getExtendedInfo, getInfo, getInfo, getInfo, getInfoProviders, getModelListeners, getPerc, getPercRev, getTotalValue, getTotalValue, getTotalValue, globalConstraints, inConflict, inConflict, init, invalidateVariablesWithInitialValueCache, modelListenerOfType, nrAssignedVariables, nrAssignedVariables, nrUnassignedVariables, nrUnassignedVariables, perturbVariables, perturbVariables, perturbVariables, perturbVariables, removeConstraint, removeCriterion, removeCriterion, removeGlobalConstraint, removeModelListener, removeReference, restoreBest, restoreBest, saveBest, setBestValue, setDefaultAssignment, toString, unassignedHardConstraints, unassignedVariables, unassignedVariables, variables, variablesWithInitialValue, weaken`

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

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

- - ### Constructor Detail

    - #### OnlineSectioningModel

          public OnlineSectioningModel(DataProperties properties)

    - #### OnlineSectioningModel

          public OnlineSectioningModel(DataProperties config,
                                       OverExpectedCriterion criterion)

  - ### Method Detail

    - #### getKeepInitialAssignments

          public boolean getKeepInitialAssignments()

      Description copied from class: `StudentSectioningModel`
      Return true if the inital assignments are to be kept unchanged
      Overrides:
        `getKeepInitialAssignments` in class `StudentSectioningModel`
      Returns:
        true if the initial assignments are to be kept at all cost

    - #### getOverExpectedCriterion

          public OverExpectedCriterion getOverExpectedCriterion()

      Get over-expected criterion
      Returns:
        over-expected criterion

    - #### setOverExpectedCriterion

          public void setOverExpectedCriterion(OverExpectedCriterion overExpectedCriterion)

      Set over-expected criterion
      Parameters:
        `overExpectedCriterion` - over-expected criterion

    - #### getOverExpected

          public double getOverExpected(Assignment<Request,Enrollment> assignment,
                                        Section section,
                                        Request request)

      Expectation penalty, to be minimized (computed using `OverExpectedCriterion.getOverExpected(Assignment, Section, Request)`)
      Parameters:
        `assignment` - current assignment
        `section` - section in question
        `request` - student course request
      Returns:
        expectation penalty (typically 1.0 / number of subparts when over-expected, 0.0 otherwise)

    - #### getOverExpected

          public double getOverExpected(Assignment<Request,Enrollment> assignment,
                                        Enrollment[] enrollment,
                                        int index,
                                        Section section,
                                        Request request)

      Expectation penalty, to be minimized
      Parameters:
        `assignment` - current assignment
        `enrollment` - current enrollment of the student
        `index` - only use enrollments 0 .. index - 1 from the assignment array
        `section` - section in question
        `request` - student course request
      Returns:
        expectation penalty (typically 1.0 / number of subparts when over-expected, 0.0 otherwise)

    - #### getOverExpected

          public double getOverExpected(Assignment<Request,Enrollment> assignment,
                                        Enrollment selection,
                                        Enrollment value,
                                        Set<Enrollment> conflicts)

      Expectation penalty, to be minimized. A variant of the `OverExpectedCriterion.getOverExpected(Assignment, Section, Request)` method that can be called from `Constraint.computeConflicts(Assignment, Value, Set)`.
      Parameters:
        `assignment` - current assignment
        `selection` - selected enrollment question
        `value` - an enrollment to be assigned
        `conflicts` - enrollments that have been already identified as conflicting
      Returns:
        expectation penalty (typically 1.0 / number of subparts when over-expected, 0.0 otherwise)