org.cpsolver.ifs.algorithms.neighbourhoods

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

- java.lang.Object
- - org.cpsolver.ifs.algorithms.neighbourhoods.RandomMove<V,T>

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

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

  Try to assign a variable with a new value. A variable is selected randomly, a different (available) value is randomly selected for the variable -- the variable is assigned with the new value if there is no conflict.
  Version:
    IFS 1.3 (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/.
  Author:
    Tomáš Müller

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected boolean` | `iHC`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RandomMove(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
    `void` | `setHcMode(boolean hcMode)` True if employed by a hill climber, e.g., worsening moves may be skipped.

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

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

- - ### Field Detail

    - #### iHC

          protected boolean iHC

  - ### Constructor Detail

    - #### RandomMove

          public RandomMove(DataProperties config)

  - ### Method Detail

    - #### setHcMode

          public void setHcMode(boolean hcMode)

      Description copied from interface: `HillClimberSelection`
      True if employed by a hill climber, e.g., worsening moves may be skipped.
      Specified by:
        `setHcMode` in interface `HillClimberSelection`
      Parameters:
        `hcMode` - true if used by a hill climber (worsening moves are automatically discarded)

    - #### 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>>`
      Parameters:
        `solver` - current solver

    - #### 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>>`
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment