Examples
Class ExampleHyperHeuristic3
java.lang.Object
AbstractClasses.HyperHeuristic
Examples.ExampleHyperHeuristic3
public class ExampleHyperHeuristic3
- extends HyperHeuristic
This class presents an example hyper-heuristic which demonstrates how to use the different types of low level heuristic
in each Problem Domain. it is intended to be read after the ExampleHyperHeuristic2 class has been understood.
There are four types of low level heuristic within each domain of the competition software:
1) Local Search
2) Mutation
3) Ruin-Recreate
4) Crossover
the methods to retrieve the indices of the heuristics of each type are given in the example below.
if there are no heuristics of a certain type, then the method returns null. Using the information about the type of the heuristic
is potentially powerful, but it is important to check that the problem domain contains heuristics of that type, by checking
for equality with null. Examples of such checks can be seen in this class.
to apply a crossover heuristic, a different method must be used, which supplies two input solutions instead of one.
it is possible to supply the index of a crossover heuristic to the method which applies a non-crossover heuristic.
if this happens, the method will return the input solution unmodified. Therefore, the hyper-heuristic
strategy implemented in ExampleHyperHeuristic1.java occasionally chooses a crossover heuristic which does nothing, as it
is applied with only one input solution.
Constructor Summary |
ExampleHyperHeuristic3(long seed)
creates a new ExampleHyperHeuristic object with a random seed |
Method Summary |
void |
solve(ProblemDomain problem)
This method defines the strategy of the hyper-heuristic |
java.lang.String |
toString()
this method must be implemented, to provide a different name for each hyper-heuristic |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
ExampleHyperHeuristic3
public ExampleHyperHeuristic3(long seed)
- creates a new ExampleHyperHeuristic object with a random seed
solve
public void solve(ProblemDomain problem)
- This method defines the strategy of the hyper-heuristic
- Specified by:
solve
in class HyperHeuristic
- Parameters:
problem
- the problem domain to be solved
toString
public java.lang.String toString()
- this method must be implemented, to provide a different name for each hyper-heuristic
- Specified by:
toString
in class HyperHeuristic
- Returns:
- a string representing the name of the hyper-heuristic