📄 ipp.h
字号:
typedef struct _OpNode OpNode, *OpNode_pointer;typedef struct _EfNode EfNode;typedef struct _FtNode FtNode, *FtNode_pointer;typedef struct _OpEdge OpEdge;typedef struct _EfEdge EfEdge;typedef struct _FtEdge FtEdge;typedef struct _OpLevelInfo OpLevelInfo, *OpLevelInfo_pointer;typedef struct _EfLevelInfo EfLevelInfo, *EfLevelInfo_pointer;typedef struct _FtLevelInfo FtLevelInfo, *FtLevelInfo_pointer;typedef FtNode_pointer FtArray[ARRAY_SIZE];typedef OpNode_pointer OpArray[ARRAY_SIZE];/* nodes in the memoization tree UBTree Data Structure */typedef struct _MemoNode MemoNode, *MemoNode_pointer;typedef MemoNode_pointer MemoNode_table[MEMO_HASHSIZE];/* * operator representation */struct _OpNode { char *name; short int num_vars, inst_table[MAX_VARS]; int index; int uid_block; unsigned int uid_mask; FtEdge *preconds;/* a list of pointers to the nodes for its preconds */ EfNode *unconditional; EfNode *conditionals; Bool is_noop;/* is it a noop ? (used in printing out the plan) */ OpLevelInfo_pointer info_at[MAX_PLAN];/* level-dependent info */ BitVector *pos_precond_vector; BitVector *neg_precond_vector; struct _OpNode *next;/* ops are globally stored as a list */ Effect *unactivated_effects; struct _OpNode *thread;};/* * effects... */struct _EfNode { OpNode *op;/* the op it belongs to */ unsigned int first_occurence;/* ...of this effect in the graph */ FtEdge *conditions; FtEdge *effects; BitVector *pos_effect_vector; BitVector *neg_effect_vector; EfLevelInfo_pointer info_at[MAX_PLAN]; struct _EfNode *next;};/* * ...and facts. */struct _FtNode { int index;/* index in fact hierarchy */ int uid_block; unsigned int uid_mask; Bool positive;/* is it the positive occurence ? */ OpNode *noop;/* to make noops - first strategy explizit */ EfEdge *adders;/* the effects that add this fact */ OpEdge *preconds; FtLevelInfo_pointer info_at[MAX_PLAN+1];/* level dependent information */ struct _FtNode *next;};/* simply a list element for op-edge-lists. */struct _OpEdge { OpNode *op; struct _OpEdge *next;};/* simply a list element for effect-edge-lists. */struct _EfEdge { EfNode *ef; struct _EfEdge *next;};/* same for facts */struct _FtEdge { FtNode *ft; struct _FtEdge *next;};/* * info for an op that changes during evolution of graph */struct _OpLevelInfo { int is_used; BitVector *exclusives;};struct _EfLevelInfo { Bool is_dummy; BitVector *cond_pos_exclusives; BitVector *cond_neg_exclusives;};/* * level dependent info for facts */struct _FtLevelInfo { EfEdge *adders_pointer; Bool is_dummy; int is_goal; int is_true; OpArray is_goal_for; BitVector *pos_exclusives; BitVector *neg_exclusives; BitVector *adders; BitVector *adders_exclusives; MemoNode *memo_start;};typedef struct _OpPair { OpNode *o1; OpNode *o2; struct _OpPair *next;} OpPair;typedef struct _FtPair { FtNode *f1; FtNode *f2; struct _FtPair *next;} FtPair;/************************ * SEARCHING STRUCTURES * ************************//* the UBTree node structure * * ( see Technical Report 108, "A new Method to index and query Sets" ) */struct _MemoNode { int double_index; MemoNode_table *sons; int min_way; /* bei sortierung zusaetzlich *prev */ struct _MemoNode *next;};/* a candidate node in the wave front * * ( Fox / Long: "Fast implementation of the planning graph in STAN" ) */typedef struct _Candidate { FtArray fts; OpArray ops; struct _Candidate *father; int depth; struct _Candidate *prev; struct _Candidate *next;} Candidate;/* * -------------------------------- MAIN FN HEADERS ---------------------------- */void output_planner_info( float inst_time, float rifo_time, float build_time, float excl_time, float search_time, int min_time );void ipp_usage( void );Bool process_command_line( int argc, char *argv[] );void print_official_result();/* * ----------------------------- GLOBAL VARIABLES ---------------------------- *//******************* * GENERAL HELPERS * *******************//* used to time the different stages of the planner */extern struct tms gstart, gend;extern float gtotal_time, gexcl_time;/* the command line inputs */extern struct _command_line gcmd_line;/* simple help: store names of connectives */extern char *gconnectives[];/* word size of the used machine */extern const int gcword_size;/* record memory consumption */extern int gmemory, rifo_memory, ggraph_memory, gexcl_memory, gmemo_memory, gwave_memory;/* default graph save name */extern char gdef_save_name[MAX_LENGTH];/*********** * PARSING * ***********//* used for pddl parsing, flex only allows global variables */extern int gbracket_count;extern char *gproblem_name;/* The current input line number */extern int lineno;/* The current input filename */extern char *gact_filename;/* The pddl domain name */extern char *gdomain_name;/* loaded, uninstantiated operators */extern PlOperator *gloaded_ops;/* stores initials as fact_list */extern PlNode *gorig_initial_facts;/* not yet preprocessed goal facts */extern PlNode *gorig_goal_facts;/* axioms as in UCPOP before being changed to ops */extern PlOperator *gloaded_axioms;/* the types, as defined in the domain file */extern TypedList *gparse_types;/* the constants, as defined in domain file */extern TypedList *gparse_constants;/* the predicates and their arg types, as defined in the domain file */extern TypedListList *gparse_predicates;/* the objects, declared in the problem file */extern TypedList *gparse_objects;/* connection to instantiation ( except ops, goal, initial ) *//* all typed objects */extern FactList *gorig_constant_list;/* the predicates and their types */extern FactList *gpredicates_and_types;/* type hierarchy (PDDL) */extern type_tree_list gglobal_type_tree_list;/* helper for types parsing */extern FactList *gtypes;/* switching between AIPS-2000 Competion Style and original IPP format */extern int gofficial_output_style;extern int gnum_plan_ops;/***************** * INSTANTIATING * *****************//* global arrays of constant names, * type names (with their constants), * predicate names, * predicate aritys, * defined types of predicate args */extern String gconstants_table[MAX_CONSTANTS_TABLE];extern int gconstants_table_size;extern StringIntegers gtypes_table[MAX_TYPES_TABLE];extern int gtype_size[MAX_TYPES_TABLE];extern int gtypes_table_size;extern String gpredicates_table[MAX_PREDICATES_TABLE];extern int garity[MAX_PREDICATES_TABLE];extern int gpredicates_args_type[MAX_PREDICATES_TABLE][MAX_ARITY];extern int gpredicates_table_size;/* the parsed input structures, translated into CodeNodes */extern CodeNode *gcode_initial_state;extern CodeNode *gcode_goal_state;extern CodeOperator *gcode_operators;/* helper in solving the Atomic Instantiation problem: * the implicit tuple tables * * one table size is the size of one implicit table * (there are 2^{arity(predicate)} such tables for each predicate) * * ( see Technical Report 122, "Handling of Inertia in a Planning System" ) */extern int_pointer gtuples[MAX_PREDICATES_TABLE];extern int gone_table_size[MAX_PREDICATES_TABLE];/* stores inertia - information: is any occurence of the predicate * added / deleted in the uninstantiated ops ? * * ( see TR 122 ) */extern Bool gis_added[MAX_PREDICATES_TABLE];extern Bool gis_deleted[MAX_PREDICATES_TABLE];/* store the final "relevant facts", see TR 122 */extern RelevantFact_pointer grelevant_facts[MAX_RELEVANT_FACTS];extern int gnum_relevant_facts;extern CodeOperator *ginst_code_operators;/* helper: first get all instantiated ops *//* standard name for inferred types ( unary inertia, see TR 122 ) */extern char gnew_types_name[MAX_LENGTH];/* standard name for GOAL-REACHED fact, as needed for disjunctive goals */extern char ggoal_reached_name[MAX_LENGTH];/************************* * BITMAP REPRESENTATION * *************************//* the bitvector length for relevant facts */extern int gft_vector_length;/* final representation of ops, * initial state, * goal state */extern BitOperator *gbit_operators;extern int gnum_bit_operators;extern FactInfoPair *gbit_initial_state;extern FactInfoPair *gbit_goal_state;/********************** * RIFO * **********************//* which metastrategy is to be used to remove irrelevants before building the graph */extern int rifo_meta;extern int actions_threshold;extern int objects_threshold;/* used to make function build_graph_evolution_step() start with a new plan when replanning due to rifo failure */extern Bool new_plan;/********************** * BUILDING THE GRAPH * **********************/ /* * dis is da graph! * * will later be allocated as an array of pointers to fact nodes */extern FtNode_pointer *gft_table;/* points to the first element of a global operator (ft) -node-list; */ extern OpNode *gall_ops_pointer;extern OpNode *gprev_level_ops_pointer;extern FtNode *gall_fts_pointer;extern FtNode *gprev_level_fts_pointer;extern OpNode *gops_with_unactivated_effects_pointer;/* current mutexes: exclusives speedup */extern OpPair *gop_mutex_pairs;extern FtPair *gft_mutex_pairs;/* information about current state of graph, needed for level off test */extern unsigned int gfacts_count, gexclusions_count;extern unsigned int gops_count, gops_exclusions_count;/* for comparison: mutex number between positives */extern int gprint_ftnum, gprint_exnum;/* the present facts ordered by levels as bitvectors */extern BitVector_pointer gpos_facts_vector_at[MAX_PLAN];extern BitVector_pointer gneg_facts_vector_at[MAX_PLAN];/* the bitvector length for ops at each graph level */extern unsigned int gop_vector_length_at[MAX_PLAN];/* is TRUE iff graph has levelled off. */extern Bool gsame_as_prev_flag;/* stores the time step at which graph has levelled off. */extern int gfirst_full_time;extern Bool gwf_found_plan;/************* * SEARCHING * *************/ /* current state of search: goals at levels, * same as bitvectors, * selectde ops */extern FtArray *ggoals_at;extern int *gnum_goals_at;extern BitVector_pointer gpos_goals_vector_at[MAX_PLAN];extern BitVector_pointer gneg_goals_vector_at[MAX_PLAN];extern OpArray *gops_at;extern int *gnum_ops_at;extern OpArray gplan_ops;extern int gnum_plan_ops;/* the wave front, currently implemented as a doubly * connected linear list */extern Candidate *gwave_front_head;extern Candidate *gwave_front_tail;/* to avoid memory leak: keep a pointer on the list of * candidates that have been expanded and removed from * the wave front already */extern Candidate *gwave_front_trash;/* search space information: actions, noops tried, * memoization (UBTree) hits */extern int gnum_of_actions_tried, gnum_of_noops_tried;extern int gsimple_hits, gpartial_hits, gsubset_hits;/* only for communication from wave front to save graph: * to find out, which ops are used in the plan, we need * to search the list of candidates (connected by ->father) * that starts with the one Candidate that finally led to * a plan. * * not really good implementation style, but who does really * care about this ? */extern Candidate *gplan_start;#endif __IPP_H
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -