org.cpsolver.ifs.heuristics

## Class BacktrackNeighbourSelection.BackTrackNeighbour

- java.lang.Object
- - org.cpsolver.ifs.heuristics.BacktrackNeighbourSelection.BackTrackNeighbour

- All Implemented Interfaces:
    Neighbour<V,T>
  Enclosing class:
    BacktrackNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>

      public class BacktrackNeighbourSelection.BackTrackNeighbour
      extends Object
      implements Neighbour<V,T>

  Backtracking neighbour

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `BackTrackNeighbour(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context, List<V> resolvedVariables)` Constructor
    `BackTrackNeighbour(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context, V... resolvedVariables)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `assign(Assignment<V,T> assignment, long iteration)` Assign the neighbour
    `Map<V,T>` | `assignments()` Return assignments to be done.
    `int` | `compareTo(Solution<V,T> solution)` Compare two neighbours
    `List<T>` | `getAssignments()` Neighbour assignments
    `double` | `getTotalValue()` Neighbour value (solution total value if the neighbour is applied).
    `String` | `toString()`
    `double` | `value(Assignment<V,T> assignment)` Sum of values of variables from the neighbour that change their values

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

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

- - ### Constructor Detail

    - #### BackTrackNeighbour

          public BackTrackNeighbour(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context,
                                    List<V> resolvedVariables)

      Constructor
      Parameters:
        `context` - assignment context
        `resolvedVariables` - variables that has been changed

    - #### BackTrackNeighbour

          public BackTrackNeighbour(BacktrackNeighbourSelection.BacktrackNeighbourSelectionContext context,
                                    V... resolvedVariables)

      Constructor
      Parameters:
        `context` - assignment context
        `resolvedVariables` - variables that has been changed

  - ### Method Detail

    - #### getTotalValue

          public double getTotalValue()

      Neighbour value (solution total value if the neighbour is applied).
      Returns:
        value of the new solution

    - #### value

          public double value(Assignment<V,T> assignment)

      Sum of values of variables from the neighbour that change their values
      Specified by:
        `value` in interface `Neighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `assignment` - current assignment
      Returns:
        difference in the solution value when assigned

    - #### getAssignments

          public List<T> getAssignments()

      Neighbour assignments
      Returns:
        list of assignments in this neighbour

    - #### assign

          public void assign(Assignment<V,T> assignment,
                             long iteration)

      Assign the neighbour
      Specified by:
        `assign` in interface `Neighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `assignment` - current assignment
        `iteration` - current iteration

    - #### compareTo

          public int compareTo(Solution<V,T> solution)

      Compare two neighbours
      Parameters:
        `solution` - current solution
      Returns:
        comparison

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### assignments

          public Map<V,T> assignments()

      Description copied from interface: `Neighbour`
      Return assignments to be done.
      Specified by:
        `assignments` in interface `Neighbour<V extends Variable<V,T>,T extends Value<V,T>>`
      Returns:
        list of assignments (including unassignments) of this neighbour