jopt.csp.spi.search.localsearch
Class FlipNeighborhood

java.lang.Object
  extended byjopt.csp.spi.search.localsearch.FlipNeighborhood
All Implemented Interfaces:
jopt.csp.search.Neighborhood

public class FlipNeighborhood
extends java.lang.Object
implements jopt.csp.search.Neighborhood

Creates a neighbor hood that is useful for flipping 0 and 1 values on binary variables. For each variable defined, a neighboring solution will be defined that either assigns the value to 1 or the value to 0.

Version:
$Revision: 1.7 $
Author:
Nick Coleman
See Also:
BrowseNeighborhoodAction

Constructor Summary
FlipNeighborhood(jopt.csp.variable.CspIntVariable[] vars)
          Creates a flip neighborhood base on an array of binary variables
 
Method Summary
 jopt.csp.solution.SolverSolution getNeighbor(int i)
           
 jopt.csp.search.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)
           
 void setInitialSolution(jopt.csp.solution.SolverSolution initial)
           
 int size()
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FlipNeighborhood

public FlipNeighborhood(jopt.csp.variable.CspIntVariable[] vars)
Creates a flip neighborhood base on an array of binary variables

Method Detail

setInitialSolution

public void setInitialSolution(jopt.csp.solution.SolverSolution initial)
Specified by:
setInitialSolution in interface jopt.csp.search.Neighborhood

size

public int size()
Specified by:
size in interface jopt.csp.search.Neighborhood

getNeighbor

public jopt.csp.solution.SolverSolution getNeighbor(int i)
Specified by:
getNeighbor in interface jopt.csp.search.Neighborhood

neighborSelected

public void neighborSelected(int i)
Specified by:
neighborSelected in interface jopt.csp.search.Neighborhood

getSelectedNeighborhood

public jopt.csp.search.Neighborhood getSelectedNeighborhood()
Returns the Neighborhood represented by the latest selected Neighborhood

Specified by:
getSelectedNeighborhood in interface jopt.csp.search.Neighborhood
Returns:
Neighborhood represented by the latest selected Neighborhood

getSelectedNeighborhoodOffset

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

Specified by:
getSelectedNeighborhoodOffset in interface jopt.csp.search.Neighborhood
Returns:
the offset into Neighborhood represented by the latest selected Neighborhood