core
Class UndirectedSearch<T>

java.lang.Object
  extended by core.Search<T>
      extended by core.UndirectedSearch<T>
Type Parameters:
T - the specific type of the states in the search space.
All Implemented Interfaces:
java.lang.Runnable
Direct Known Subclasses:
HillClimbing, SimulatedAnnealing

public abstract class UndirectedSearch<T>
extends Search<T>

This subclass of core.Search is the abstraction for every undirected search algorithm such as extended.HillClimbing or extended.SimulatedAnnealing. Inherent for all such algorithms is that they look for an optimum in a search space. According to that a undirected search can either search for a maximum or a minimum optimum. If a subclass does not change the behavior you have to give the search direction as argument to the constructor of this class.
(Most of the subclasses use the minimum search as default.)
If you want to change the search direction after creation you only have to use one of the following methods before initializing the search.

These methods will only return true if the new search direction has been changed.
If you implement your own undirected search make it a subclass of this Class in order to provide a transparent semantic for the search directions.
Note: There is a static field holding an instance of the java.util.Random, which should be used as random value generator.

Author:
Eden_06
See Also:
HillClimbing, SimulatedAnnealing

Field Summary
static java.util.Random random
          holds a global random value generator, which should be used by all subclasses
 
Fields inherited from class core.Search
neededSteps, result
 
Constructor Summary
UndirectedSearch(boolean minimum)
          Creates a new undirected search in the desired direction.
 
Method Summary
 boolean minimum()
          This method tells the subclasses whether it should search for minimum or maximum values.
 boolean searchMaximum()
          This method tells the search to look for maximum values.
 boolean searchMinimum()
          This method tells the search to look for minimum values.
 
Methods inherited from class core.Search
canPrepare, finalize, getResult, initialize, initialized, neededSteps, prepare, run, running, search, stop
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

random

public static final java.util.Random random
holds a global random value generator, which should be used by all subclasses

Constructor Detail

UndirectedSearch

public UndirectedSearch(boolean minimum)
Creates a new undirected search in the desired direction.
If the argument is true the search looks for a minimum other wise it looks for a maximum.

Parameters:
minimum - flag indicating whether the search looks for minimum values or not
Method Detail

searchMinimum

public final boolean searchMinimum()
This method tells the search to look for minimum values. Note: This operation is effective only before initialization.

Returns:
true if the search direction is set to minimum

searchMaximum

public final boolean searchMaximum()
This method tells the search to look for maximum values. Note: This operation is effective only before initialization.

Returns:
true if the search direction is set to maximum

minimum

public final boolean minimum()
This method tells the subclasses whether it should search for minimum or maximum values.

Returns:
true if the search looks for minimum values
false if the search looks for maximum values