HOG2
OldSearchEnvironment.h
Go to the documentation of this file.
1 /*
2  * SearchEnvironment.h
3  * hog
4  *
5  * Created by Nathan Sturtevant on 4/5/07.
6  * Copyright 2007 Nathan Sturtevant, University of Alberta. All rights reserved.
7  *
8  */
9 
10 #ifndef OLDSEARCHENVIRONMENT_H
11 #define OLDSEARCHENVIRONMENT_H
12 
13 #include "Graph.h"
14 #include "Map.h"
15 
16 namespace OldSearchCode {
17 
19  {
20  public:
21  virtual ~SearchEnvironment() {}
22  virtual void getNeighbors(uint32_t nodeID, std::vector<uint32_t> &neighbors) = 0;
23  virtual double heuristic(uint32_t node1, uint32_t node2) = 0;
24  virtual double gcost(uint32_t node1, uint32_t node2) = 0;
25  virtual bool goalTest(uint32_t node, uint32_t goal) { return (node == goal); }
26  };
27 
29  {
30  public:
31  MapSearchEnvironment(Map *_map) :map(_map) { }
33  void getNeighbors(uint32_t nodeID, std::vector<uint32_t> &neighbors);
34  double heuristic(uint32_t node1, uint32_t node2);
35  double gcost(uint32_t node1, uint32_t node2);
36  private:
37  Map *map;
38  };
39 
41  {
42  public:
43  GraphSearchEnvironment(Graph *_graph) :g(_graph) { }
45  void getNeighbors(uint32_t nodeID, std::vector<uint32_t> &neighbors);
46  double heuristic(uint32_t node1, uint32_t node2);
47  double gcost(uint32_t node1, uint32_t node2);
48  private:
49  Graph *g;
50  };
51 
53  {
54  public:
55  MapGraphSearchEnvironment(Map *_map, Graph *_graph) :g(_graph), m(_map) { }
57  void getNeighbors(uint32_t nodeID, std::vector<uint32_t> &neighbors);
58  double heuristic(uint32_t node1, uint32_t node2);
59  double gcost(uint32_t node1, uint32_t node2);
60  private:
61  Graph *g;
62  Map *m;
63  };
64 
65 }
66 
67 #endif
OldSearchCode::SearchEnvironment::heuristic
virtual double heuristic(uint32_t node1, uint32_t node2)=0
Graph.h
OldSearchCode::MapSearchEnvironment::~MapSearchEnvironment
~MapSearchEnvironment()
Definition: OldSearchEnvironment.h:32
OldSearchCode::MapGraphSearchEnvironment::~MapGraphSearchEnvironment
~MapGraphSearchEnvironment()
Definition: OldSearchEnvironment.h:56
OldSearchCode::MapSearchEnvironment
Definition: OldSearchEnvironment.h:28
OldSearchCode::MapSearchEnvironment::map
Map * map
Definition: OldSearchEnvironment.h:37
OldSearchCode::GraphSearchEnvironment::GraphSearchEnvironment
GraphSearchEnvironment(Graph *_graph)
Definition: OldSearchEnvironment.h:43
OldSearchCode::MapGraphSearchEnvironment::g
Graph * g
Definition: OldSearchEnvironment.h:61
OldSearchCode
Definition: OldSearchEnvironment.cpp:12
OldSearchCode::SearchEnvironment::getNeighbors
virtual void getNeighbors(uint32_t nodeID, std::vector< uint32_t > &neighbors)=0
OldSearchCode::MapGraphSearchEnvironment::gcost
double gcost(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:125
Graph
A generic Graph class.
Definition: Graph.h:66
OldSearchCode::MapSearchEnvironment::gcost
double gcost(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:47
OldSearchCode::SearchEnvironment
Definition: OldSearchEnvironment.h:18
OldSearchCode::GraphSearchEnvironment::gcost
double gcost(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:84
OldSearchCode::GraphSearchEnvironment::getNeighbors
void getNeighbors(uint32_t nodeID, std::vector< uint32_t > &neighbors)
GraphSearchEnvironment.
Definition: OldSearchEnvironment.cpp:66
OldSearchCode::GraphSearchEnvironment::heuristic
double heuristic(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:76
OldSearchCode::MapGraphSearchEnvironment
Definition: OldSearchEnvironment.h:52
OldSearchCode::MapGraphSearchEnvironment::getNeighbors
void getNeighbors(uint32_t nodeID, std::vector< uint32_t > &neighbors)
MapGraphSearchEnvironment.
Definition: OldSearchEnvironment.cpp:93
OldSearchCode::SearchEnvironment::goalTest
virtual bool goalTest(uint32_t node, uint32_t goal)
Definition: OldSearchEnvironment.h:25
OldSearchCode::MapGraphSearchEnvironment::heuristic
double heuristic(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:109
OldSearchCode::MapGraphSearchEnvironment::m
Map * m
Definition: OldSearchEnvironment.h:62
OldSearchCode::SearchEnvironment::~SearchEnvironment
virtual ~SearchEnvironment()
Definition: OldSearchEnvironment.h:21
OldSearchCode::MapGraphSearchEnvironment::MapGraphSearchEnvironment
MapGraphSearchEnvironment(Map *_map, Graph *_graph)
Definition: OldSearchEnvironment.h:55
OldSearchCode::GraphSearchEnvironment
Definition: OldSearchEnvironment.h:40
OldSearchCode::MapSearchEnvironment::getNeighbors
void getNeighbors(uint32_t nodeID, std::vector< uint32_t > &neighbors)
Definition: OldSearchEnvironment.cpp:14
OldSearchCode::MapSearchEnvironment::heuristic
double heuristic(uint32_t node1, uint32_t node2)
Definition: OldSearchEnvironment.cpp:52
OldSearchCode::SearchEnvironment::gcost
virtual double gcost(uint32_t node1, uint32_t node2)=0
OldSearchCode::GraphSearchEnvironment::~GraphSearchEnvironment
~GraphSearchEnvironment()
Definition: OldSearchEnvironment.h:44
Map.h
OldSearchCode::MapSearchEnvironment::MapSearchEnvironment
MapSearchEnvironment(Map *_map)
Definition: OldSearchEnvironment.h:31
OldSearchCode::GraphSearchEnvironment::g
Graph * g
Definition: OldSearchEnvironment.h:49
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
Map
A tile-based representation of the world.
Definition: Map.h:142