net.sf.cpsolver.ifs.algorithms.neighbourhoods

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

- java.lang.Object
- - net.sf.cpsolver.ifs.algorithms.neighbourhoods.RandomSwapMove<V,T>
  - - net.sf.cpsolver.ifs.algorithms.neighbourhoods.SuggestionMove<V,T>

- All Implemented Interfaces:
    HillClimberSelection, NeighbourSelection<V,T>

      public class SuggestionMove<V extends Variable<V,T>,T extends Value<V,T>>
      extends RandomSwapMove<V,T>

  Suggestion move. A variable is selected randomly. A limited depth backtracking is used to find a possible change (much like the suggestions in UniTime when the interactive solver is used). Unlike in `NeighbourSelectionWithSuggestions`, the very first found suggestion is returned. The depth is limited by SuggestionMove.Depth parameter (defaults to 3). Also, instead of using a time limit, the width of the search is limited by the number of values that are tried for each variable (parameter SuggestionMove.MaxAttempts, defaults to 10). When used in `HillClimber`, the first suggestion that does not worsen the solution is returned.
  Version:
    IFS 1.2 (Iterative Forward Search)
    Copyright (C) 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/.

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class net.sf.cpsolver.ifs.algorithms.neighbourhoods.RandomSwapMove

      `RandomSwapMove.SwapNeighbour`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `iSuggestionDepth`
    `protected int` | `iTimeLimit`

    - ### Fields inherited from class net.sf.cpsolver.ifs.algorithms.neighbourhoods.RandomSwapMove

      `iHC, iMaxAttempts`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SuggestionMove(DataProperties config)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `init(Solver<V,T> solver)` Criterion initialization
    `Neighbour<V,T>` | `selectNeighbour(Solution<V,T> solution)` select a neighbour of a given solution

    - ### Methods inherited from class net.sf.cpsolver.ifs.algorithms.neighbourhoods.RandomSwapMove

      `isTimeLimitReached, resolve, setHcMode`

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

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

- - ### Field Detail

    - #### iSuggestionDepth

          protected int iSuggestionDepth

    - #### iTimeLimit

          protected int iTimeLimit

  - ### Constructor Detail

    - #### SuggestionMove

          public SuggestionMove(DataProperties config)
                         throws Exception

      Throws:
        `Exception`

  - ### Method Detail

    - #### init

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

      Description copied from interface: `NeighbourSelection`
      Criterion initialization
      Specified by:
        `init` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Overrides:
        `init` in class `RandomSwapMove<V extends Variable<V,T>,T extends Value<V,T>>`

    - #### selectNeighbour

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

      Description copied from interface: `NeighbourSelection`
      select a neighbour of a given solution
      Specified by:
        `selectNeighbour` in interface `NeighbourSelection<V extends Variable<V,T>,T extends Value<V,T>>`
      Overrides:
        `selectNeighbour` in class `RandomSwapMove<V extends Variable<V,T>,T extends Value<V,T>>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment