move state space search engine library to ck-libs
authorGengbin Zheng <gzheng@illinois.edu>
Fri, 11 Nov 2011 05:02:01 +0000 (23:02 -0600)
committerGengbin Zheng <gzheng@illinois.edu>
Fri, 11 Nov 2011 05:02:01 +0000 (23:02 -0600)
13 files changed:
examples/charm++/state_space_searchengine/3SAT/Makefile
examples/charm++/state_space_searchengine/BalancedTree/Makefile
examples/charm++/state_space_searchengine/Hamiltonian_SE/Makefile
examples/charm++/state_space_searchengine/Makefile.common
examples/charm++/state_space_searchengine/NQueens/Makefile
examples/charm++/state_space_searchengine/README
examples/charm++/state_space_searchengine/TSP_SE/Makefile
examples/charm++/state_space_searchengine/UnbalancedTreeSearch_SE/Makefile
src/libs/ck-libs/state_space_searchengine/Makefile [moved from examples/charm++/state_space_searchengine/searchengineLib/Makefile with 51% similarity]
src/libs/ck-libs/state_space_searchengine/searchEngine.C [moved from examples/charm++/state_space_searchengine/searchengineLib/searchEngine.C with 100% similarity]
src/libs/ck-libs/state_space_searchengine/searchEngine.ci [moved from examples/charm++/state_space_searchengine/searchengineLib/searchEngine.ci with 100% similarity]
src/libs/ck-libs/state_space_searchengine/searchEngine.h [moved from examples/charm++/state_space_searchengine/searchengineLib/searchEngine.h with 98% similarity]
src/libs/ck-libs/state_space_searchengine/searchEngine_impl.h [moved from examples/charm++/state_space_searchengine/searchengineLib/searchEngine_impl.h with 100% similarity]

index 6fb7873bdd6d1f43984d8c07a93d85dac0f92046..1e5225b3aa3e53a01d1ccee41749db059efdf635 100644 (file)
@@ -1,16 +1,11 @@
-CHARMC=charmc
 SRC_DIR=./
 MINISAT_DIR=./minisat
-OPTS =-g -I. -DUSEPRIORITY -DOPTIMIZE -D__ALWAYS_INLINE -DSTATISTIC -DONESOLUTION 
-
-OPTS += -I../searchengineLib -L../searchengineLib
+OPTS =-g -I. -DUSEPRIORITY -D__ALWAYS_INLINE -DSTATISTIC -DONESOLUTION 
 
 include ../Makefile.common
 
 all: main main_minisat
 
-include ../Makefile.common
-
 CMINISATFLAGS = -I$(MINISAT) -DMINISAT
 
 main:  main.o searchEngineAPI.o 
@@ -22,9 +17,6 @@ main.decl.h: $(SRC_DIR)/main.ci
 main.o: $(SRC_DIR)/defines.h $(SRC_DIR)/main.C main.decl.h
        $(CHARMC) $(OPTS) -c $(SRC_DIR)/main.C
 
-searchEngine.decl.h: $(SRC_DIR)/searchEngine.ci
-       $(CHARMC) $(OPTS) -E $(SRC_DIR)/searchEngine.ci
-
 searchEngineAPI.o: $(SRC_DIR)/searchEngineAPI.C $(SRC_DIR)/searchEngineAPI.h
        $(CHARMC) -c  $(SRC_DIR)/searchEngineAPI.C
 
index fa80e573b717457ba8cbb400fba432936c233471..b35c4d9fc1642fb93d1a174e91eb632127e3b2b8 100644 (file)
@@ -1,9 +1,6 @@
 
-override OPTS += -I../searchengineLib -L../searchengineLib
-
 include ../Makefile.common
 
-
 all: main  main.nb  main.ws
 
 projections: main.prj  main.nb.prj
index be27e22d044cec352ef006ca9e17491d03aa2182..398ee0b509ae92404d274db3818a853226af5916 100644 (file)
@@ -1,5 +1,5 @@
 
-override OPTS += -I../searchengineLib -L../searchengineLib -DVALUE_HEURISTIC #-DUSERSOLVER 
+override OPTS += -DVALUE_HEURISTIC #-DUSERSOLVER 
 
 include ../Makefile.common
 
index 8a4384167a614d9aa6b1a96c7044c22952c7ce40..66458ca44d6d622559d735e6f7be1bf80b81fa09 100644 (file)
@@ -1,5 +1,5 @@
 CHARMC_PATH = ../../../../bin
-CHARMC=$(CHARMC_PATH)/charmc -O3 $(OPTS)
+CHARMC=$(CHARMC_PATH)/charmc $(OPTS)
 
-override OPTS += -g -O3 -DADAPTIVE 
+#override OPTS += -g -O3 -DADAPTIVE 
 #-DUSEBITPRIORITY -DONESOLUTION -DADAPTIVE
index 38f3fea681097e6bc62e0182a9b12afad20f5672..a4248105dc6543e5bf40ec07685cf7531d65f717 100644 (file)
@@ -1,6 +1,4 @@
 
-override OPTS += -I../searchengineLib -L../searchengineLib
-
 include ../Makefile.common
 
 
index d71ae7e2fa403fd877b3491f7b00aa5364816302..09def146de459d6e810078764d7d04ccb0299e4b 100644 (file)
@@ -1,14 +1,18 @@
 Steps to use the search engine:
 
-(1) In Makefile.common in top level, set Charm++ path
-(2) Go to template directory.  
-  (1)If you are using priority, define -DUSEBITPRIORITY
+(1) build state space searchengine in charm++ libs
+  (1) cd charm/<build dir>/tmp/libs/ck-libs/state_space_searchengine
+  (2) type 'make OPTS=-O3'
 
-  type 'make'
+      If you are using priority, add -DUSEBITPRIORITY to OPTS,
+      and type 'make OPTS="-O3 -DUSEBITPRIORITY"'
 
-(3) Go to your own application directory. For example NQueens:
+    this will build two search engine libraries: libmodulesearchEngine.a and libmodulesearchEngine_bound.a (for branch-and-bound).
 
-   type 'make'.  Same macros with step 2.
+(2) Go to your own application directory. For example, 
+   type 'cd NQueens'
+
+   and then type 'make OPTS=-O3'.  Make sure to use the same macro as in step (1)/(2) above.
 
 
 *Files to be changed. 
index 2f4251212b72f026ed7feb0b9ba1c4bb0ea6fd14..232df3c64fec28cc4f01797df5d05b4d5403e27e 100644 (file)
@@ -1,7 +1,5 @@
 OPTS =  -DBRANCHBOUND #-DSTATISTIC#  -DOPTIMIZE #-DUSEPRIORITY -DOPTIMIZE #-DADPATIVE
 
-OPTS += -I../searchengineLib -L../searchengineLib
-
 include ../Makefile.common
 
 
index 0c5d3fab848b1363c38cbeca0eb5a9f8ddfe2e74..a2893f534a32a062943dea2f119f75aa61a9b5c8 100644 (file)
@@ -19,7 +19,6 @@ ifeq ($(RNG), ALFG)
 endif
 
 OPTS = -DBRG_C99_TYPES #-std=c99 
-OPTS += -I../searchengineLib -L../searchengineLib
 
 include ../Makefile.common
 
similarity index 51%
rename from examples/charm++/state_space_searchengine/searchengineLib/Makefile
rename to src/libs/ck-libs/state_space_searchengine/Makefile
index f32c41bee0156705c39f5826e3b650f88d6da6ad..3ca9d59308546524e29bf9fd1cee5df0a591dfa7 100644 (file)
@@ -1,46 +1,44 @@
 
-include ../Makefile.common
+#override OPTS += -DUSING_CONTROLPOINTS
+#override OPTS += -DUSEBITPRIORITY
 
-# remove -DBRANCHBOUND so that it can build a non-branchbound library
-override CHARMC := $(subst -DBRANCHBOUND, , $(CHARMC))
+###########  Don't change below this line ############
+
+CDIR=../../../..
+CHARMC=$(CDIR)/bin/charmc $(OPTS)
 
+# remove -DBRANCHBOUND so that it can build a non-branchbound library
+# override CHARMC := $(subst -DBRANCHBOUND, , $(CHARMC))
 
+HEADERS = searchEngine.h searchEngine_impl.h searchEngine.decl.h
 OBJS = searchEngine.o
 
 LIB1 = libmodulesearchEngine.a
-
 LIB2 = libmodulesearchEngine_bound.a
 
-#all: main main_prj
-all: lib
+all: $(CDIR)/lib/$(LIB1)   $(CDIR)/lib/$(LIB2)
+       /bin/cp $(HEADERS) $(CDIR)/include
 
-main: searchEngine.o main.o 
-       $(CHARMC) -language charm++  main.o searchEngine.o -o main
+$(CDIR)/lib/$(LIB1): $(LIB1)
+       /bin/cp $(LIB1)  $(CDIR)/lib/$(LIB1)
 
-main_prj: searchEngine.o main.o 
-       $(CHARMC) -language charm++  -tracemode projections main.o searchEngine.o -o main_prj
+$(CDIR)/lib/$(LIB2): $(LIB2)
+       /bin/cp $(LIB2)  $(CDIR)/lib/$(LIB2)
+       /bin/cp searchEngine_bound.decl.h  $(CDIR)/include
 
-main.decl.h: main.ci
-       $(CHARMC) main.ci
-
-main.o: main.C main.decl.h
-       $(CHARMC) -c  main.C
-
-searchEngine.o: searchEngine_impl.h searchEngine.h searchEngine.C searchEngine.decl.h
+searchEngine.o: $(HEADERS) searchEngine.C
        $(CHARMC) -c  searchEngine.C
 
 searchEngine.decl.h: searchEngine.ci
        $(CHARMC) -E searchEngine.ci
 
-lib: $(LIB1) $(LIB2)
-
 $(LIB1):  $(OBJS)
        $(CHARMC) -o $(LIB1) $(OBJS)
 
 $(LIB2):  searchEngine_bound.o
        $(CHARMC) -o $(LIB2)  searchEngine_bound.o
 
-searchEngine_bound.o: searchEngine_impl.h searchEngine.h searchEngine.C searchEngine.decl.h searchEngine.ci
+searchEngine_bound.o: $(HEADERS) searchEngine.C searchEngine.ci
        sed -e 's/module searchEngine/module searchEngine_bound/' searchEngine.ci > searchEngine_bound.ci && $(CHARMC) -DBRANCHBOUND -E  searchEngine_bound.ci
        $(CHARMC) -DBRANCHBOUND -c  searchEngine.C -o searchEngine_bound.o
 
similarity index 98%
rename from examples/charm++/state_space_searchengine/searchengineLib/searchEngine.h
rename to src/libs/ck-libs/state_space_searchengine/searchEngine.h
index 611297f16cf7a70dbe931c0651af16aed67822da..de2bd35ba1a204be1fbccca71eaf5bc58f4736de 100644 (file)
@@ -10,6 +10,8 @@
 #include "charm++.h"
 #include "cmipool.h"
 
+#define ADAPTIVE     1
+
 class Solver;
 class StateBase;
 class SearchNodeMsg;
@@ -64,7 +66,7 @@ extern int se_statesize;
 
 
 #ifdef BRANCHBOUND
-#ifndef ADAPTIVE
+#if ! ADAPTIVE
 #define SE_Register(state, f1, f2, f3, f4, f5)  \
     void registerSE() {    \
       SE_register(f1, f2, f3, f4, f5);   \
@@ -125,7 +127,7 @@ extern int se_statesize;
     void registerSE() {    \
       SE_register(f1, f2, f3, f4);   \
     }
-#ifndef ADAPTIVE
+#if ! ADAPTIVE
 #define SE_Register(state, f1, f2, f3, f4)  \
     registerSE_DEF(state, f1, f2, f3, f4)  \
     void createMultipleChildren(StateBase *parent, SequentialSolver* solver, bool parallel) {  \