org.coinor.opents
Class SimpleTabuList

java.lang.Object
  extended byorg.coinor.opents.SimpleTabuList
All Implemented Interfaces:
java.io.Serializable, TabuList

public class SimpleTabuList
extends java.lang.Object
implements TabuList

This implementation of a tabu list uses the Move's hashCode() method to determine the move's identity. It is imperative that you override the hashCode() method with one that identifies the move appropriately for your problem.

An int array is used to store the hash code values, and a simple for loop checks for a move's presence when isTabu(...) is called.

You can resize the tabu list dynamically by calling setTenure(...). The data structure being used to record the tabu list grows if the requested tenure is larger than the array being used, but stays the same size if the tenure is reduced. This is for performance reasons and insures that you can change the size of the tenure often without a performance degredation.

This code is licensed for public use under the Common Public License version 0.5.
The Common Public License, developed by IBM and modeled after their industry-friendly IBM Public License, differs from other common open source licenses in several important ways:

Copyright © 2001 Robert Harder

Since:
1.0-exp3
See Also:
Move, Solution, Serialized Form

Field Summary
static int DEFAULT_TENURE
          The value 10 will be used as the tenure if the null constructor is used.
 
Constructor Summary
SimpleTabuList()
          Constructs a SimpleTabuList with the DEFAULT_TENURE value of ten (10).
SimpleTabuList(int tenure)
          Constructs a SimpleTabuList with a given tenure.
 
Method Summary
 int getTenure()
          Returns the tenure being used by this tabu list.
 boolean isTabu(Solution fromSolution, Move move)
          Determines if the Move is on the tabu list and ignores the Solution that is passed to it.
 void setTabu(Solution fromSolution, Move move)
          This method accepts a Move and Solution as arguments and updates the tabu list as necessary.
 void setTenure(int tenure)
          Sets the tenure used by the tabu list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_TENURE

public static final int DEFAULT_TENURE
The value 10 will be used as the tenure if the null constructor is used.

Since:
1.0-exp3
See Also:
Constant Field Values
Constructor Detail

SimpleTabuList

public SimpleTabuList()
Constructs a SimpleTabuList with the DEFAULT_TENURE value of ten (10).

Since:
1.0-exp3

SimpleTabuList

public SimpleTabuList(int tenure)
Constructs a SimpleTabuList with a given tenure.

Parameters:
tenure - the tabu list's tenure
Since:
1.0-exp3
Method Detail

isTabu

public boolean isTabu(Solution fromSolution,
                      Move move)
Determines if the Move is on the tabu list and ignores the Solution that is passed to it. The move's identity is determined by its hasCode() method, so it's imperative that you override the hashCode() method with one that identifies the move appropriately for your problem.

Specified by:
isTabu in interface TabuList
Parameters:
move - A move
Returns:
whether or not the tabu list permits the move.
Since:
1.0-exp3
See Also:
Move, Solution

setTabu

public void setTabu(Solution fromSolution,
                    Move move)
This method accepts a Move and Solution as arguments and updates the tabu list as necessary.

Although the tabu list may not use both of the passed arguments, both must be included in the definition. Records a Move on the tabu list by calling the move's hashCode() method. It's imperative that you override the hashCode() method with one that identifies the move appropriately for your problem.

Specified by:
setTabu in interface TabuList
Parameters:
move - The Move to register
Since:
1.0-exp3
See Also:
Move, Solution

getTenure

public int getTenure()
Returns the tenure being used by this tabu list.

Returns:
tabu list's tenure
Since:
1.0-exp3

setTenure

public void setTenure(int tenure)
Sets the tenure used by the tabu list. The data structure being used to record the tabu list grows if the requested tenure is larger than the array being used, but stays the same size if the tenure is reduced. This is for performance reasons and insures that you can change the size of the tenure often without a performance degredation. A negative value will be ignored.

Parameters:
tenure - the tabu list's new tenure
Since:
1.0-exp3