samples.tutorials.lns.lns
Class RandomNeighborhoodOperator

java.lang.Object
  extended by 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

Field Summary
protected  int nbRelaxedVars
           
protected  Random random
           
protected  gnu.trove.TIntHashSet selected
           
 
Constructor Summary
RandomNeighborhoodOperator(int nbRelaxedVars)
          Constructs with a fixed seed.
RandomNeighborhoodOperator(int nbRelaxedVars, long seed)
          Constructs with a specified seed.
 
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
 

Field Detail

random

protected Random random

nbRelaxedVars

protected int nbRelaxedVars

selected

protected gnu.trove.TIntHashSet selected
Constructor Detail

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 relax
seed - random seed
Method Detail

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.