S
- type of solution to optimizepublic final class HillClimbing<S> extends Object
Hillclimbing search to optimize a solution for a given Heuristic
.
The following are provided to enable the search:
Heuristic
-
To determine which solutions are better than another.
ActionGenerator
-
Provides the possible Action
s that transform the current solution into
another solution.
Validator
-
Determines if a given solution is valid.
This allows the ActionGenerator
to provide Action
s that may lead
to invalid solutions.
Sometimes this is useful for performance reasons.
The Validator
is optional and if not provided it's assumed that all solutions
are valid.
Modifier and Type | Class and Description |
---|---|
static class |
HillClimbing.Builder<S>
Builder for creating
HillClimbing instances. |
Modifier and Type | Method and Description |
---|---|
static <S> HillClimbing.Builder<S> |
builder()
Get a
HillClimbing.Builder that can be used to create a HillClimbing instance. |
Heuristic<S> |
getHeuristic()
The
Heuristic being used for the search. |
S |
search(S initial)
Search the solution space starting from the given starting point.
|
public Heuristic<S> getHeuristic()
Heuristic
being used for the search.public S search(S initial)
initial
- the starting pointpublic static <S> HillClimbing.Builder<S> builder()
HillClimbing.Builder
that can be used to create a HillClimbing
instance.S
- type of solution to optimizeCopyright © 2015. All rights reserved.