org.cpsolver.coursett.criteria.additional

## Class InstructorLunchBreak.InstructorLunchBreakContext

- java.lang.Object
- - org.cpsolver.ifs.criteria.AbstractCriterion.ValueContext
  - - org.cpsolver.coursett.criteria.additional.InstructorLunchBreak.InstructorLunchBreakContext

- All Implemented Interfaces:
    AssignmentContext
  Enclosing class:
    InstructorLunchBreak

      public class InstructorLunchBreak.InstructorLunchBreakContext
      extends AbstractCriterion.ValueContext

- - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.criteria.AbstractCriterion.ValueContext

      `iTotal`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `InstructorLunchBreakContext(Assignment<Lecture,Placement> assignment)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `assigned(Assignment<Lecture,Placement> assignment, Placement value)` Update value when assigned
    `double` | `computeLunchPenalty(Assignment<Lecture,Placement> assignment, InstructorConstraint constraint)` Method computes number of violations in days (Mo, Tue, Wed,..) considering each week in the semester separately.
    `protected InstructorLunchBreak.CompactInfo` | `getCompactInfo(InstructorConstraint constraint)` Get compact info that is associated with an instructor constraint.
    `protected void` | `unassigned(Assignment<Lecture,Placement> assignment, Placement value)` Update value when unassigned
    `void` | `updateCriterion(Assignment<Lecture,Placement> assignment, InstructorConstraint instructorConstraint, Placement placement)` Method checks or sets the CompactInfo of an InstructorConstraint.
    `void` | `updateLunchPenalty(Assignment<Lecture,Placement> assignment, InstructorConstraint constraint, Placement p)` Method updates number of violations in days (Mo, Tue, Wed,..) considering each week in the semester separately.

    - ### Methods inherited from class org.cpsolver.ifs.criteria.AbstractCriterion.ValueContext

      `getBounds, getTotal, inc, setBounds, setTotal`

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

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

- - ### Constructor Detail

    - #### InstructorLunchBreakContext

          protected InstructorLunchBreakContext(Assignment<Lecture,Placement> assignment)

  - ### Method Detail

    - #### unassigned

          protected void unassigned(Assignment<Lecture,Placement> assignment,
                                    Placement value)

      Description copied from class: `AbstractCriterion.ValueContext`
      Update value when unassigned
      Overrides:
        `unassigned` in class `AbstractCriterion.ValueContext`
      Parameters:
        `assignment` - current assignment
        `value` - recently unassigned value

    - #### assigned

          protected void assigned(Assignment<Lecture,Placement> assignment,
                                  Placement value)

      Description copied from class: `AbstractCriterion.ValueContext`
      Update value when assigned
      Overrides:
        `assigned` in class `AbstractCriterion.ValueContext`
      Parameters:
        `assignment` - current assignment
        `value` - recently assigned value

    - #### updateCriterion

          public void updateCriterion(Assignment<Lecture,Placement> assignment,
                                      InstructorConstraint instructorConstraint,
                                      Placement placement)

      Method checks or sets the CompactInfo of an InstructorConstraint. It updates the preference of chosen criteria. The update consists of decrementing the criterion value by previous preference, finding the current preference and incrementing the criterion value by the current preference.
      Parameters:
        `assignment` - current assignment
        `instructorConstraint` - the Instructor constraint of an instructor checked for criteria
        `placement` - placement of a lecture currently (un)assigned

    - #### getCompactInfo

          protected InstructorLunchBreak.CompactInfo getCompactInfo(InstructorConstraint constraint)

      Get compact info that is associated with an instructor constraint. Create a new one if none has been created yet.
      Parameters:
        `constraint` - instructor constraint
      Returns:
        compact info for the given constraint

    - #### updateLunchPenalty

          public void updateLunchPenalty(Assignment<Lecture,Placement> assignment,
                                         InstructorConstraint constraint,
                                         Placement p)

      Method updates number of violations in days (Mo, Tue, Wed,..) considering each week in the semester separately. The current number of violations for a day is stored in the CompactInfo.lunchDayViolations of the constraint, which must be set properly before the calling of the method.
      Parameters:
        `assignment` - current assignment
        `constraint` - the Instructor constraint of an instructor checked for a lunch break
        `p` - placement of a lecture currently (un)assigned

    - #### computeLunchPenalty

          public double computeLunchPenalty(Assignment<Lecture,Placement> assignment,
                                            InstructorConstraint constraint)

      Method computes number of violations in days (Mo, Tue, Wed,..) considering each week in the semester separately. Updates the compact infos accordingly.
      Parameters:
        `assignment` - current assignment
        `constraint` - instructor constraint
      Returns:
        current penalty for the given instructor