dk.deepthought.sidious.planner
Class GreenhouseHeuristic

java.lang.Object
  extended by dk.deepthought.sidious.planner.GreenhouseHeuristic
All Implemented Interfaces:
Heuristic

public final class GreenhouseHeuristic
extends java.lang.Object
implements Heuristic

The class encapsulates the heuristic function of the A*-algorithm.

The heuristic is calculated by evaluating all rules associated with the requester of the plan. In this way the estimated cost of getting to the goal is very close to the actual distance.

Author:
Deepthought

Field Summary
private  double baseEuclidianDistance
          The base euclidian distance.
private  ClimaticState goal
          The goal of the search.
private  SuperLinkID id
          The id of the requester.
private static org.apache.commons.logging.Log logger
          Logger for this class
private  ClimaticState source
          The source of the search.
 
Constructor Summary
GreenhouseHeuristic(SuperLinkID id, State source, State goal)
          Constructs a new GreenhouseHeuristic with the specified id.
 
Method Summary
(package private)  double euclidianDistanceToGoal(ClimaticState state)
          Calculates the euclidian distance to the goal state.
 double h(State state)
          This heuristic is based upon a normalized Euclidian distance.
private  double normalizedEuclidian(ClimaticState state)
          Calculates the normalized euclidian cost of getting form any state to the goal state.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final org.apache.commons.logging.Log logger
Logger for this class


id

private final SuperLinkID id
The id of the requester.


goal

private ClimaticState goal
The goal of the search.


source

private ClimaticState source
The source of the search.


baseEuclidianDistance

private double baseEuclidianDistance
The base euclidian distance. distance(source, goal).

Constructor Detail

GreenhouseHeuristic

public GreenhouseHeuristic(SuperLinkID id,
                           State source,
                           State goal)
Constructs a new GreenhouseHeuristic with the specified id.

Parameters:
id - the id to the requester.
source - the source state of any path in the graph
goal - the goal state of any path in the graph
Method Detail

h

public double h(State state)
This heuristic is based upon a normalized Euclidian distance.

This distance is the distance from the current vertex to the goal divided by the distance from source to goal.

Specified by:
h in interface Heuristic
Parameters:
state - the input state for the calculation
Returns:
an approximate cost
See Also:
Heuristic.h(dk.deepthought.sidious.supportsystem.State)

normalizedEuclidian

private double normalizedEuclidian(ClimaticState state)
Calculates the normalized euclidian cost of getting form any state to the goal state.
 distance(any, goal) / distance(source, goal)
 

Parameters:
state - the state to calculate the distance from
Returns:
the normalized euclidian cost

euclidianDistanceToGoal

double euclidianDistanceToGoal(ClimaticState state)
Calculates the euclidian distance to the goal state.

Parameters:
state - the source state
Returns:
the euclidian distance


Copyright © Deepthought Development - All Rights Reserved.