org.cpsolver.ifs.algorithms

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

- java.lang.Object
- - org.cpsolver.ifs.assignment.context.NeighbourSelectionWithContext<V,T,NeighbourSearch.NeighbourSearchContext>
  - - org.cpsolver.ifs.algorithms.NeighbourSearch<V,T>
    - - org.cpsolver.ifs.algorithms.HillClimber<V,T>
      - - org.cpsolver.ifs.algorithms.StepCountingHillClimber<V,T>

- Type Parameters:
    `V` - Variable
    `T` - Value
  All Implemented Interfaces:
    CanHoldContext, HasAssignmentContext<V,T,NeighbourSearch.NeighbourSearchContext>, NeighbourSelection<V,T>, LazyNeighbour.LazyNeighbourAcceptanceCriterion<V,T>, SolutionListener<V,T>

      public class StepCountingHillClimber<V extends Variable<V,T>,T extends Value<V,T>>
      extends HillClimber<V,T>

  Step counting hill climber. Unlike with the ordinary hill climber, there is a bound. The bound is updated (to the value of the current solution) after a given number of moves. Based on the given mode, either all moves, only accepted moves, or only improving moves are counted.
  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/.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `StepCountingHillClimber.Mode`
    `class` | `StepCountingHillClimber.StepCountingHillClimberContext`

    - ### Nested classes/interfaces inherited from class org.cpsolver.ifs.algorithms.HillClimber

      `HillClimber.HillClimberContext`

    - ### Nested classes/interfaces inherited from class org.cpsolver.ifs.algorithms.NeighbourSearch

      `NeighbourSearch.NeighbourSearchContext`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int` | `iCounterLimit`
    `protected Double[]` | `iCounterLimitAdjusts`
    `protected StepCountingHillClimber.Mode` | `iCounterMode`

    - ### Fields inherited from class org.cpsolver.ifs.algorithms.HillClimber

      `iMaxIdleIters, iSetHCMode, sEPS`

    - ### Fields inherited from class org.cpsolver.ifs.algorithms.NeighbourSearch

      `iDF2, iPhase`

    - ### 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
    `StepCountingHillClimber(DataProperties properties)` Constructor HillClimber.CounterLimit ... number of moves after which the bound is reset (defaults to 1000) HillClimber.CounterMode ... counter mode (all: count all moves, accepted: count accepted moves, improving: count improving moves)

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `NeighbourSearch.NeighbourSearchContext` | `createAssignmentContext(Assignment<V,T> assignment)` Create a new assignment context for the given assignment.

    - ### Methods inherited from class org.cpsolver.ifs.algorithms.HillClimber

      `getParameterBaseName, init, setPhase`

    - ### Methods inherited from class org.cpsolver.ifs.algorithms.NeighbourSearch

      `accept, accept, addNeighbourSelection, bestCleared, bestRestored, bestSaved, generateMove, getInfo, getInfo, getNeighbours, info, isMaster, logNeibourStatus, nextNeighbourSelection, selectNeighbour, setHCMode, setProgress, setProgressPhase, solutionUpdated`

    - ### 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`

- - ### Field Detail

    - #### iCounterLimit

          protected int iCounterLimit

    - #### iCounterMode

          protected StepCountingHillClimber.Mode iCounterMode

    - #### iCounterLimitAdjusts

          protected Double[] iCounterLimitAdjusts

  - ### Constructor Detail

    - #### StepCountingHillClimber

          public StepCountingHillClimber(DataProperties properties)

      Constructor
      - HillClimber.CounterLimit ... number of moves after which the bound is reset (defaults to 1000)
      - HillClimber.CounterMode ... counter mode (all: count all moves, accepted: count accepted moves, improving: count improving moves)
      Parameters:
        `properties` - solver configuration

  - ### Method Detail

    - #### createAssignmentContext

          public NeighbourSearch.NeighbourSearchContext 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.
      Specified by:
        `createAssignmentContext` in interface `HasAssignmentContext<V extends Variable<V,T>,T extends Value<V,T>,NeighbourSearch.NeighbourSearchContext>`
      Overrides:
        `createAssignmentContext` in class `HillClimber<V extends Variable<V,T>,T extends Value<V,T>>`
      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