|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.coinor.opents.ComplexTabuList
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
Move
,
Solution
,
Serialized FormField 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 |
public static final int DEFAULT_TENURE
public static final int DEFAULT_NUM_ATTR
Constructor Detail |
public ComplexTabuList()
ComplexTabuList
with the
DEFAULT_TENURE
value of ten (10) and the
DEFAULT_NUM_ATTR
value of two (2).
public ComplexTabuList(int tenure, int numAttr)
ComplexTabuList
with a given tenure
and number of attributes
tenure
- the tabu list's tenurenumAttr
- the number of attributes in each move to storeMethod Detail |
public boolean isTabu(Solution fromSolution, Move move)
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.
isTabu
in interface TabuList
move
- A move
Move
,
ComplexMove
,
Solution
public void setTabu(Solution fromSolution, Move move)
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.
setTabu
in interface TabuList
move
- The ComplexMove
to registerMove
,
ComplexMove
,
Solution
public int getNumberOfAttributes()
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 |