samples.tutorials.lns.lns
Class RandomTaskNeighborhoodOperator

java.lang.Object
  extended by samples.tutorials.lns.lns.RandomTaskNeighborhoodOperator
All Implemented Interfaces:
NeighborhoodOperator

public class RandomTaskNeighborhoodOperator
extends Object
implements NeighborhoodOperator

A neighborhood operator which fix/unfix task variables randomly

Author:
Sophie Demassey

Field Summary
protected  int maxSize
           
protected  int minSize
           
protected  Random random
           
protected  gnu.trove.TIntHashSet selected
           
 
Constructor Summary
RandomTaskNeighborhoodOperator(int nbRelaxedTasks)
          Constructs with a fixed seed.
RandomTaskNeighborhoodOperator(int minNbRelaxedTasks, int maxNbRelaxedTasks, long seed)
          Constructs with a specified seed and a variable neighborhood size.
RandomTaskNeighborhoodOperator(int nbRelaxedTasks, long seed)
          Constructs with a specified seed.
 
Method Summary
 boolean restrictNeighborhood(Solution solution)
          restrict the search space around the solution by selecting nbRelaxedTasks task variables randomly to let free and by fixing all other task 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

minSize

protected int minSize

maxSize

protected int maxSize

selected

protected gnu.trove.TIntHashSet selected
Constructor Detail

RandomTaskNeighborhoodOperator

public RandomTaskNeighborhoodOperator(int nbRelaxedTasks)
Constructs with a fixed seed.

Parameters:
nbRelaxedTasks - number of task variables to let free

RandomTaskNeighborhoodOperator

public RandomTaskNeighborhoodOperator(int nbRelaxedTasks,
                                      long seed)
Constructs with a specified seed.

Parameters:
nbRelaxedTasks - number of task variables to let free
seed - random seed

RandomTaskNeighborhoodOperator

public RandomTaskNeighborhoodOperator(int minNbRelaxedTasks,
                                      int maxNbRelaxedTasks,
                                      long seed)
Constructs with a specified seed and a variable neighborhood size.

Parameters:
minNbRelaxedTasks - minimum number of task variables to let free
maxNbRelaxedTasks - maximum number of task variables to let free
seed - random seed
Method Detail

restrictNeighborhood

public boolean restrictNeighborhood(Solution solution)
restrict the search space around the solution by selecting nbRelaxedTasks task variables randomly to let free and by fixing all other task 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.