jopt.csp.search
Interface Neighborhood

All Known Implementing Classes:
RandomizedNeighborhood, SimpleNeighborhood, UnifiedNeighborhood, WeightedRandomizedNeighborhood

public interface Neighborhood

Contains a set of neighboring solutions that are related to an initial solution. The neighbor can define solutions to variables that should not be updated from the original solution as well as values to assign to variables not in the scope of the original solution. Each neighbor will be applied as an alternative solution to produce a set of choices.

Version:
$Revision: 1.5 $
Author:
Nick Coleman

Method Summary
 SolverSolution getNeighbor(int i)
          Returns the neighboring solution at index i
 Neighborhood getSelectedNeighborhood()
          Returns the Neighborhood represented by the latest selected Neighborhood
 int getSelectedNeighborhoodOffset()
          Returns the offset into Neighborhood represented by the latest selected Neighborhood
 void neighborSelected(int i)
          Indicates that a neighbor has been selected from this neighborhood and is about to be used to update the initial solution.
 void setInitialSolution(SolverSolution initial)
          Sets the initial solution to which this neighborhood is related
 int size()
          Returns the number of potential solutions contained in the neighborhood
 

Method Detail

setInitialSolution

public void setInitialSolution(SolverSolution initial)
Sets the initial solution to which this neighborhood is related


size

public int size()
Returns the number of potential solutions contained in the neighborhood


getNeighbor

public SolverSolution getNeighbor(int i)
Returns the neighboring solution at index i

Parameters:
i - Index of neighbor within neighborhood
Returns:
Solution given by the neighbor or null if some pre-propagation checks show that the neighbor is invalid (and will fail constraint satisfaction).

neighborSelected

public void neighborSelected(int i)
Indicates that a neighbor has been selected from this neighborhood and is about to be used to update the initial solution. This is useful if the neighborhood will adjust the order in which neighbors are produced.


getSelectedNeighborhood

public Neighborhood getSelectedNeighborhood()
Returns the Neighborhood represented by the latest selected Neighborhood

Returns:
Neighborhood represented by the latest selected Neighborhood null if no such neighbor has been selected

getSelectedNeighborhoodOffset

public int getSelectedNeighborhoodOffset()
Returns the offset into Neighborhood represented by the latest selected Neighborhood

Returns:
the offset into Neighborhood represented by the latest selected Neighborhood -1 if no such neighbor has been selected