00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __UIUC_CHARM_ASTAR_H
00009 #define __UIUC_CHARM_ASTAR_H
00010
00011 #include <charm++.h>
00012 #include "cklibs/problem.h"
00013 #include "cklibs/serialtree.h"
00014 #include "cklibs/search.decl.h"
00015
00016
00017 void aStar(problem *issue,
00018 int maxdepth, int charesize, int serialdist,
00019 CkCallback finished);
00020
00021
00022 void idaStar(problem *issue,
00023 int startdepth, int maxdepth, int stride, int window,
00024 int charesize, int serialdist,
00025 CkCallback finished);
00026
00027
00028 class idaStarWorker : public CBase_idaStarWorker {
00029 protected:
00030 CkGroupID Master;
00031 problem *Issue;
00032 problem *Solution;
00033 SerialTree *Solver;
00034 int Waiting;
00035
00036 public:
00037 idaStarWorker(CkGroupID master,
00038 problem *issue, int maxdepth,
00039 int charesize, int serialdist);
00040 ~idaStarWorker();
00041 void ChildFinished(int dummy);
00042 };
00043
00044
00045
00046 class idaStarGroup : public CBase_idaStarGroup {
00047 protected:
00048 public:
00049 unsigned int NodesExpanded, CharesExpanded;
00050 problem *Issue;
00051 problem *Solution;
00052 unsigned int BestSolutionDepth;
00053 CkCallback Finished;
00054 int StartDepth, CurrentDepth, MaxDepth, Stride;
00055 int Running;
00056 int ChareSize, SerialDist;
00057
00058 protected:
00059 void Launch(problem *it, int maxdepth, int charesize, int serialdist);
00060
00061 public:
00062 idaStarGroup(problem *issue,
00063 int startdepth, int maxdepth, int stride, int window,
00064 int charesize, int serialdist,
00065 CkCallback finished);
00066 ~idaStarGroup();
00067
00068
00069 void ChildFinished(int dummy);
00070 void ReductionResults(CkReductionMsg *m);
00071 void SolutionFound(problem *soln);
00072 void SpawnIteration();
00073 void Terminate();
00074
00075
00076
00077 friend class idaStarWorker;
00078 };
00079
00080
00081 #endif