org.cpsolver.exam.criteria

## Class ExamCriterion

- java.lang.Object
- - org.cpsolver.ifs.criteria.AbstractCriterion<Exam,ExamPlacement>
  - - org.cpsolver.exam.criteria.ExamCriterion

- All Implemented Interfaces:
    CanHoldContext, HasAssignmentContext<Exam,ExamPlacement,AbstractCriterion.ValueContext>, Criterion<Exam,ExamPlacement>, ExtendedInfoProvider<Exam,ExamPlacement>, InfoProvider<Exam,ExamPlacement>, ModelListener<Exam,ExamPlacement>
  Direct Known Subclasses:
    DistanceToStronglyPreferredRoom, DistributionPenalty, DistributionViolation, ExamRotationPenalty, ExamSplitter, LargeExamsPenalty, PeriodIndexPenalty, PeriodPenalty, PeriodSizePenalty, PeriodViolation, PerturbationPenalty, RoomPenalty, RoomSizePenalty, RoomSplitDistancePenalty, RoomSplitPenalty, RoomViolation, StudentBackToBackConflicts, StudentDirectConflicts, StudentDistanceBackToBackConflicts, StudentMoreThan1ADayConflicts, StudentMoreThan2ADayConflicts

      public abstract class ExamCriterion
      extends AbstractCriterion<Exam,ExamPlacement>

  Abstract examination criterion. All examination criteria are inherited from this criterion.
  Version:
    ExamTT 1.3 (Examination Timetabling)
    Copyright (C) 2008 - 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/interfaces inherited from class org.cpsolver.ifs.criteria.AbstractCriterion

      `AbstractCriterion.ValueContext, AbstractCriterion.ValueUpdateType`

  - ### Field Summary

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

      `iBest, iDebug, iWeight, sDoubleFormat, sPercentFormat`

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

      `sMaxSize`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ExamCriterion()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `double[]` | `getBounds(Assignment<Exam,ExamPlacement> assignment, Collection<Exam> exams)` Value bounds (minimum and maximum) of the criterion on a part of the problem
    `void` | `getInfo(Assignment<Exam,ExamPlacement> assignment, Map<String,String> info)` Adds some information into the table with information about the solution
    `double` | `getPeriodValue(Assignment<Exam,ExamPlacement> assignment, ExamPlacement value)` Return impact of this criterion on period assignment (if this criterion is based on period assignment).
    `double` | `getRoomValue(Assignment<Exam,ExamPlacement> assignment, ExamPlacement value)` Return impact of this criterion on room assignment (if this criterion is based on room assignment).
    `String` | `getWeightName()` Defines weight name (to be used to get the criterion weight from the configuration).
    `void` | `getXmlParameters(Map<String,String> params)` Put all the parameters of this criterion into a map that is used to write parameters section of the examination XML file.
    `String` | `getXmlWeightName()` Name of the weight parameter in the parameters section of the examination XML file.
    `boolean` | `isPeriodCriterion()` True if this criterion is based on period assignment.
    `boolean` | `isRoomCriterion()` True if this criterion is based on room assignment.
    `void` | `setWeight(double weight)`
    `void` | `setXmlParameters(Map<String,String> params)` Set all the parameters of this criterion from a map that is read from the parameters section the examination XML file.

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

      `afterAssigned, afterUnassigned, beforeAssigned, beforeUnassigned, bestRestored, bestSaved, clearCache, computeBounds, configure, constraintAdded, constraintRemoved, createAssignmentContext, getAbbreviation, getAssignmentContextReference, getBest, getBounds, getBounds, getBounds, getContext, getContext, getExtendedInfo, getInfo, getModel, getName, getPerc, getPercentage, getPercRev, getValue, getValue, getValue, getValue, getValueUpdateType, getWeight, getWeightDefault, getWeightedBest, getWeightedValue, getWeightedValue, getWeightedValue, getWeightedValue, getWeightedValue, getWeightedValue, inc, inc, init, setAssignmentContextReference, setModel, setValueUpdateType, toString, variableAdded, variableRemoved`

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

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

    - ### Methods inherited from interface org.cpsolver.ifs.criteria.Criterion

      `getValue`

- - ### Constructor Detail

    - #### ExamCriterion

          public ExamCriterion()

  - ### Method Detail

    - #### setWeight

          public void setWeight(double weight)

    - #### getWeightName

          public String getWeightName()

      Description copied from class: `AbstractCriterion`
      Defines weight name (to be used to get the criterion weight from the configuration).
      Overrides:
        `getWeightName` in class `AbstractCriterion<Exam,ExamPlacement>`
      Returns:
        name of the weight associated with this criterion

    - #### getBounds

          public double[] getBounds(Assignment<Exam,ExamPlacement> assignment,
                                    Collection<Exam> exams)

      Description copied from interface: `Criterion`
      Value bounds (minimum and maximum) of the criterion on a part of the problem
      Specified by:
        `getBounds` in interface `Criterion<Exam,ExamPlacement>`
      Overrides:
        `getBounds` in class `AbstractCriterion<Exam,ExamPlacement>`
      Parameters:
        `assignment` - current assignment
        `exams` - list of problem variables
      Returns:
        minimum and maximum of this criterion for the given sub-problem

    - #### getInfo

          public void getInfo(Assignment<Exam,ExamPlacement> assignment,
                              Map<String,String> info)

      Description copied from interface: `InfoProvider`
      Adds some information into the table with information about the solution
      Specified by:
        `getInfo` in interface `InfoProvider<Exam,ExamPlacement>`
      Overrides:
        `getInfo` in class `AbstractCriterion<Exam,ExamPlacement>`
      Parameters:
        `assignment` - current assignment
        `info` - info table

    - #### isPeriodCriterion

          public boolean isPeriodCriterion()

      True if this criterion is based on period assignment. Used by `ExamPlacement.getTimeCost(Assignment)`.
      Returns:
        true if this criterion is based on period assignment

    - #### getPeriodValue

          public double getPeriodValue(Assignment<Exam,ExamPlacement> assignment,
                                       ExamPlacement value)

      Return impact of this criterion on period assignment (if this criterion is based on period assignment). Used by `ExamPlacement.getTimeCost(Assignment)`.
      Parameters:
        `assignment` - current assignment
        `value` - new assignment in question
      Returns:
        change in the period preference value

    - #### isRoomCriterion

          public boolean isRoomCriterion()

      True if this criterion is based on room assignment. Used by `ExamPlacement.getRoomCost(Assignment)`.
      Returns:
        true if this criterion is based on room assignment

    - #### getRoomValue

          public double getRoomValue(Assignment<Exam,ExamPlacement> assignment,
                                     ExamPlacement value)

      Return impact of this criterion on room assignment (if this criterion is based on room assignment). Used by `ExamPlacement.getRoomCost(Assignment)`.
      Parameters:
        `assignment` - current assignment
        `value` - new assignment in question
      Returns:
        change in the room preference value

    - #### getXmlWeightName

          public String getXmlWeightName()

      Name of the weight parameter in the parameters section of the examination XML file.
      Returns:
        name of the weight parameter in the XML

    - #### getXmlParameters

          public void getXmlParameters(Map<String,String> params)

      Put all the parameters of this criterion into a map that is used to write parameters section of the examination XML file.
      Parameters:
        `params` - map of parameters (parameter = value) to be populated

    - #### setXmlParameters

          public void setXmlParameters(Map<String,String> params)

      Set all the parameters of this criterion from a map that is read from the parameters section the examination XML file.
      Parameters:
        `params` - map of parameters (parameter = value) loaded from XML