Class Update
- Direct Known Subclasses:
PhaseDominanceUpdate,PhaseGreedyUpdate,PhaseQualityIndexUpdate
public abstract class Update
extends java.lang.Object
The update strategy should specify:
- The update condition which determines when to update the active set, and
- The update criterion which determines how to update the active set (which heuristic to include in the active set)
canUpdate
method of this class. The logic for the update criterion should be implemented in
performUpdate method of this class.-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.lang.Integer>activeListThe active set which contains the indexes of heuristics in the universal set.protected java.util.List<java.lang.Integer>heurListThe universal set which contains the heuristic unique identifiersprotected MeasuremeasureThe performance measure that measures the value of low-level heuristicsintnumRemoveintnumResetintnumUpdatesprotected RemoveremoveThe removal strategyprotected ResetresetThe reset strategyprotected RunStatrunStatThe run statistics to record the heuristic performance. -
Constructor Summary
Constructors Constructor Description Update() -
Method Summary
Modifier and Type Method Description protected abstract booleancanUpdate()Returnstrueif the active set is to be updated andfalseotherwise.java.util.List<java.lang.Integer>getActiveList()Returns an array list of the indexes of the heuristics currently in the active set.protected abstract voidperformUpdate()Determines which heuristics to include in the active set.voidsetHeurList(int[] heurArray)Sets the universal set for this dynamic heuristic set.voidsetMeasure(Measure measure)Sets the performance measure for this update strategy.voidsetRemove(Remove remove)Sets the removal strategy for this update strategy.voidsetReset(Reset reset)Sets the reset strategy for this update strategy.voidsetRunStat(RunStat runStat)Sets therunStatfield of this update strategy.java.util.List<java.lang.Integer>updateActiveList()Updates and returns the active set.
-
Field Details
-
runStat
The run statistics to record the heuristic performance. -
measure
The performance measure that measures the value of low-level heuristics -
remove
The removal strategy- See Also:
Remove
-
reset
The reset strategy- See Also:
Reset
-
numUpdates
public int numUpdates -
numRemove
public int numRemove -
numReset
public int numReset -
heurList
protected java.util.List<java.lang.Integer> heurListThe universal set which contains the heuristic unique identifiers -
activeList
protected java.util.List<java.lang.Integer> activeListThe active set which contains the indexes of heuristics in the universal set.It is very important to note the difference between
activeList(active set) andheurList(universal set). The universal set contains integer identifiers where each element in the universal set uniquely identifies one heuristic. The active set contains the indexes (positions) of the heuristics as appear in the universal set. For instance, the universal set may contain[3,5,7,9]and if the heuristics identified by 3, 7 are in the active set, then the active set is[0,2]
-
-
Constructor Details
-
Update
public Update()
-
-
Method Details
-
setRunStat
Sets therunStatfield of this update strategy.- Parameters:
runStat- the observer that record the performance of heuristics
-
setMeasure
Sets the performance measure for this update strategy.- Parameters:
measure- the performance measure
-
setRemove
Sets the removal strategy for this update strategy.- Parameters:
remove- the removal strategy
-
setReset
Sets the reset strategy for this update strategy.- Parameters:
reset- the reset strategy
-
setHeurList
public void setHeurList(int[] heurArray)Sets the universal set for this dynamic heuristic set.The universal set should contain all heuristics represented in an array of integers where each integer identifies a unique heuristic.
- Parameters:
heurArray- an integer array where each integer uniquely identifies a heuristic
-
canUpdate
protected abstract boolean canUpdate()Returnstrueif the active set is to be updated andfalseotherwise.In this method, you should use the
RunStatfield to access the run information that you may need to decides whether to update the active set.- Returns:
trueif the active set is to be updated andfalseotherwise.
-
updateActiveList
public java.util.List<java.lang.Integer> updateActiveList()Updates and returns the active set.This method should be used as this. To specify your own update strategy you need to implement
canUpdate(update condition) andperformUpdate(update criterion).- Returns:
- an array list containing the indexes of the heuristics currently in the active set.
-
performUpdate
protected abstract void performUpdate()Determines which heuristics to include in the active set.This method should contain your logic for updating the active set. You can access the
runStatandmeasurefields in your implementation to get the search-status information and measure the performance of heuristics. regarding the search -
getActiveList
public java.util.List<java.lang.Integer> getActiveList()Returns an array list of the indexes of the heuristics currently in the active set.Note that each element in the returned array list is an index of a heuristic in the universal set. This is should not be confused by the integer identifiers contained the universal set.
- Returns:
- the active set
-