org.cpsolver.ifs.heuristics

## Class StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>

- java.lang.Object
- - org.cpsolver.ifs.heuristics.StandardNeighbourSelection<V,T>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Implemented Interfaces:
    NeighbourSelection<V,T>
  Direct Known Subclasses:
    BacktrackNeighbourSelection, NeighbourSelectionWithSuggestions, RoundRobinNeighbourSelection

      public class StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
      extends Object
      implements NeighbourSelection<V,T>

  Standard neighbour selection criterion.
  This criterion is using the provided variable and value selection criteria. In each step, a variable is selected first using the `VariableSelection`. Then, a value is selected to the selected variable, using the `ValueSelection`. A `SimpleNeighbour` containing the selected value is returned.
  Note: the use of neighbour select criteria extends the former implementation of the IFS algorithm which was only able to use variable and value selection criteria and therefore only one value was assigned in each iteration.
  Parameters:

  Parameter | Type | Comment
  --- | --- | ---
  Value.Class | `String` | Fully qualified class name of the value selection criterion (see `ValueSelection`, e.g. `GeneralValueSelection`)
  Variable.Class | `String` | Fully qualified class name of the variable selection criterion (see `VariableSelection`, e.g. `GeneralVariableSelection`)

  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.
  See Also:
    `Solver`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static Logger` | `sLogger`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardNeighbourSelection(DataProperties properties)` Constructor

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `ValueSelection<V,T>` | `getValueSelection()` Returns value selection criterion
    `VariableSelection<V,T>` | `getVariableSelection()` Returns variable selection criterion
    `void` | `init(Solver<V,T> solver)` Initialization -- methods `VariableSelection.init(Solver)` and `ValueSelection.init(Solver)` are called.
    `Neighbour<V,T>` | `selectNeighbour(Solution<V,T> solution)` Select neighbour.
    `T` | `selectValue(Solution<V,T> solution, V variable)` Use the provided value selection criterion to select a value to the selected variable
    `V` | `selectVariable(Solution<V,T> solution)` Use the provided variable selection criterion to select a variable
    `void` | `setValueSelection(ValueSelection<V,T> valueSelection)` Sets value selection criterion
    `void` | `setVariableSelection(VariableSelection<V,T> variableSelection)` Sets variable selection criterion

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

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

- - ### Field Detail

    - #### sLogger

          protected static Logger sLogger

  - ### Constructor Detail

    - #### StandardNeighbourSelection

          public StandardNeighbourSelection(DataProperties properties)
                                     throws Exception

      Constructor
      Parameters:
        `properties` - configuration
      Throws:
        `Exception` - thrown when initialization fails

  - ### Method Detail

    - #### setValueSelection

          public void setValueSelection(ValueSelection<V,T> valueSelection)

      Sets value selection criterion
      Parameters:
        `valueSelection` - value selection criterion

    - #### setVariableSelection

          public void setVariableSelection(VariableSelection<V,T> variableSelection)

      Sets variable selection criterion
      Parameters:
        `variableSelection` - variable selection criterion

    - #### getValueSelection

          public ValueSelection<V,T> getValueSelection()

      Returns value selection criterion
      Returns:
        value selection criterion

    - #### getVariableSelection

          public VariableSelection<V,T> getVariableSelection()

      Returns variable selection criterion
      Returns:
        variable selection criterion

    - #### init

          public void init(Solver<V,T> solver)

      Initialization -- methods `VariableSelection.init(Solver)` and `ValueSelection.init(Solver)` are called.
      Specified by:
        `init` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `solver` - current solver

    - #### selectVariable

          public V selectVariable(Solution<V,T> solution)

      Use the provided variable selection criterion to select a variable
      Parameters:
        `solution` - current solution
      Returns:
        selected variable

    - #### selectValue

          public T selectValue(Solution<V,T> solution,
                               V variable)

      Use the provided value selection criterion to select a value to the selected variable
      Parameters:
        `solution` - current solution
        `variable` - selected variable
      Returns:
        selected value

    - #### selectNeighbour

          public Neighbour<V,T> selectNeighbour(Solution<V,T> solution)

      Select neighbour. A value is selected to the selected variable.
      Specified by:
        `selectNeighbour` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment