org.cpsolver.studentsct.model

## Class RequestGroup.RequestGroupContext

- java.lang.Object
- - org.cpsolver.studentsct.model.RequestGroup.RequestGroupContext

- All Implemented Interfaces:
    AssignmentConstraintContext<Request,Enrollment>, AssignmentContext
  Enclosing class:
    RequestGroup

      public class RequestGroup.RequestGroupContext
      extends Object
      implements AssignmentConstraintContext<Request,Enrollment>

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `RequestGroupContext(Assignment<Request,Enrollment> assignment)`
    `RequestGroupContext(RequestGroup.RequestGroupContext parent)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Called when an enrollment is assigned to a request of this request group
    `double` | `getAverageSpread()` Return average section spread of this group.
    `Set<Enrollment>` | `getEnrollments()` Set of assigned enrollments
    `double` | `getEnrollmentSpread(Assignment<Request,Enrollment> assignment, Enrollment enrollment, double bestRatio, double fillRatio)` Return how much is the given enrollment (which is not part of the request group) creating an issue for this request group
    `double` | `getEnrollmentWeight(Assignment<Request,Enrollment> assignment, Request excludeRequest)` Enrollment weight -- weight of all requests which have an enrollment that is of this request group, excluding the given one.
    `double` | `getSectionSpread(Section section)` Return section spread of this group.
    `double` | `getSectionWeight(Assignment<Request,Enrollment> assignment, Section section, Request excludeRequest)` Section weight -- weight of all requests which have an enrollment that is of this request group and that includes the given section, excluding the given one.
    `void` | `unassigned(Assignment<Request,Enrollment> assignment, Enrollment enrollment)` Called when an enrollment is unassigned from a request of this request group

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

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

- - ### Constructor Detail

    - #### RequestGroupContext

          public RequestGroupContext(Assignment<Request,Enrollment> assignment)

    - #### RequestGroupContext

          public RequestGroupContext(RequestGroup.RequestGroupContext parent)

  - ### Method Detail

    - #### assigned

          public void assigned(Assignment<Request,Enrollment> assignment,
                               Enrollment enrollment)

      Called when an enrollment is assigned to a request of this request group
      Specified by:
        `assigned` in interface `AssignmentConstraintContext<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `enrollment` - assigned value

    - #### unassigned

          public void unassigned(Assignment<Request,Enrollment> assignment,
                                 Enrollment enrollment)

      Called when an enrollment is unassigned from a request of this request group
      Specified by:
        `unassigned` in interface `AssignmentConstraintContext<Request,Enrollment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `enrollment` - unassigned value

    - #### getEnrollments

          public Set<Enrollment> getEnrollments()

      Set of assigned enrollments
      Returns:
        assigned enrollments of this request group

    - #### getEnrollmentWeight

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

      Enrollment weight -- weight of all requests which have an enrollment that is of this request group, excluding the given one. See `Request.getWeight()`.
      Parameters:
        `assignment` - current assignment
        `excludeRequest` - course request to ignore, if any
      Returns:
        enrollment weight

    - #### getSectionWeight

          public double getSectionWeight(Assignment<Request,Enrollment> assignment,
                                         Section section,
                                         Request excludeRequest)

      Section weight -- weight of all requests which have an enrollment that is of this request group and that includes the given section, excluding the given one. See `Request.getWeight()`.
      Parameters:
        `assignment` - current assignment
        `section` - section in question
        `excludeRequest` - course request to ignore, if any
      Returns:
        enrollment weight

    - #### getEnrollmentSpread

          public double getEnrollmentSpread(Assignment<Request,Enrollment> assignment,
                                            Enrollment enrollment,
                                            double bestRatio,
                                            double fillRatio)

      Return how much is the given enrollment (which is not part of the request group) creating an issue for this request group
      Parameters:
        `assignment` - current assignment
        `enrollment` - enrollment in question
        `bestRatio` - how much of the weight should be used on estimation of the enrollment potential (considering that students of this group that are not yet enrolled can take the same enrollment)
        `fillRatio` - how much of the weight should be used in estimation how well are the sections of this enrollments going to be filled (bestRatio + fillRatio <= 1.0)
      Returns:
        1.0 if all enrollments have the same sections as the given one, 0.0 if there is no match at all

    - #### getAverageSpread

          public double getAverageSpread()

      Return average section spread of this group. It reflects the probability of two students of this group being enrolled in the same section.
      Returns:
        1.0 if all enrollments have the same sections as the given one, 0.0 if there is no match at all

    - #### getSectionSpread

          public double getSectionSpread(Section section)

      Return section spread of this group. It reflects the probability of two students of this group being enrolled in this section.
      Parameters:
        `section` - given section
      Returns:
        1.0 if all enrollments have the same sections as the given one, 0.0 if there is no match at all