org.cpsolver.ifs.perturbations

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

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Known Implementing Classes:
    DefaultPerturbationsCounter, UniversalPerturbationsCounter

      public interface PerturbationsCounter<V extends Variable<V,T>,T extends Value<V,T>>

  Counter of perturbation penalty (minimal perturbation problem).
  Many real-life problems are dynamic, with changes in the problem definition occurring after a solution to the initial formulation has been reached. A minimal perturbation problem incorporates these changes, along with the initial solution, as a new problem whose solution must be as close as possible to the initial solution. The iterative forward search algorithm is also made to solve minimal perturbation problems.
  To define the minimal perturbation problem, we will consider an initial (original) problem, its solution, a new problem, and some distance function which allows us to compare solutions of the initial and the new problem. Subsequently we look for a solution of the new problem with minimal distance from the initial solution. This distance is expressed by this PerturbationCounter
  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/.
  Author:
    Tomáš Müller
  See Also:
    `Solver`, `Solution`, `Variable`

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `getInfo(Assignment<V,T> assignment, Model<V,T> model, Map<String,String> info)` Some (perturbation) information about the solution might be returned here.
    `void` | `getInfo(Assignment<V,T> assignment, Model<V,T> model, Map<String,String> info, Collection<V> variables)` Some (perturbation) information about the solution might be returned here (only include variables from the given set).
    `double` | `getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model)` Returns perturbation penalty, i.e., the distance between current solution and the solution of the initial problem (see `Variable.getInitialAssignment()`).
    `double` | `getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model, Collection<V> variables)` Returns perturbation penalty, i.e., the distance between current solution and the solution of the initial (only include variables from the given set) problem (see `Variable.getInitialAssignment()`).
    `double` | `getPerturbationPenalty(Assignment<V,T> assignment, Model<V,T> model, T selectedValue, Collection<T> conflicts)` Returns perturbation penalty of the solution which become from the current solution when given conflicting values are unassigned and the selected value is assigned.
    `void` | `init(Solver<V,T> solver)` Initialization

- - ### Method Detail

    - #### init

          void init(Solver<V,T> solver)

      Initialization
      Parameters:
        `solver` - current solver

    - #### getPerturbationPenalty

          double getPerturbationPenalty(Assignment<V,T> assignment,
                                        Model<V,T> model)

      Returns perturbation penalty, i.e., the distance between current solution and the solution of the initial problem (see `Variable.getInitialAssignment()`).
      Parameters:
        `assignment` - current assignment
        `model` - current model
      Returns:
        penalty

    - #### getPerturbationPenalty

          double getPerturbationPenalty(Assignment<V,T> assignment,
                                        Model<V,T> model,
                                        Collection<V> variables)

      Returns perturbation penalty, i.e., the distance between current solution and the solution of the initial (only include variables from the given set) problem (see `Variable.getInitialAssignment()`).
      Parameters:
        `assignment` - current assignment
        `model` - current model
        `variables` - sub-problem
      Returns:
        penalty

    - #### getPerturbationPenalty

          double getPerturbationPenalty(Assignment<V,T> assignment,
                                        Model<V,T> model,
                                        T selectedValue,
                                        Collection<T> conflicts)

      Returns perturbation penalty of the solution which become from the current solution when given conflicting values are unassigned and the selected value is assigned. Since this penalty is used for comparison of different candidate values in the value selection criterion, it is fully acceptable to just return a difference between current and the altered solution (which might be easied for computation that the whole perturbation penalty).
      Parameters:
        `assignment` - current assignment
        `model` - current model
        `selectedValue` - value to be selected in the next iteration
        `conflicts` - conflicting values to be unassigned in the next iteration
      Returns:
        penalty

    - #### getInfo

          void getInfo(Assignment<V,T> assignment,
                       Model<V,T> model,
                       Map<String,String> info)

      Some (perturbation) information about the solution might be returned here.
      Parameters:
        `assignment` - current assignment
        `info` - resultant info table
        `model` - current model

    - #### getInfo

          void getInfo(Assignment<V,T> assignment,
                       Model<V,T> model,
                       Map<String,String> info,
                       Collection<V> variables)

      Some (perturbation) information about the solution might be returned here (only include variables from the given set).
      Parameters:
        `assignment` - current assignment
        `info` - resultant info table
        `model` - current model
        `variables` - sub-problem