00001 /* 00002 * Parallel state space search library 00003 * 00004 * Jonathan A. Booth 00005 * Fri Mar 28 19:01:25 CST 2003 00006 */ 00007 00008 #ifndef __UIUC_CHARM_SEARCH_H 00009 #define __UIUC_CHARM_SEARCH_H 00010 00011 // Grab all the charm stuff. 00012 #include <charm++.h> 00013 00014 // Define the problem class. We'll be passing 'problem *' pointers around. 00015 // The reason we do this is that we need it to keep the sub-class type 00016 // of the 'problem *' correct rather than having it tend to revert to a 00017 // plain old 'problem'. 00018 // 00019 // Of course that's sort of a pain with charm. 00020 #include "cklibs/problem.h" 00021 00022 // The serial tree class priovides a way to do a full-tree search of a node 00023 // for a depth up to depth whatever. I use this both internally in each 00024 // interior chare, and at the leaves of the tree. 00025 #include "cklibs/serialtree.h" 00026 00027 // Draw in the charm interface declarations. 00028 #include "cklibs/search.decl.h" 00029 00030 // This class definition is used to pass around the solution and nodes and 00031 // chares when a search is done. 00032 class searchResults : public CMessage_searchResults { 00033 public: 00034 // These three are real data that gets sent over the network 00035 CkGroupID GroupID; 00036 unsigned int NodesExpanded; 00037 unsigned int CharesExpanded; 00038 00039 // This is dummy data. 00040 problem * Solution; 00041 00042 // Create me. Set solution to null 00043 searchResults() : Solution(NULL) {}; 00044 00045 // Delete me, and the solution 00046 ~searchResults() { 00047 if ( Solution ) { delete Solution; } 00048 } 00049 00050 // The unpack function gets called on the remote processor after the message 00051 // has been received. I use it to fill the solution pointer with a pointer 00052 // to a local copy of the solution. I then tell the group that it can go 00053 // jump out a window. 00054 static searchResults * unpack(void *inbuf); 00055 }; 00056 00057 // The idaStar search, as well as fakeing the astar search are included 00058 // here. In this file are all the definitions you need to run an astar 00059 // or idastar search. 00060 #include "cklibs/idastar.h" 00061 00062 // If I had another search type like branch and bound, you'd include 00063 // it's header file here. You'd write the code in branchandbound.C 00064 // add that to the makefile and be happy. 00065 // #include "branchandbound.h" 00066 00067 #endif /* __UIUC_CHARM_SEARCH_H */