org.cpsolver.ifs.criteria

## Interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Superinterfaces:
    ExtendedInfoProvider<V,T>, InfoProvider<V,T>, ModelListener<V,T>
  All Known Implementing Classes:
    AbstractCriterion, AssignedValue, AssignmentCount, AttributePreferences, BackToBack, BackToBackInstructorPreferences, BrokenTimePatterns, CoursePreferences, DeltaTimePreference, DepartmentBalancingPenalty, DifferentLecture, DistanceToStronglyPreferredRoom, DistributionPenalty, DistributionPreferences, DistributionViolation, ExamCriterion, ExamRotationPenalty, ExamSplitter, FlexibleConstraintCriterion, HardConflicts, IgnoredCommittedStudentConflict, IgnoredStudentConflict, ImportantStudentConflict, ImportantStudentHardConflict, InstructorBackToBackConflicts, InstructorConflict, InstructorDirectConflicts, InstructorDistanceBackToBackConflicts, InstructorFairness, InstructorLunchBreak, InstructorMoreThan2ADayConflicts, InstructorNotAvailableConflicts, InstructorPreferences, InstructorSchedulingCriterion, InstructorStudentConflict, InstructorStudentHardConflict, LargeExamsPenalty, OriginalInstructor, PeriodIndexPenalty, PeriodPenalty, PeriodSizePenalty, PeriodViolation, PerturbationPenalty, Perturbations, PlacementSelectionCriterion, PotentialHardConflicts, QuadraticStudentConflict, QuadraticStudentHardConflict, RoomPenalty, RoomPerturbationPenalty, RoomPreferences, RoomSizePenalty, RoomSizePenalty, RoomSplitDistancePenalty, RoomSplitPenalty, RoomViolation, RoomViolations, SameCommon, SameCourse, SameDays, SameInstructor, SameLink, SameRoom, SameSubpartBalancingPenalty, StudentBackToBackConflicts, StudentCommittedConflict, StudentConflict, StudentDirectConflicts, StudentDistanceBackToBackConflicts, StudentDistanceConflict, StudentHardConflict, StudentLuchBreak, StudentMinimizeDaysOfWeek, StudentMinimizeScheduleHoles, StudentMoreThan1ADayConflicts, StudentMoreThan2ADayConflicts, StudentNotAvailableConflicts, StudentOverlapConflict, StudentOverLunchConflict, StudentWorkdayConflict, TeachingPreferences, TimeOverlaps, TimePreferences, TimePreferences, TimetablingCriterion, TimeViolations, TooBigRooms, UnusedInstructorLoad, UselessHalfHours, WeightedHardConflicts

      public interface Criterion<V extends Variable<V,T>,T extends Value<V,T>>
      extends ModelListener<V,T>, ExtendedInfoProvider<V,T>

  Criterion.
  An optimization objective can be split into several (optimization) criteria and modeled as a weighted sum of these. This makes the implementation of a particular problem more versatile as it allows for an easier modification of the optimization objective.
  Version:
    IFS 1.3 (Iterative Forward Search)
    Copyright (C) 2006 - 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/.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `bestRestored(Assignment<V,T> assignment)` Notification that the current solution has been restored from the best.
    `void` | `bestSaved(Assignment<V,T> assignment)` Notification that the current solution has been saved to the best.
    `void` | `configure(DataProperties properties)` Configure the criterion if needed
    `double` | `getBest()` Best value (value of the criterion in the best solution)
    `double[]` | `getBounds()` Deprecated.
    `double[]` | `getBounds(Assignment<V,T> assignment)` Bounds (minimum and maximum) estimate for the value
    `double[]` | `getBounds(Assignment<V,T> assignment, Collection<V> variables)` Value bounds (minimum and maximum) of the criterion on a part of the problem
    `double[]` | `getBounds(Collection<V> variables)` Deprecated.
    `String` | `getName()` Criterion name
    `double` | `getValue(Assignment<V,T> assignment)` Current value of the criterion (optimization objective)
    `double` | `getValue(Assignment<V,T> assignment, Collection<V> variables)` Value of a part of the problem (given by the collection of variables)
    `double` | `getValue(Assignment<V,T> assignment, T value, Set<T> conflicts)` Value of a proposed assignment (including hard conflicts)
    `double` | `getValue(Collection<V> variables)` Deprecated.
    `double` | `getValue(T value, Set<T> conflicts)` Deprecated.
    `double` | `getWeight()` Weight of the criterion
    `double` | `getWeightedBest()` Weighted best value of the objective (value in the best solution).
    `double` | `getWeightedValue()` Deprecated.
    `double` | `getWeightedValue(Assignment<V,T> assignment)` Weighted value of the objectives
    `double` | `getWeightedValue(Assignment<V,T> assignment, Collection<V> variables)` Weighted value of a part of the problem (given by the collection of variables)
    `double` | `getWeightedValue(Assignment<V,T> assignment, T value, Set<T> conflicts)` Weighted value of a proposed assignment (including hard conflicts)
    `double` | `getWeightedValue(Collection<V> variables)` Deprecated.
    `double` | `getWeightedValue(T value, Set<T> conflicts)` Deprecated.
    `void` | `inc(Assignment<V,T> assignment, double value)` Outside update of the criterion (usefull when the criterion is driven by a set of constraints).
    `void` | `inc(double value)` Deprecated.
    `void` | `setModel(Model<V,T> model)` called when the criterion is added to a model
    `String` | `toString(Assignment<V,T> assignment)` Simple text representation of the criterion and its value.

    - ### Methods inherited from interface org.cpsolver.ifs.model.ModelListener

      `afterAssigned, afterUnassigned, beforeAssigned, beforeUnassigned, constraintAdded, constraintRemoved, init, variableAdded, variableRemoved`

    - ### Methods inherited from interface org.cpsolver.ifs.model.ExtendedInfoProvider

      `getExtendedInfo`

    - ### Methods inherited from interface org.cpsolver.ifs.model.InfoProvider

      `getInfo, getInfo`

- - ### Method Detail

    - #### setModel

          void setModel(Model<V,T> model)

      called when the criterion is added to a model
      Parameters:
        `model` - problem model

    - #### getValue

          double getValue(Assignment<V,T> assignment)

      Current value of the criterion (optimization objective)
      Parameters:
        `assignment` - current assignment
      Returns:
        value of this criterion

    - #### getWeightedValue

          @Deprecated
          double getWeightedValue()

      Deprecated.
      Weighted value of the objectives. Use `getWeightedValue(Assignment)` instead.
      Returns:
        weighted value of this criterion

    - #### getWeightedValue

          double getWeightedValue(Assignment<V,T> assignment)

      Weighted value of the objectives
      Parameters:
        `assignment` - current assignment
      Returns:
        weighted value of this criterion

    - #### getBounds

          @Deprecated
          double[] getBounds()

      Deprecated.
      Bounds (minimum and maximum) estimate for the value. Use `getBounds(Assignment)` instead.
      Returns:
        minimum and maximum of the criterion value

    - #### getBounds

          double[] getBounds(Assignment<V,T> assignment)

      Bounds (minimum and maximum) estimate for the value
      Parameters:
        `assignment` - current assignment
      Returns:
        minimum and maximum of the criterion value

    - #### getWeightedBest

          double getWeightedBest()

      Weighted best value of the objective (value in the best solution).
      Returns:
        weighted value of this criterion in the best solution

    - #### getBest

          double getBest()

      Best value (value of the criterion in the best solution)
      Returns:
        value of this criterion in the best solution

    - #### getWeight

          double getWeight()

      Weight of the criterion
      Returns:
        criterion weight

    - #### getWeightedValue

          @Deprecated
          double getWeightedValue(T value,
                                              Set<T> conflicts)

      Deprecated.
      Weighted value of a proposed assignment (including hard conflicts). Use `getWeightedValue(Assignment, Value, Set)` instead.
      Parameters:
        `value` - given value
        `conflicts` - values conflicting with the given value
      Returns:
        weighted change in this criterion value when assigned

    - #### getWeightedValue

          double getWeightedValue(Assignment<V,T> assignment,
                                  T value,
                                  Set<T> conflicts)

      Weighted value of a proposed assignment (including hard conflicts)
      Parameters:
        `assignment` - current assignment
        `value` - given value
        `conflicts` - values conflicting with the given value
      Returns:
        weighted change in this criterion value when assigned

    - #### getValue

          @Deprecated
          double getValue(T value,
                                      Set<T> conflicts)

      Deprecated.
      Value of a proposed assignment (including hard conflicts). Use `getValue(Assignment, Value, Set)` instead.
      Parameters:
        `value` - given value
        `conflicts` - values conflicting with the given value
      Returns:
        change in this criterion value when assigned

    - #### getValue

          double getValue(Assignment<V,T> assignment,
                          T value,
                          Set<T> conflicts)

      Value of a proposed assignment (including hard conflicts)
      Parameters:
        `assignment` - current assignment
        `value` - given value
        `conflicts` - values conflicting with the given value
      Returns:
        change in this criterion value when assigned

    - #### getWeightedValue

          @Deprecated
          double getWeightedValue(Collection<V> variables)

      Deprecated.
      Weighted value of a part of the problem (given by the collection of variables) Use `getWeightedValue(Assignment, Collection)` instead.
      Parameters:
        `variables` - list of problem variables
      Returns:
        weighted value of the given variables

    - #### getWeightedValue

          double getWeightedValue(Assignment<V,T> assignment,
                                  Collection<V> variables)

      Weighted value of a part of the problem (given by the collection of variables)
      Parameters:
        `assignment` - current assignment
        `variables` - list of problem variables
      Returns:
        weighted value of the given variables

    - #### getValue

          @Deprecated
          double getValue(Collection<V> variables)

      Deprecated.
      Value of a part of the problem (given by the collection of variables). Use `getValue(Assignment, Collection)` instead.
      Parameters:
        `variables` - list of problem variables
      Returns:
        value of the given variables

    - #### getValue

          double getValue(Assignment<V,T> assignment,
                          Collection<V> variables)

      Value of a part of the problem (given by the collection of variables)
      Parameters:
        `assignment` - current assignment
        `variables` - list of problem variables
      Returns:
        value of the given variables

    - #### getBounds

          @Deprecated
          double[] getBounds(Collection<V> variables)

      Deprecated.
      Value bounds (minimum and maximum) of the criterion on a part of the problem. Use `getBounds(Assignment, Collection)` instead.
      Parameters:
        `variables` - list of problem variables
      Returns:
        minimum and maximum of this criterion for the given sub-problem

    - #### getBounds

          double[] getBounds(Assignment<V,T> assignment,
                             Collection<V> variables)

      Value bounds (minimum and maximum) of the criterion on a part of the problem
      Parameters:
        `assignment` - current assignment
        `variables` - list of problem variables
      Returns:
        minimum and maximum of this criterion for the given sub-problem

    - #### getName

          String getName()

      Criterion name
      Returns:
        name

    - #### inc

          @Deprecated
          void inc(double value)

      Deprecated.
      Outside update of the criterion (usefull when the criterion is driven by a set of constraints). Use `inc(Assignment, double)` instead.
      Parameters:
        `value` - increment criterion by this value

    - #### inc

          void inc(Assignment<V,T> assignment,
                   double value)

      Outside update of the criterion (usefull when the criterion is driven by a set of constraints).
      Parameters:
        `assignment` - current assignment
        `value` - increment criterion by this value

    - #### bestSaved

          void bestSaved(Assignment<V,T> assignment)

      Notification that the current solution has been saved to the best.
      Parameters:
        `assignment` - current assignment

    - #### bestRestored

          void bestRestored(Assignment<V,T> assignment)

      Notification that the current solution has been restored from the best.
      Parameters:
        `assignment` - current assignment

    - #### toString

          String toString(Assignment<V,T> assignment)

      Simple text representation of the criterion and its value. E.g., X:x where X is the `AbstractCriterion.getAbbreviation()` and x is the current value `AbstractCriterion.getValue(Assignment)`.
      Parameters:
        `assignment` - current assignment
      Returns:
        short string representation (e.g., PP:95% for period preference)

    - #### configure

          void configure(DataProperties properties)

      Configure the criterion if needed
      Parameters:
        `properties` - configuration