public class SimulatedAnnealingSearch extends java.lang.Object implements SearchForActions, SearchForStates
function SIMULATED-ANNEALING(problem, schedule) returns a solution state
current <- MAKE-NODE(problem.INITIAL-STATE)
for t = 1 to INFINITY do
T <- schedule(t)
if T = 0 then return current
next <- a randomly selected successor of current
/\E <- next.VALUE - current.value
if /\E > 0 then current <- next
else current <- next only with probability eˆ(/\E/T)
Figure 4.5 The simulated annealing search algorithm, a version of stochastic
hill climbing where some downhill moves are allowed. Downhill moves are
accepted readily early in the annealing schedule and then less often as time
goes on. The schedule input determines the value of the temperature T as a
function of time.| Modifier and Type | Class and Description |
|---|---|
static class |
SimulatedAnnealingSearch.SearchOutcome |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
METRIC_NODE_VALUE |
static java.lang.String |
METRIC_NODES_EXPANDED |
static java.lang.String |
METRIC_TEMPERATURE |
| Constructor and Description |
|---|
SimulatedAnnealingSearch(HeuristicFunction hf)
Constructs a simulated annealing search from the specified heuristic
function and a default scheduler.
|
SimulatedAnnealingSearch(HeuristicFunction hf,
Scheduler scheduler)
Constructs a simulated annealing search from the specified heuristic
function and scheduler.
|
SimulatedAnnealingSearch(HeuristicFunction hf,
Scheduler scheduler,
NodeExpander nodeExpander) |
| Modifier and Type | Method and Description |
|---|---|
java.util.List<Action> |
findActions(Problem p)
Returns a list of actions to the goal if the goal was found, a list
containing a single NoOp Action if already at the goal, or an empty list
if the goal could not be found.
|
Node |
findNode(Problem p) |
java.lang.Object |
findState(Problem p)
Returns a state which is might be but not necessary is a goal state of
the problem.
|
java.lang.Object |
getLastSearchState()
Returns the last state from which the simulated annealing search found a
solution state.
|
Metrics |
getMetrics()
Returns all the search metrics.
|
NodeExpander |
getNodeExpander()
Returns the node expander used by the search.
|
SimulatedAnnealingSearch.SearchOutcome |
getOutcome() |
double |
probabilityOfAcceptance(double temperature,
double deltaE)
Returns e&deltaE / T
|
public static final java.lang.String METRIC_NODES_EXPANDED
public static final java.lang.String METRIC_TEMPERATURE
public static final java.lang.String METRIC_NODE_VALUE
public SimulatedAnnealingSearch(HeuristicFunction hf)
hf - a heuristic functionpublic SimulatedAnnealingSearch(HeuristicFunction hf, Scheduler scheduler)
hf - a heuristic functionscheduler - a mapping from time to "temperature"public SimulatedAnnealingSearch(HeuristicFunction hf, Scheduler scheduler, NodeExpander nodeExpander)
public java.util.List<Action> findActions(Problem p)
SearchForActionsfindActions in interface SearchForActionsp - the search problempublic java.lang.Object findState(Problem p)
SearchForStatesfindState in interface SearchForStatesp - the search problempublic double probabilityOfAcceptance(double temperature,
double deltaE)
temperature - T, a "temperature" controlling the probability of
downward stepsdeltaE - VALUE[next] - VALUE[current]public SimulatedAnnealingSearch.SearchOutcome getOutcome()
public java.lang.Object getLastSearchState()
public NodeExpander getNodeExpander()
SearchForActionsgetNodeExpander in interface SearchForActionsgetNodeExpander in interface SearchForStatespublic Metrics getMetrics()
getMetrics in interface SearchForActionsgetMetrics in interface SearchForStates