Examples
Class ExampleHyperHeuristic2
java.lang.Object
AbstractClasses.HyperHeuristic
Examples.ExampleHyperHeuristic2
public class ExampleHyperHeuristic2
- extends HyperHeuristic
This class shows an example hyper-heuristic which demonstrates that each ProblemDomain object has a modifiable solution memory.
it is intended to be read after the ExampleHyperHeuristic1 class has been understood.
this hyper-heuristic maintains a memory of ten solutions. A randomly chosen low level heuristic is applied to the
best solution in the memory, and the solution is immediately accepted. the new solution overwrites the old solution
at the same memory index. If the solution is worse, then the best solution in the memory will most likely be different now.
therefore, the memory is searched for the current best solution, so that it can be used in the next iteration.
Constructor Summary |
ExampleHyperHeuristic2(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 |
ExampleHyperHeuristic2
public ExampleHyperHeuristic2(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