/*********************** PGraphplan ************************************** (C) Copyright 1999 Avrim Blum and John Langford, based on Graphplan code Copyright 1995 by Avrim Blum and Merrick Furst This software is made available AS IS, and neither the authors nor CMU make any warranty about the software or its performance. *************************************************************************/ #include "graphplan.h" #include /* The code consists of the following main parts. 1. Reading in the operator and fact files. 2. Creating the graph and performing instantiations (same as in Graphplan, but no longer using mutexs) 3. Propoagating "neededness" constraints and heuristic values 4. Doing forward chaining search with memoizing Note: can have planner minimize expected time to complete. In this case, failure within the time window gives utility (negative of time to complete) of VERYBAD. */ /* GLOBAL VARIABLES */ char junk[100]; fact_list the_types; /* list of all the different type decls */ probdef_list the_probs; /* list of probability definitions */ fact_list initial_facts, the_goals; /* initial facts and goals */ hashtable_t *fact_table, *op_table; /* the arrays of hash tables */ hashtable_t types_table; /* holds the types */ int *value_of_null; /* use for heuristic values */ extern int hash_hits, hash_inserts; /* entries in plan hash table */ /* these are defaults */ int MAXNODES = 256; /* default MAX number of nodes at any given time step. */ int DEBUG_FLAG = 0, do_remove = 2, do_heuristic_value = 1, debugging_mode = 0, do_minexp = 0, print_horizon = -1, print_path = 0; int done_creating_graph = 0; int VERYBAD = -100; /* utility of failing when minimizing expectation */ int *utilities; /* utility of solving goals at given time */ int util_of_failing; /* utility of not solving goals */ int do_completeness = 1; /* do completeness check */ /* other flags, counters, etc. */ int same_as_prev_flag = 0; /* graph layer is same as previous time step */ extern int number_of_recursive_calls, number_of_actions_tried; int bvec_len = 1; /* max facts in a time step / 32 */ int num_goals; int instrs(void) { printf("command line args. Use any of: \n \ -h for this list \n \ -o to specify operator file\n \ -f to specify fact file\n \ -t to specify a fixed number of time steps\n \ -i to specify info level 1, 2, or 3 (default is 0)\n \ -O