next up previous contents
Next: The Implementation Code: dp.c: Up: Dynamic Programming Objects: Previous: Dynamic Programming Objects:

The header File: dp.h

#ifndef INCLUDE_DP
#define INCLUDE_DP

#ifndef INCLUDE_VOIDGRAPH
#include "voidgraph.h"
#endif

class Graph;
class ostream;
class istream;

class DP{
  struct DPEdgeStruct{
    float time;
    };
  struct DPNodeStruct{
    double value;
    double previous_value;
    Gedge *control;
    };
  friend istream& operator>>(istream& in, DP& A);
  friend istream& operator>>(istream& in, DP* A);
  friend ostream& operator<<(ostream& out,const DP& A);
  friend ostream& operator<<(ostream& out,const DP* A);
  public:
    DP(Graph *G_in): G(G_in) {;};
    DP(){ G = NULL;};
    ~DP();   
    istream& grab(istream& in); 
    ostream& print(ostream& out) const;

    double get_node_value(Gnode *gnode);
    void load_node_value(Gnode *gnode,double x);
    double get_previous_node_value(Gnode *gnode);
    void load_previous_node_value(Gnode *gnode,double x);
    Gedge *get_control(Gnode *gnode);
    void load_control(Gnode *gnode,Gedge *choice);
    DP& GenerateObstacleArray(char *filename);
    DP& ReadObstacleFile(char *filename);
    void backward_local_min(Gnode* gnode);
    void backward_value_iteration(char * goal);
    void backward_solve(double DP_Tolerance,const int Loop_Size,char *goal);
    void forward_local_min(Gnode* gnode);
    void forward_value_iteration(char * start);
    void forward_solve(double DP_Tolerance,const int Loop_Size,char *start);
    void BackwardPathPrint(Gnode *start,Gnode *goal);
    void ForwardPathPrint(Gnode *start,Gnode *goal);
    static double NEG_INF;
    static double POS_INF; 
  private:
    Graph *G;
  };
#endif



Jim Peterson
1999-04-13