samples.tutorials.lns.lns
Class RandomNeighborhoodOperator
java.lang.Object
samples.tutorials.lns.lns.RandomNeighborhoodOperator
- All Implemented Interfaces:
- NeighborhoodOperator
public class RandomNeighborhoodOperator
- extends Object
- implements NeighborhoodOperator
A neighborhood operator which fix/unfix integer variables randomly
- Author:
- Sophie Demassey
Method Summary |
boolean |
restrictNeighborhood(Solution solution)
restrict the search space around the solution by selecting nbRelaxedVars variables randomly to let free
and by fixing all other integer variables to their value in solution |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
random
protected Random random
nbRelaxedVars
protected int nbRelaxedVars
selected
protected gnu.trove.TIntHashSet selected
RandomNeighborhoodOperator
public RandomNeighborhoodOperator(int nbRelaxedVars)
- Constructs with a fixed seed.
- Parameters:
nbRelaxedVars
- number of variables to relax
RandomNeighborhoodOperator
public RandomNeighborhoodOperator(int nbRelaxedVars,
long seed)
- Constructs with a specified seed.
- Parameters:
nbRelaxedVars
- number of variables to relaxseed
- random seed
restrictNeighborhood
public boolean restrictNeighborhood(Solution solution)
- restrict the search space around the solution by selecting nbRelaxedVars variables randomly to let free
and by fixing all other integer variables to their value in solution
- Specified by:
restrictNeighborhood
in interface NeighborhoodOperator
- Parameters:
solution
- the solution to build the neighborhood around
- Returns:
- true iff the search space is actually shrunken
Copyright © 2012. All Rights Reserved.