HOG2
SequenceAlignment.h
Go to the documentation of this file.
1 /*
2  * SequenceAlignment.h
3  * hog2
4  *
5  * Created by Nathan Sturtevant on 10/20/10.
6  * Copyright 2010 University of Denver. All rights reserved.
7  *
8  */
9 
10 
11 #include "SearchEnvironment.h"
12 #include <vector>
13 
14 #ifndef SequenceAlignment_H
15 #define SequenceAlignment_H
16 
17 typedef uint64_t SequenceAlignmentState;
19 
20 class SequenceAlignment : public SearchEnvironment<SequenceAlignmentState, SequenceAlignmentAction>
21 {
22 public:
23  SequenceAlignment(int length) :d(length) { }
24  virtual void GetSuccessors(const SequenceAlignmentState &nodeID, std::vector<SequenceAlignmentState> &neighbors) const;
25  virtual void GetActions(const SequenceAlignmentState &nodeID, std::vector<SequenceAlignmentAction> &actions) const;
26  //virtual int GetNumSuccessors(const SequenceAlignmentState &stateID) const;
29 
31 
32  virtual bool InvertAction(SequenceAlignmentAction &a) const;
33 
35  virtual double HCost(const SequenceAlignmentState &node1, const SequenceAlignmentState &node2) const;
36 
39  virtual double HCost(const SequenceAlignmentState &node) const
40  { assert(bValidSearchGoal); return HCost(node, searchGoal); }
41 
42  virtual double GCost(const SequenceAlignmentState &node1, const SequenceAlignmentState &node2) const;
43  virtual double GCost(const SequenceAlignmentState &node, const SequenceAlignmentAction &act) const;
44  virtual bool GoalTest(const SequenceAlignmentState &node, const SequenceAlignmentState &goal) const;
45 
47  virtual bool GoalTest(const SequenceAlignmentState &node) const
48  { return bValidSearchGoal&&(node == searchGoal); }
49 
50  virtual uint64_t GetStateHash(const SequenceAlignmentState &node) const;
51  virtual uint64_t GetActionHash(SequenceAlignmentAction act) const;
52 
53  virtual void OpenGLDraw() const { }
54  virtual void OpenGLDraw(const SequenceAlignmentState&) const { }
55  virtual void OpenGLDraw(const SequenceAlignmentState&, const SequenceAlignmentState&, float) const { }
56  virtual void OpenGLDraw(const SequenceAlignmentState&, const SequenceAlignmentAction&) const { }
57 private:
58  int d;
59 };
60 
61 #endif
SequenceAlignment
Definition: SequenceAlignment.h:20
SequenceAlignment::HCost
virtual double HCost(const SequenceAlignmentState &node) const
Heuristic value between node and the stored goal.
Definition: SequenceAlignment.h:39
SequenceAlignment::GetActions
virtual void GetActions(const SequenceAlignmentState &nodeID, std::vector< SequenceAlignmentAction > &actions) const
Definition: SequenceAlignment.cpp:23
SequenceAlignment::GoalTest
virtual bool GoalTest(const SequenceAlignmentState &node) const
Goal Test if the goal is stored.
Definition: SequenceAlignment.h:47
SequenceAlignment::GoalTest
virtual bool GoalTest(const SequenceAlignmentState &node, const SequenceAlignmentState &goal) const
Definition: SequenceAlignment.cpp:70
SequenceAlignment::GCost
virtual double GCost(const SequenceAlignmentState &node1, const SequenceAlignmentState &node2) const
Definition: SequenceAlignment.cpp:66
SequenceAlignment::ApplyAction
virtual void ApplyAction(SequenceAlignmentState &s, SequenceAlignmentAction a) const
Definition: SequenceAlignment.cpp:39
SequenceAlignment::OpenGLDraw
virtual void OpenGLDraw(const SequenceAlignmentState &, const SequenceAlignmentState &, float) const
Draw the transition at some percentage 0...1 between two states.
Definition: SequenceAlignment.h:55
SequenceAlignment::GetSuccessors
virtual void GetSuccessors(const SequenceAlignmentState &nodeID, std::vector< SequenceAlignmentState > &neighbors) const
Definition: SequenceAlignment.cpp:12
SequenceAlignment::GetAction
virtual SequenceAlignmentAction GetAction(const SequenceAlignmentState &s1, const SequenceAlignmentState &s2) const
Definition: SequenceAlignment.cpp:33
SequenceAlignment::HCost
virtual double HCost(const SequenceAlignmentState &node1, const SequenceAlignmentState &node2) const
Heuristic value between two arbitrary nodes.
Definition: SequenceAlignment.cpp:63
SequenceAlignment::d
int d
Definition: SequenceAlignment.h:58
SequenceAlignment::InvertAction
virtual bool InvertAction(SequenceAlignmentAction &a) const
Definition: SequenceAlignment.cpp:60
SearchEnvironment< SequenceAlignmentState, SequenceAlignmentAction >::searchGoal
SequenceAlignmentState searchGoal
Definition: SearchEnvironment.h:113
SearchEnvironment< SequenceAlignmentState, SequenceAlignmentAction >::bValidSearchGoal
bool bValidSearchGoal
Definition: SearchEnvironment.h:112
SequenceAlignment::OpenGLDraw
virtual void OpenGLDraw(const SequenceAlignmentState &) const
Definition: SequenceAlignment.h:54
SequenceAlignment::OpenGLDraw
virtual void OpenGLDraw(const SequenceAlignmentState &, const SequenceAlignmentAction &) const
Definition: SequenceAlignment.h:56
SequenceAlignment::GetStateHash
virtual uint64_t GetStateHash(const SequenceAlignmentState &node) const
Definition: SequenceAlignment.cpp:73
SequenceAlignment::GetActionHash
virtual uint64_t GetActionHash(SequenceAlignmentAction act) const
Definition: SequenceAlignment.cpp:74
SequenceAlignmentAction
int SequenceAlignmentAction
Definition: SequenceAlignment.h:18
SequenceAlignmentState
uint64_t SequenceAlignmentState
Definition: SequenceAlignment.h:17
SequenceAlignment::SequenceAlignment
SequenceAlignment(int length)
Definition: SequenceAlignment.h:23
SequenceAlignment::OpenGLDraw
virtual void OpenGLDraw() const
Definition: SequenceAlignment.h:53
SearchEnvironment
Definition: SearchEnvironment.h:30
node
Nodes to be stored within a Graph.
Definition: Graph.h:170
SequenceAlignment::GetNextState
virtual void GetNextState(const SequenceAlignmentState &, SequenceAlignmentAction, SequenceAlignmentState &) const
Definition: SequenceAlignment.cpp:54
SearchEnvironment.h