⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main.c

📁 intel ipp4.1性能库的一些例子。
💻 C
📖 第 1 页 / 共 2 页
字号:
/********************************************************************* * File: main.c * Description: The main routine for ipp. * * Author: Joerg Hoffmann / Frank Rittinger / Andreas Schoen *  *********************************************************************/ /********************************************************************* * (C) Copyright 1998 Albert Ludwigs University Freiburg *     Institute of Computer Science * * All rights reserved. Use of this software is permitted for  * non-commercial research purposes, and it may be copied only  * for that use.  All copies must include this copyright message. * This software is made available AS IS, and neither the authors * nor the  Albert Ludwigs University Freiburg make any warranty * about the software or its performance.  *********************************************************************/#include "ipp.h"#include "output.h"#include "utilities.h"#include "memory.h"#include "pddl.h"#include "pddl-types.h"#include "instantiateI.h"#include "instantiateII.h"#include "instantiateIII.h"#include "instantiateIV.h"#include "rifo.h"#include "build_graph.h"#include "exclusions.h"#include "search_plan.h"#include "memoize.h"#include "wave_front.h"#include "save_graph.h"/* *  ----------------------------- GLOBAL VARIABLES ---------------------------- *//******************* * GENERAL HELPERS * *******************//* used to time the different stages of the planner */struct tms gstart, gend, lstart, lend;float gtotal_time = 0, gexcl_time = 0;/* the command line inputs */struct _command_line gcmd_line;/* simple help: store names of connectives */char *gconnectives[] = {"ATOM", "NOT", "AND", "OR", "ALL", "EX", "WHEN",			 "TRU", "FAL", "EMPTY", "DUMMY", "NEUTRAL"};/* word size of the used machine */const int gcword_size = sizeof(int) * 8;/* record memory consumption */int gmemory = 0, rifo_memory = 0, ggraph_memory = 0, gexcl_memory = 0;int gmemo_memory = 0, gwave_memory = 0;/* default graph save name */char gdef_save_name[MAX_LENGTH] = "graph";/*********** * PARSING * ***********//* used for pddl parsing, flex only allows global variables */int gbracket_count = 0;char *gproblem_name;/* The current input line number */int lineno = 1;/* The current input filename */char *gact_filename;/* The pddl domain name */char *gdomain_name = NULL;/* loaded, uninstantiated operators */PlOperator *gloaded_ops = NULL;/* stores initials as fact_list  */PlNode *gorig_initial_facts = NULL;/* not yet preprocessed goal facts */PlNode *gorig_goal_facts = NULL;/* axioms as in UCPOP before being changed to ops */PlOperator *gloaded_axioms = NULL;/* the types, as defined in the domain file */TypedList *gparse_types = NULL;/* the constants, as defined in domain file */TypedList *gparse_constants = NULL;/* the predicates and their arg types, as defined in the domain file */TypedListList *gparse_predicates = NULL;/* the objects, declared in the problem file */TypedList *gparse_objects = NULL;/* connection to instantiation ( except ops, goal, initial ) *//* all typed objects  */FactList *gorig_constant_list = NULL;/* the predicates and their types */FactList *gpredicates_and_types = NULL;/* type hierarchy (PDDL)  */type_tree_list gglobal_type_tree_list;/* helper for types parsing */FactList *gtypes;/* switching between AIPS-2000 Competion Style   and original IPP format */int gofficial_output_style = FALSE;int gnum_plan_ops;/***************** * INSTANTIATING * *****************//* global arrays of constant names, *               type names (with their constants), *               predicate names, *               predicate aritys, *               defined types of predicate args */String gconstants_table[MAX_CONSTANTS_TABLE];int gconstants_table_size = 0;StringIntegers gtypes_table[MAX_TYPES_TABLE];int gtype_size[MAX_TYPES_TABLE];int gtypes_table_size = 0;String gpredicates_table[MAX_PREDICATES_TABLE];int garity[MAX_PREDICATES_TABLE];int gpredicates_args_type[MAX_PREDICATES_TABLE][MAX_ARITY];int gpredicates_table_size = 0;/* the parsed input structures, translated into CodeNodes */CodeNode *gcode_initial_state = NULL;CodeNode *gcode_goal_state = NULL;CodeOperator *gcode_operators = NULL;/* helper in solving the Atomic Instantiation problem:  *                                    the implicit tuple tables * * ( see Technical Report 122, "Handling of Inertia in a Planning System" ) */int_pointer gtuples[MAX_PREDICATES_TABLE];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 ) */Bool gis_added[MAX_PREDICATES_TABLE];Bool gis_deleted[MAX_PREDICATES_TABLE];/* store the final "relevant facts", see TR 122 */RelevantFact_pointer grelevant_facts[MAX_RELEVANT_FACTS];int gnum_relevant_facts = 0;CodeOperator *ginst_code_operators = NULL;/* helper: first get all inst.ops *//* standard name for inferred types ( unary inertia, see TR 122 ) */char gnew_types_name[MAX_LENGTH] = "INFERRED TYPE";/* standard name for GOAL-REACHED fact, as needed for disjunctive goals */char ggoal_reached_name[MAX_LENGTH] = "GOAL-REACHED";/************************* * BITMAP REPRESENTATION * *************************//* the bitvector length for relevant facts */int gft_vector_length;/* final representation of ops, *                         initial state, *                         goal state */BitOperator *gbit_operators = NULL;int gnum_bit_operators = 0;FactInfoPair *gbit_initial_state = NULL;FactInfoPair *gbit_goal_state = NULL;/********************** * RIFO               * **********************//* default metastrategy for rifo ( 0 = none ) */int rifo_meta = 0;/* threshold values to decide about use of metastrategy */ int action_threshold = 1000;int objects_threshold = 25;Bool new_plan = FALSE;/********************** * BUILDING THE GRAPH * **********************/ /*  * dis is da graph! * * will later be allocated as an array of pointers to fact nodes */FtNode_pointer *gft_table;/* points to the first element of a global operator (ft) -node-list; */ OpNode *gall_ops_pointer = NULL;OpNode *gprev_level_ops_pointer = NULL;FtNode *gall_fts_pointer = NULL;FtNode *gprev_level_fts_pointer = NULL;OpNode *gops_with_unactivated_effects_pointer = NULL;/* current mutexes: exclusives speedup */OpPair *gop_mutex_pairs = NULL;FtPair *gft_mutex_pairs = NULL;/* information about current state of graph, needed for level off test */unsigned int gfacts_count = 0, gexclusions_count = 0;unsigned int gops_count = 0, gops_exclusions_count = 0;/* for comparison: mutex number between positives */int gprint_ftnum = 0, gprint_exnum = 0;/* the present facts ordered by levels as bitvectors */BitVector_pointer gpos_facts_vector_at[MAX_PLAN];BitVector_pointer gneg_facts_vector_at[MAX_PLAN];/* the bitvector length for ops at each graph level */unsigned int gop_vector_length_at[MAX_PLAN];/* is TRUE iff graph has levelled off. */Bool gsame_as_prev_flag = FALSE;/* stores the time step at which graph has levelled off. */int gfirst_full_time = 0;Bool gwf_found_plan = FALSE;/************* * SEARCHING * *************/ /* current state of search: goals at levels, *                          same as bitvectors, *                          selected ops */FtArray *ggoals_at;int *gnum_goals_at;BitVector_pointer gpos_goals_vector_at[MAX_PLAN];BitVector_pointer gneg_goals_vector_at[MAX_PLAN];OpArray *gops_at;int *gnum_ops_at;OpArray gplan_ops;int gnum_plan_ops;/* the wave front, currently implemented as a doubly * connected linear list */Candidate *gwave_front_head;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 */Candidate *gwave_front_trash;/* search space information: actions, noops tried, *                           memoization (UBTree) hits */int gnum_of_actions_tried = 0, gnum_of_noops_tried = 0;int gsimple_hits = 0, gpartial_hits = 0, gsubset_hits = 0;/* 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 ? */Candidate *gplan_start;/* *  ----------------------------- HEADERS FOR PARSING ---------------------------- * ( fns defined in the scan-* files ) */void get_fct_file_name( char *filename );void load_ops_file( char *filename );void load_fct_file( char *filename );/* *  ----------------------------- MAIN ROUTINE ---------------------------- */int main( int argc, char *argv[] ){  /* resulting name for ops file   */  char ops_file[MAX_LENGTH] = "";  /* same for fct file    */  char fct_file[MAX_LENGTH] = "";    int min_time = 0;  Bool reached_goals, found_plan = FALSE;    struct tms start, end;  float inst_time = 0, rifo_time = 0, rifo_total_time = 0, build_time = 0, search_time = 0;    CodeOperator *o;        /* start overall timing   */  times( &gstart );  lend = gend;    /* command line treatment   */  if ( argc == 1 || ( argc == 2 && *++argv[0] == '?' ) ) {    ipp_usage();    exit( USAGE_ERROR_CODE );  }  if ( !process_command_line( argc, argv ) ) {    ipp_usage();    exit( USAGE_ERROR_CODE );  }    /* make file names   */  /* one input name missing   */  if ( !gcmd_line.ops_file_name ||        !gcmd_line.fct_file_name ) {    fprintf(stdout, "\nipp: two input files needed\n\n");    ipp_usage();          exit( USAGE_ERROR_CODE );  }  /* add path info, complete file names will be stored in   * ops_file and fct_file    */  sprintf(ops_file, "%s%s", gcmd_line.path, gcmd_line.ops_file_name);  sprintf(fct_file, "%s%s", gcmd_line.path, gcmd_line.fct_file_name);  /* parse the input files   */  /* start parse & instantiation timing   */  times( &start );  /* domain file (ops)   */  if ( gcmd_line.display_info  ) {    fprintf(OUT, "\nipp: parsing domain file");  }   /* it is important for the pddl language to define the domain before    * reading the problem    */  load_ops_file( ops_file );  /* problem file (facts)   */    if ( gcmd_line.display_info  ) {    fprintf(OUT, " ... done.\nipp: parsing problem file");   }  load_fct_file( fct_file );  if ( gcmd_line.display_info  ) {    fprintf(OUT, " ... done.\n\n");  }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -