|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jopt.csp.search.WeightedRandomizedNeighborhood
A wrapper to other neighborhoods that returns neighbors from the wrapped
neighborhoods in a random, weighted manner. Differs from the
RandomizedNeighborhood
in that the specified weights influence the
frequency of the neighbors returned from the associated neighborhood.
For example, if Neighborhood2 and Neighborhood1 are included with weights of
2.0 and 1.0, respectively, the caller is twice as likely to get a neighbor
from Neighborhood2 (assuming the neighbors are requested in numeric order)
until Neighborhood2 is exhausted.
Constructor Summary | |
WeightedRandomizedNeighborhood(Neighborhood[] hoods,
double[] weights)
Creates a weighted, random, unified neighborhood based on a collection of other neighborhoods |
|
WeightedRandomizedNeighborhood(Neighborhood[] hoods,
double[] weights,
long randomSeed)
Creates a weighted, random, unified neighborhood based on a collection of other neighborhoods with a specific randomizer seed |
Method Summary | |
SolverSolution |
getNeighbor(int index)
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 |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public WeightedRandomizedNeighborhood(Neighborhood[] hoods, double[] weights)
public WeightedRandomizedNeighborhood(Neighborhood[] hoods, double[] weights, long randomSeed)
Method Detail |
public void setInitialSolution(SolverSolution initial)
Neighborhood
setInitialSolution
in interface Neighborhood
public int size()
Neighborhood
size
in interface Neighborhood
public SolverSolution getNeighbor(int index)
Neighborhood
i
getNeighbor
in interface Neighborhood
index
- Index of neighbor within neighborhood
public Neighborhood getSelectedNeighborhood()
Neighborhood
getSelectedNeighborhood
in interface Neighborhood
public int getSelectedNeighborhoodOffset()
Neighborhood
getSelectedNeighborhoodOffset
in interface Neighborhood
public void neighborSelected(int i)
Neighborhood
neighborSelected
in interface Neighborhood
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |