org.cpsolver.ifs.heuristics

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

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

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

      public class RoundRobinNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>
      extends StandardNeighbourSelection<V,T>

  A round robin neighbour selection. Two or more `NeighbourSelection` needs to be registered within the selection. This selection criterion takes the registered neighbour selections one by one and performs `NeighbourSelection.init(Solver)` and then it is using `NeighbourSelection.selectNeighbour(Solution)` to select a neighbour. When null is returned by the underlaying selection, next registered neighbour selection is initialized and used for the following selection(s). If the last registered selection returns null, the selection is returned to the first registered neighbour selection (it is initialized before used again).
  Version:
    StudentSct 1.3 (Student Sectioning)
    Copyright (C) 2007 - 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

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Solver<V,T>` | `iSolver`
    `protected static org.apache.logging.log4j.Logger` | `sLogger`

    - ### Fields inherited from class org.cpsolver.ifs.heuristics.StandardNeighbourSelection

      `iStat`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `changeSelection(int selectionIndex)` Change selection
    `NeighbourSelection<V,T>` | `getSelection()`
    `int` | `getSelectionIndex()`
    `void` | `init(Solver<V,T> solver)` Initialization
    `void` | `registerSelection(NeighbourSelection<V,T> selection)` Register a neighbour selection
    `Neighbour<V,T>` | `selectNeighbour(Solution<V,T> solution)` Select neighbour.

    - ### Methods inherited from class org.cpsolver.ifs.heuristics.StandardNeighbourSelection

      `getValueSelection, getVariableSelection, selectValue, selectVariable, setValueSelection, setVariableSelection`

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

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

- - ### Field Detail

    - #### sLogger

          protected static org.apache.logging.log4j.Logger sLogger

    - #### iSolver

          protected Solver<V extends Variable<V,T>,T extends Value<V,T>> iSolver

  - ### Constructor Detail

    - #### RoundRobinNeighbourSelection

          public RoundRobinNeighbourSelection(DataProperties properties)
                                       throws Exception

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

  - ### Method Detail

    - #### registerSelection

          public void registerSelection(NeighbourSelection<V,T> selection)

      Register a neighbour selection
      Parameters:
        `selection` - a neighbour selection to include in the selection

    - #### init

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

      Initialization
      Specified by:
        `init` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Overrides:
        `init` in class `StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `solver` - current solver

    - #### selectNeighbour

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

      Select neighbour. A first registered selections is initialized and used until it returns null, then the second registered selections is initialized and used and vice versa.
      Specified by:
        `selectNeighbour` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Overrides:
        `selectNeighbour` in class `StandardNeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment

    - #### getSelectionIndex

          public int getSelectionIndex()

    - #### changeSelection

          public void changeSelection(int selectionIndex)

      Change selection
      Parameters:
        `selectionIndex` - current selection index

    - #### getSelection

          public NeighbourSelection<V,T> getSelection()