org.cpsolver.ifs.algorithms

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

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext<V,T,SimpleSearch.SimpleSearchContext>
  - - org.cpsolver.ifs.algorithms.SimpleSearch<V,T>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Implemented Interfaces:
    CanHoldContext, HasAssignmentContext<V,T,SimpleSearch.SimpleSearchContext>, NeighbourSelection<V,T>

      public class SimpleSearch<V extends Variable<V,T>,T extends Value<V,T>>
      extends NeighbourSelectionWithContext<V,T,SimpleSearch.SimpleSearchContext>

  Simple search neighbour selection.
  It consists of the following three phases:
  - Construction phase (`StandardNeighbourSelection` until all variables are assigned)
  - Hill-climbing phase (`HillClimber` until the given number if idle iterations)
  - Simulated annealing phase (`SimulatedAnnealing` until timeout is reached)
  - Or great deluge phase (when Search.GreatDeluge is true, `GreatDeluge` until timeout is reached)
  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

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `class` | `SimpleSearch.SimpleSearchContext`

  - ### Field Summary

    - ### Fields inherited from class org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext

      `iContextOverride`

    - ### Fields inherited from interface org.cpsolver.ifs.assignment.context.CanHoldContext

      `sMaxSize`

  - ### Constructor Summary

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

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `SimpleSearch.SimpleSearchContext` | `createAssignmentContext(Assignment<V,T> assignment)` Create a new assignment context for the given assignment.
    `void` | `init(Solver<V,T> solver)` Initialization
    `Neighbour<V,T>` | `selectNeighbour(Solution<V,T> solution)` Neighbour selection.
    `protected void` | `updateProgress(int phase, Solution<V,T> solution)`

    - ### Methods inherited from class org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext

      `getAssignmentContextReference, getContext, getContext, hasContextOverride, isSingleContextSolver, setAssignmentContextReference`

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

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

- - ### Constructor Detail

    - #### SimpleSearch

          public SimpleSearch(DataProperties properties)
                       throws Exception

      Constructor
      Parameters:
        `properties` - problem configuration
      Throws:
        `Exception` - thrown when initialization fails (e.g., a given class is not found)

  - ### Method Detail

    - #### 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 `NeighbourSelectionWithContext<V extends Variable<V,T>,T extends Value<V,T>,SimpleSearch.SimpleSearchContext>`
      Parameters:
        `solver` - current solver

    - #### updateProgress

          protected void updateProgress(int phase,
                                        Solution<V,T> solution)

    - #### selectNeighbour

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

      Neighbour selection. It consists of the following three phases:
      - Construction phase (`StandardNeighbourSelection` until all variables are assigned)
      - Hill-climbing phase (`HillClimber` until the given number if idle iterations)
      - Simulated annealing phase (`SimulatedAnnealing` until timeout is reached)
      Parameters:
        `solution` - given solution
      Returns:
        a neighbour assignment

    - #### createAssignmentContext

          public SimpleSearch.SimpleSearchContext createAssignmentContext(Assignment<V,T> assignment)

      Description copied from interface: `HasAssignmentContext`
      Create a new assignment context for the given assignment. If there are already some variables assigned in the value, the method should make sure that the context is appropriately initialized.
      Parameters:
        `assignment` - an assignment for which there needs to be an assignment context
      Returns:
        a new instance of the assignment context, filled according to the given assignment