org.cpsolver.studentsct.model

## Class Config

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.AbstractClassWithContext<Request,Enrollment,Config.ConfigContext>
  - - org.cpsolver.studentsct.model.Config

- All Implemented Interfaces:
    CanHoldContext, CanInheritContext<Request,Enrollment,Config.ConfigContext>, HasAssignmentContext<Request,Enrollment,Config.ConfigContext>
  Direct Known Subclasses:
    OnlineConfig

      public class Config
      extends AbstractClassWithContext<Request,Enrollment,Config.ConfigContext>
      implements CanInheritContext<Request,Enrollment,Config.ConfigContext>

  Representation of a configuration of an offering. A configuration contains id, name, an offering and a list of subparts.
  Each instructional offering (see `Offering`) contains one or more configurations. Each configuration contain one or more subparts. Each student has to take a class of each subpart of one of the possible configurations.
  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/.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `Config.ConfigContext`

  - ### Field Summary

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

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Config(long id, int limit, String name, Offering offering)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `clearReservationCache()` Clear reservation information that was cached on this configuration or below
    `Config.ConfigContext` | `createAssignmentContext(Assignment<Request,Enrollment> assignment)` Create a new assignment context for the given assignment.
    `boolean` | `equals(Object o)`
    `List<Reservation>` | `getConfigReservations()` Get reservations that require this configuration
    `Float` | `getCreditValue()` Sum of subpart credit of this config return config credit value
    `Set<Enrollment>` | `getEnrollments(Assignment<Request,Enrollment> assignment)` Set of assigned enrollments
    `double` | `getEnrollmentTotalWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)` Enrollment weight including over the limit enrollments.
    `double` | `getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)` Enrollment weight -- weight of all requests which have an enrollment that contains this config, excluding the given one.
    `long` | `getId()` Configuration id
    `Long` | `getInstructionalMethodId()` Return instructional method id
    `String` | `getInstructionalMethodName()` Return instructional method name
    `String` | `getInstructionalMethodReference()` Return instructional method reference
    `int` | `getLimit()` Configuration limit.
    `double` | `getMaxEnrollmentWeight(Assignment<Request,Enrollment> assignment)` Maximal weight of a single enrollment in the config
    `double` | `getMaxPenalty()` Average maximal penalty from `Subpart.getMaxPenalty()`
    `double` | `getMinEnrollmentWeight(Assignment<Request,Enrollment> assignment)` Minimal weight of a single enrollment in the config
    `double` | `getMinPenalty()` Average minimal penalty from `Subpart.getMinPenalty()`
    `Model<Request,Enrollment>` | `getModel()` Get the model.
    `String` | `getName()` Configuration name
    `int` | `getNrArrHours()`
    `int` | `getNrOnline()`
    `int` | `getNrPast()`
    `Offering` | `getOffering()` Instructional offering to which this configuration belongs.
    `List<Reservation>` | `getReservations()` Get reservations for this configuration
    `List<Subpart>` | `getSubparts()` List of subparts
    `double` | `getTotalUnreservedSpace()` Total space in the configuration that cannot be reserved by any config reservation
    `double` | `getUnreservedSpace(Assignment<Request,Enrollment> assignment, Request excludeRequest)` Available space in the configuration that is not reserved by any config reservation
    `boolean` | `hasCreditValue()` True if at least one subpart of this config has a credit value set
    `int` | `hashCode()`
    `Config.ConfigContext` | `inheritAssignmentContext(Assignment<Request,Enrollment> assignment, Config.ConfigContext parentContext)` Create a new assignment context for the given assignment.
    `void` | `setInstructionalMethodId(Long instrMethodId)` Set instructional method id
    `void` | `setInstructionalMethodName(String instrMethodName)` Set instructional method name
    `void` | `setInstructionalMethodReference(String instrMethodReference)` Set instructional method reference
    `void` | `setLimit(int limit)` Set configuration limit
    `String` | `toString()`

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

      `getAssignmentContextReference, getContext, getContext, setAssignmentContextReference`

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

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

- - ### Constructor Detail

    - #### Config

          public Config(long id,
                        int limit,
                        String name,
                        Offering offering)

      Constructor
      Parameters:
        `id` - instructional offering configuration unique id
        `limit` - configuration limit (-1 for unlimited)
        `name` - configuration name
        `offering` - instructional offering to which this configuration belongs

  - ### Method Detail

    - #### getId

          public long getId()

      Configuration id
      Returns:
        instructional offering configuration unique id

    - #### getLimit

          public int getLimit()

      Configuration limit. This is defines the maximal number of students that can be enrolled into this configuration at the same time. It is -1 in the case of an unlimited configuration
      Returns:
        configuration limit

    - #### setLimit

          public void setLimit(int limit)

      Set configuration limit
      Parameters:
        `limit` - configuration limit, -1 if unlimited

    - #### getName

          public String getName()

      Configuration name
      Returns:
        configuration name

    - #### getOffering

          public Offering getOffering()

      Instructional offering to which this configuration belongs.
      Returns:
        instructional offering

    - #### getSubparts

          public List<Subpart> getSubparts()

      List of subparts
      Returns:
        scheduling subparts

    - #### getInstructionalMethodId

          public Long getInstructionalMethodId()

      Return instructional method id
      Returns:
        instructional method id

    - #### setInstructionalMethodId

          public void setInstructionalMethodId(Long instrMethodId)

      Set instructional method id
      Parameters:
        `instrMethodId` - instructional method id

    - #### getInstructionalMethodName

          public String getInstructionalMethodName()

      Return instructional method name
      Returns:
        instructional method name

    - #### setInstructionalMethodName

          public void setInstructionalMethodName(String instrMethodName)

      Set instructional method name
      Parameters:
        `instrMethodName` - instructional method name

    - #### getInstructionalMethodReference

          public String getInstructionalMethodReference()

      Return instructional method reference
      Returns:
        instructional method reference

    - #### setInstructionalMethodReference

          public void setInstructionalMethodReference(String instrMethodReference)

      Set instructional method reference
      Parameters:
        `instrMethodReference` - instructional method reference

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getMinPenalty

          public double getMinPenalty()

      Average minimal penalty from `Subpart.getMinPenalty()`
      Returns:
        minimal penalty

    - #### getMaxPenalty

          public double getMaxPenalty()

      Average maximal penalty from `Subpart.getMaxPenalty()`
      Returns:
        maximal penalty

    - #### getUnreservedSpace

          public double getUnreservedSpace(Assignment<Request,Enrollment> assignment,
                                           Request excludeRequest)

      Available space in the configuration that is not reserved by any config reservation
      Parameters:
        `assignment` - current assignment
        `excludeRequest` - excluding given request (if not null)
      Returns:
        available space

    - #### getTotalUnreservedSpace

          public double getTotalUnreservedSpace()

      Total space in the configuration that cannot be reserved by any config reservation
      Returns:
        total unreserved space

    - #### getReservations

          public List<Reservation> getReservations()

      Get reservations for this configuration
      Returns:
        related reservations

    - #### getConfigReservations

          public List<Reservation> getConfigReservations()

      Get reservations that require this configuration
      Returns:
        related reservations

    - #### clearReservationCache

          public void clearReservationCache()

      Clear reservation information that was cached on this configuration or below

    - #### equals

          public boolean equals(Object o)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### getModel

          public Model<Request,Enrollment> getModel()

      Description copied from class: `AbstractClassWithContext`
      Get the model. This is used to create an assignment context if needed.
      Specified by:
        `getModel` in class `AbstractClassWithContext<Request,Enrollment,Config.ConfigContext>`
      Returns:
        model

    - #### getEnrollments

          public Set<Enrollment> getEnrollments(Assignment<Request,Enrollment> assignment)

      Set of assigned enrollments
      Parameters:
        `assignment` - current assignment
      Returns:
        enrollments in this configuration

    - #### getEnrollmentWeight

          public double getEnrollmentWeight(Assignment<Request,Enrollment> assignment,
                                            Request excludeRequest)

      Enrollment weight -- weight of all requests which have an enrollment that contains this config, excluding the given one. See `Request.getWeight()`.
      Parameters:
        `assignment` - current assignment
        `excludeRequest` - request to exclude, null if all requests are to be included
      Returns:
        enrollment weight

    - #### getEnrollmentTotalWeight

          public double getEnrollmentTotalWeight(Assignment<Request,Enrollment> assignment,
                                                 Request excludeRequest)

      Enrollment weight including over the limit enrollments. That is enrollments that have reservation with `Reservation.canBatchAssignOverLimit()` set to true. `Request.getWeight()`.
      Parameters:
        `assignment` - current assignment
        `excludeRequest` - request to exclude, null if all requests are to be included
      Returns:
        enrollment weight

    - #### getMaxEnrollmentWeight

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

      Maximal weight of a single enrollment in the config
      Parameters:
        `assignment` - current assignment
      Returns:
        maximal enrollment weight

    - #### getMinEnrollmentWeight

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

      Minimal weight of a single enrollment in the config
      Parameters:
        `assignment` - current assignment
      Returns:
        minimal enrollment weight

    - #### createAssignmentContext

          public Config.ConfigContext createAssignmentContext(Assignment<Request,Enrollment> assignment)

      Description copied from interface: `HasAssignmentContext`
      Create a new assignment context for the given assignment. If there are already some variables assigned in the value, the method should make sure that the context is appropriately initialized.
      Specified by:
        `createAssignmentContext` in interface `HasAssignmentContext<Request,Enrollment,Config.ConfigContext>`
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
      Returns:
        a new instance of the assignment context, filled according to the given assignment

    - #### inheritAssignmentContext

          public Config.ConfigContext inheritAssignmentContext(Assignment<Request,Enrollment> assignment,
                                                               Config.ConfigContext parentContext)

      Description copied from interface: `CanInheritContext`
      Create a new assignment context for the given assignment. This method can be used to clone the parent context if desired.
      Specified by:
        `inheritAssignmentContext` in interface `CanInheritContext<Request,Enrollment,Config.ConfigContext>`
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
        `parentContext` - context of the parent assignment
      Returns:
        a new instance of the assignment context, filled according to the given assignment

    - #### hasCreditValue

          public boolean hasCreditValue()

      True if at least one subpart of this config has a credit value set
      Returns:
        true if a there is a subpart credit

    - #### getCreditValue

          public Float getCreditValue()

      Sum of subpart credit of this config return config credit value

    - #### getNrOnline

          public int getNrOnline()

    - #### getNrArrHours

          public int getNrArrHours()

    - #### getNrPast

          public int getNrPast()