org.cpsolver.instructor.model

## Class Instructor.Context

- java.lang.Object
- - org.cpsolver.instructor.model.Instructor.Context

- All Implemented Interfaces:
    AssignmentConstraintContext<TeachingRequest.Variable,TeachingAssignment>, AssignmentContext
  Enclosing class:
    Instructor

      public class Instructor.Context
      extends Object
      implements AssignmentConstraintContext<TeachingRequest.Variable,TeachingAssignment>

  Instructor Constraint Context. It keeps the list of current assignments of an instructor.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Context(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Constructor
    `Context(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, Instructor.Context parentContext)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assigned(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value)` Called when `ConstraintWithContext.assigned(Assignment, long, Value)` is called to update the content of the context.
    `int` | `countAssignmentsWithTime()` Number of teaching assignments that have a time assignment of this instructor
    `double` | `countBackToBackPercentage()` Current back-to-back percentage for this instructor
    `double` | `countBackToBackPreference(double diffRoomWeight, double diffTypeWeight)` Current back-to-back preference of the instructor (using `TeachingRequest.countBackToBacks(TeachingRequest, double, double)`)
    `double` | `countDifferentLectures()` Percentage of common sections that are not same for the instructor (using `TeachingRequest.nrSameLectures(TeachingRequest)`)
    `double` | `countDistributions(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)` Compute distributions penalty between all classes assigned to this instructor
    `double` | `countSameCommonPenalty()` Compute same common penalty between all requests of this instructor
    `double` | `countSameCoursePenalty()` Compute same course penalty between all requests of this instructor
    `double` | `countSameDaysPercentage()` Current same days percentage for this instructor
    `double` | `countSameDaysPreference(double diffRoomWeight, double diffTypeWeight)` Current same days preference of the instructor (using `TeachingRequest.countSameDays(TeachingRequest, double, double)`)
    `double` | `countSameRoomPercentage()` Current same room percentage for this instructor
    `double` | `countSameRoomPreference(double diffTypeWeight)` Current same room preference of the instructor (using `TeachingRequest.countSameRooms(TeachingRequest, double)`)
    `int` | `countTimeOverlaps()` If there are classes that allow for overlap, the number of such overlapping slots of this instructor
    `Set<TeachingAssignment>` | `getAssignments()` Current assignments of this instructor
    `Instructor` | `getInstructor()` Instructor
    `float` | `getLoad()` Current load of this instructor
    `float` | `getUnusedLoad()` Current unused load of this instructor
    `void` | `unassigned(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment, TeachingAssignment value)` Called when `ConstraintWithContext.unassigned(Assignment, long, Value)` is called to update the content of the context.

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

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

- - ### Constructor Detail

    - #### Context

          public Context(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Constructor
      Parameters:
        `assignment` - current assignment

    - #### Context

          public Context(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
                         Instructor.Context parentContext)

      Constructor
      Parameters:
        `assignment` - current assignment
        `parentContext` - parent context

  - ### Method Detail

    - #### getInstructor

          public Instructor getInstructor()

      Instructor
      Returns:
        instructor of this context

    - #### assigned

          public void assigned(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
                               TeachingAssignment value)

      Description copied from interface: `AssignmentConstraintContext`
      Called when `ConstraintWithContext.assigned(Assignment, long, Value)` is called to update the content of the context.
      Specified by:
        `assigned` in interface `AssignmentConstraintContext<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `value` - assigned value

    - #### unassigned

          public void unassigned(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment,
                                 TeachingAssignment value)

      Description copied from interface: `AssignmentConstraintContext`
      Called when `ConstraintWithContext.unassigned(Assignment, long, Value)` is called to update the content of the context.
      Specified by:
        `unassigned` in interface `AssignmentConstraintContext<TeachingRequest.Variable,TeachingAssignment>`
      Parameters:
        `assignment` - current assignment (with which this context is associated)
        `value` - unassigned value

    - #### getAssignments

          public Set<TeachingAssignment> getAssignments()

      Current assignments of this instructor
      Returns:
        current teaching assignments

    - #### getLoad

          public float getLoad()

      Current load of this instructor
      Returns:
        current load

    - #### getUnusedLoad

          public float getUnusedLoad()

      Current unused load of this instructor
      Returns:
        zero if the instructor is not being used, difference between `Instructor.getMaxLoad()` and `getLoad()` otherwise

    - #### countTimeOverlaps

          public int countTimeOverlaps()

      If there are classes that allow for overlap, the number of such overlapping slots of this instructor
      Returns:
        current time overlaps (number of overlapping slots)

    - #### countAssignmentsWithTime

          public int countAssignmentsWithTime()

      Number of teaching assignments that have a time assignment of this instructor
      Returns:
        current number of teaching assignments that have a time

    - #### countDifferentLectures

          public double countDifferentLectures()

      Percentage of common sections that are not same for the instructor (using `TeachingRequest.nrSameLectures(TeachingRequest)`)
      Returns:
        percentage of pairs of common sections that are not the same

    - #### countBackToBackPreference

          public double countBackToBackPreference(double diffRoomWeight,
                                                  double diffTypeWeight)

      Current back-to-back preference of the instructor (using `TeachingRequest.countBackToBacks(TeachingRequest, double, double)`)
      Parameters:
        `diffRoomWeight` - different room weight
        `diffTypeWeight` - different instructional type weight
      Returns:
        current back-to-back preference

    - #### countBackToBackPercentage

          public double countBackToBackPercentage()

      Current back-to-back percentage for this instructor
      Returns:
        percentage of assignments that are back-to-back

    - #### countSameDaysPreference

          public double countSameDaysPreference(double diffRoomWeight,
                                                double diffTypeWeight)

      Current same days preference of the instructor (using `TeachingRequest.countSameDays(TeachingRequest, double, double)`)
      Parameters:
        `diffRoomWeight` - different room weight
        `diffTypeWeight` - different instructional type weight
      Returns:
        current same days preference

    - #### countSameDaysPercentage

          public double countSameDaysPercentage()

      Current same days percentage for this instructor
      Returns:
        percentage of assignments that are back-to-back

    - #### countSameRoomPreference

          public double countSameRoomPreference(double diffTypeWeight)

      Current same room preference of the instructor (using `TeachingRequest.countSameRooms(TeachingRequest, double)`)
      Parameters:
        `diffTypeWeight` - different instructional type weight
      Returns:
        current same room preference

    - #### countSameRoomPercentage

          public double countSameRoomPercentage()

      Current same room percentage for this instructor
      Returns:
        percentage of assignments that are back-to-back

    - #### countSameCoursePenalty

          public double countSameCoursePenalty()

      Compute same course penalty between all requests of this instructor
      Returns:
        same course penalty

    - #### countSameCommonPenalty

          public double countSameCommonPenalty()

      Compute same common penalty between all requests of this instructor
      Returns:
        same common penalty

    - #### countDistributions

          public double countDistributions(Assignment<TeachingRequest.Variable,TeachingAssignment> assignment)

      Compute distributions penalty between all classes assigned to this instructor