|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.coinor.opents.SimpleTabuList
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
Move
,
Solution
,
Serialized FormField 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 |
public static final int DEFAULT_TENURE
Constructor Detail |
public SimpleTabuList()
SimpleTabuList
with the
DEFAULT_TENURE
value of ten (10).
public SimpleTabuList(int tenure)
SimpleTabuList
with a given tenure.
tenure
- the tabu list's tenureMethod Detail |
public boolean isTabu(Solution fromSolution, Move move)
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.
isTabu
in interface TabuList
move
- A move
Move
,
Solution
public void setTabu(Solution fromSolution, Move move)
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.
setTabu
in interface TabuList
move
- The Move
to registerMove
,
Solution
public int getTenure()
public void setTenure(int tenure)
tenure
- the tabu list's new tenure
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |