org.coinor.opents
Class ComplexTabuList

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

public class ComplexTabuList
extends java.lang.Object
implements TabuList

This implementation of a tabu list uses the ComplexMove's attributes() method to determine the move's identity. It is imperative that you add the attributes() and implement ComplexMove rather than just Move.

A double int array (int[][]) is used to store the attributes values, and a double 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-exp9
See Also:
Move, Solution, Serialized Form

Field Summary
static int DEFAULT_NUM_ATTR
          The value 2 will be used as the number of attributes if the null constructor is used.
static int DEFAULT_TENURE
          The value 10 will be used as the tenure if the null constructor is used.
 
Constructor Summary
ComplexTabuList()
          Constructs a ComplexTabuList with the DEFAULT_TENURE value of ten (10) and the DEFAULT_NUM_ATTR value of two (2).
ComplexTabuList(int tenure, int numAttr)
          Constructs a ComplexTabuList with a given tenure and number of attributes
 
Method Summary
 int getNumberOfAttributes()
          Returns the number of attributes in each move being tracked by this tabu list.
 int getTenure()
          Returns the tenure being used by this tabu list.
 boolean isTabu(Solution fromSolution, Move move)
          Determines if the ComplexMove is on the tabu list and ignores the Solution that is passed to it.
 void setTabu(Solution fromSolution, Move move)
          This method accepts a ComplexMove 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

DEFAULT_NUM_ATTR

public static final int DEFAULT_NUM_ATTR
The value 2 will be used as the number of attributes if the null constructor is used.

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

ComplexTabuList

public ComplexTabuList()
Constructs a ComplexTabuList with the DEFAULT_TENURE value of ten (10) and the DEFAULT_NUM_ATTR value of two (2).

Since:
1.0-exp3

ComplexTabuList

public ComplexTabuList(int tenure,
                       int numAttr)
Constructs a ComplexTabuList with a given tenure and number of attributes

Parameters:
tenure - the tabu list's tenure
numAttr - the number of attributes in each move to store
Since:
1.0-exp3
Method Detail

isTabu

public boolean isTabu(Solution fromSolution,
                      Move move)
Determines if the ComplexMove is on the tabu list and ignores the Solution that is passed to it. The move's identity is determined by its attributes() method.

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, ComplexMove, Solution

setTabu

public void setTabu(Solution fromSolution,
                    Move move)
This method accepts a ComplexMove 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 ComplexMove on the tabu list by calling the move's attributes() method.

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

getNumberOfAttributes

public int getNumberOfAttributes()
Returns the number of attributes in each move being tracked by this tabu list.

Returns:
number of attributes
Since:
1.0-exp9

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