org.cpsolver.coursett.criteria.additional

## Class InstructorFairness.InstructorFairnessContext

- java.lang.Object
- - org.cpsolver.ifs.criteria.AbstractCriterion.ValueContext
  - - org.cpsolver.coursett.criteria.additional.InstructorFairness.InstructorFairnessContext

- All Implemented Interfaces:
    AssignmentContext
  Enclosing class:
    InstructorFairness

      public class InstructorFairness.InstructorFairnessContext
      extends AbstractCriterion.ValueContext

  Context for InstructorFairness

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `InstructorFairness.InstructorFairnessContext.Instructor` Class representing instructor

  - ### Field Summary

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

      `iTotal`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `InstructorFairnessContext(Assignment<Lecture,Placement> assignment)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `addInstructorValue(Long insID, double value)` adding value to instructor in stringInstMap
    `boolean` | `allInstructorsAssigned(Assignment<Lecture,Placement> assignment)` Return if complete solution (all variables assigned) was found in this context
    `protected void` | `assigned(Assignment<Lecture,Placement> assignment, Placement value)` Update value when assigned
    `void` | `countInstrMeanFairValue()` compute and return mean fair value of instructors in iId2Instructor
    `void` | `countInstructorAssignedFair(Assignment<Lecture,Placement> assignment, Placement value)` Method actualize values of instructors whose lecture was just assigned
    `boolean` | `countInstructorFair(Assignment<Lecture,Placement> assignment)` This method set fairness values to all instructors
    `void` | `countInstructorUnassignedFair(Assignment<Lecture,Placement> assignment, Placement value)` Method actualize values of instructors whose lecture will be unassigned
    `boolean` | `decreaseInstructorValue(Long insID, double value)` adding value to instructor in stringInstMap
    `double` | `fairnessDouble(Assignment<Lecture,Placement> assignment, Placement placement)` Metod count and return time (and room) preferences in placement
    `double` | `getDiffAllInstrValueSquared()` fairness value with squared P and avg.P
    `double` | `getDiffInstrValue(List<InstructorConstraint> instructorsList, double placementValue)` Method estimates value of placement for instructors in entry list
    `double` | `getInstrMeanFairValue()`
    `Collection<InstructorFairness.InstructorFairnessContext.Instructor>` | `getInstructorsWithAssig()`
    `int` | `getNumOfIstructors()`
    `double` | `getObjectiveValue()` Fairness value based on pdev (pdev sec. part) of all instructors
    `double` | `getObjectiveValue(Collection<InstructorConstraint> instructors)` Fairness value based on pdev (pdev sec. part) of instructors
    `boolean` | `isFirstIterDone()`
    `void` | `refreshInstructors()` refresh of all instructors in iId2Instructor
    `void` | `setFirstIterDone()` set first iteration done to true
    `String[]` | `testFairness(Assignment<Lecture,Placement> assignment)` Method for whole evaluation of fairness criteria
    `protected void` | `unassigned(Assignment<Lecture,Placement> assignment, Placement value)` Update value when unassigned

    - ### 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

    - #### InstructorFairnessContext

          public InstructorFairnessContext(Assignment<Lecture,Placement> assignment)

      Parameters:
        `assignment` - current assignment

  - ### Method Detail

    - #### 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

    - #### 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

    - #### countInstructorFair

          public boolean countInstructorFair(Assignment<Lecture,Placement> assignment)

      This method set fairness values to all instructors
      Parameters:
        `assignment` -
      Returns:
        false if complete solution wasn't found

    - #### countInstructorAssignedFair

          public void countInstructorAssignedFair(Assignment<Lecture,Placement> assignment,
                                                  Placement value)

      Method actualize values of instructors whose lecture was just assigned
      Parameters:
        `assignment` -
        `value` - placement of lecture

    - #### countInstructorUnassignedFair

          public void countInstructorUnassignedFair(Assignment<Lecture,Placement> assignment,
                                                    Placement value)

      Method actualize values of instructors whose lecture will be unassigned
      Parameters:
        `assignment` -
        `value` - placement of lecture

    - #### getInstrMeanFairValue

          public double getInstrMeanFairValue()

      Returns:
        instructor mean fair value

    - #### isFirstIterDone

          public boolean isFirstIterDone()

      Returns:
        if first iteration was done

    - #### setFirstIterDone

          public void setFirstIterDone()

      set first iteration done to true

    - #### getNumOfIstructors

          public int getNumOfIstructors()

      Returns:
        number of instructors

    - #### getInstructorsWithAssig

          public Collection<InstructorFairness.InstructorFairnessContext.Instructor> getInstructorsWithAssig()

      Returns:
        Collection of instructors in context

    - #### allInstructorsAssigned

          public boolean allInstructorsAssigned(Assignment<Lecture,Placement> assignment)

      Return if complete solution (all variables assigned) was found in this context
      Parameters:
        `assignment` -
      Returns:
        true if in this context were all variables assigned false otherwise

    - #### addInstructorValue

          public boolean addInstructorValue(Long insID,
                                            double value)

      adding value to instructor in stringInstMap
      Parameters:
        `insID` - instructor ID
        `value` - that should be added
      Returns:
        false if instructor is not in iId2Instructor

    - #### decreaseInstructorValue

          public boolean decreaseInstructorValue(Long insID,
                                                 double value)

      adding value to instructor in stringInstMap
      Parameters:
        `insID` - instructor ID
        `value` - value that should be subtracted
      Returns:
        false if instructor is not iId2Instructor

    - #### countInstrMeanFairValue

          public void countInstrMeanFairValue()

      compute and return mean fair value of instructors in iId2Instructor

    - #### getDiffInstrValue

          public double getDiffInstrValue(List<InstructorConstraint> instructorsList,
                                          double placementValue)

      Method estimates value of placement for instructors in entry list
      Parameters:
        `instructorsList` -
        `placementValue` -
      Returns:
        estimated value of placement for instructors in entry list

    - #### getObjectiveValue

          public double getObjectiveValue()

      Fairness value based on pdev (pdev sec. part) of all instructors
      Returns:
        Objective value of all instructors

    - #### getObjectiveValue

          public double getObjectiveValue(Collection<InstructorConstraint> instructors)

      Fairness value based on pdev (pdev sec. part) of instructors
      Parameters:
        `instructors` -
      Returns:
        Objective value of instructors

    - #### getDiffAllInstrValueSquared

          public double getDiffAllInstrValueSquared()

      fairness value with squared P and avg.P
      Returns:
        fairness value with squared P and avg.P

    - #### refreshInstructors

          public void refreshInstructors()

      refresh of all instructors in iId2Instructor

    - #### fairnessDouble

          public double fairnessDouble(Assignment<Lecture,Placement> assignment,
                                       Placement placement)

      Metod count and return time (and room) preferences in placement
      Parameters:
        `assignment` -
        `placement` -
      Returns:
        time (and room) preferences in placement

    - #### testFairness

          public String[] testFairness(Assignment<Lecture,Placement> assignment)

      Method for whole evaluation of fairness criteria
      Parameters:
        `assignment` -
      Returns:
        String[] with informations about solution [0-Avarage instructor penalty, 1-Sum of squared penalities, 2-Pmax, 3-Pdev, 4-Perror, 5-Pss, 6-Jain, 7-worst instructor fairness value,8-Instructors fairness value]