예제 #1
0
파일: parse.c 프로젝트: amelim/RIP-2013
Bool make_strips_domain( void )

{

  PlOperator *i;
  FactList *ff;

  if ( !make_conjunction_of_atoms( &gorig_initial_facts ) ) {
    printf("\nillegal initial state");
    return FALSE;
  }

  if ( !make_conjunction_of_atoms( &gorig_goal_facts ) ) {
    printf("\nillegal goal state");
    return FALSE;
  }

  for ( i = gloaded_ops; i; i = i->next ) {
    if ( !make_conjunction_of_atoms( &(i->preconds) ) ) {
      printf("\nop %s has illegal precondition", i->name);
      return FALSE;
    }
    if ( !make_conjunction_of_literals( &(i->effects) ) ) {
      printf("\nop %s has illegal effects", i->name);
      return FALSE;
    }
  }

  if ( gcmd_line.display_info == 101 ) {
    printf("\nfinal STRIPS representation is:\n");
    printf("\nobjects:");
    for ( ff = gorig_constant_list; ff; ff = ff->next ) {
      printf("\n%s : %s", ff->item->item, ff->item->next->item);
    }
    printf("\n\ninitial state:\n");
    print_PlNode( gorig_initial_facts, 0 );
    printf("\n\ngoal state:\n");
    print_PlNode( gorig_goal_facts, 0 );
    printf("\n\nops:");
    print_plops( gloaded_ops );
  }

  return TRUE;
      
}
예제 #2
0
Bool make_adl_domain( void )

{

  PlOperator *i;
  FactList *ff;
  int j;

  if ( gcmd_line.display_info == 101 ) {
    printf("\noriginal problem parsing is:\n");
    printf("\nobjects:");
    for ( ff = gorig_constant_list; ff; ff = ff->next ) {
      printf("\n%s : %s", ff->item->item, ff->item->next->item);
    }
    printf("\n\ninitial state:\n");
    print_PlNode( gorig_initial_facts, 0 );
    printf("\n\ngoal state:\n");
    print_PlNode( gorig_goal_facts, 0 );
    printf("\n\nops:");
    print_plops( gloaded_ops );
  }

  if ( !make_initial_conjunction( &gorig_initial_facts ) ) {
    printf("\nillegal initial state");
    return FALSE;
  } else {
    if ( gcmd_line.display_info == 101 ) {
      printf("\n\norig parse split up initial state, facts:\n");
      print_PlNode( gorig_initial_facts, 0 );
      printf("\n\norig parse split up initial state, ors:\n");
      for ( j = 0; j < gnum_orig_initial_ors; j++ ) {
	print_PlNode( gorig_initial_ors[j], 0 );
      }
      printf("\n\norig parse split up initial state, oneofs:\n");
      for ( j = 0; j < gnum_orig_initial_oneofs; j++ ) {
	print_PlNode( gorig_initial_oneofs[j], 0 );
      }
      printf("\n\norig parse split up initial state, multis:\n");
      for ( j = 0; j < gnum_orig_initial_multis; j++ ) {
	print_PlNode( gorig_initial_multis[j], 0 );
      }
    }
  }

  if ( !gorig_goal_facts ) {
    gorig_goal_facts = new_PlNode( TRU );
  }

  if ( !is_wff( gorig_goal_facts ) ) {
    printf("\nillegal goal formula");
    print_PlNode( gorig_goal_facts, 0 );
    return FALSE;
  }

  for ( i = gloaded_ops; i; i = i->next ) {
    if ( !i->preconds ) {
      i->preconds = new_PlNode( TRU );
    }
    if ( !is_wff( i->preconds ) ) {
      printf("\nop %s has illegal precondition", i->name);
      return FALSE;
    }
    if ( !make_effects( &(i->effects) ) ) {
      printf("\nop %s has illegal effects", i->name);
      return FALSE;
    }
  }

  if ( gcmd_line.display_info == 102 ) {
    printf("\nfinal ADL representation is:\n");
    printf("\nobjects:");
    for ( ff = gorig_constant_list; ff; ff = ff->next ) {
      printf("\n%s : %s", ff->item->item, ff->item->next->item);
    }
    printf("\n\ninitial state:\n");
    print_PlNode( gorig_initial_facts, 0 );
    printf("\ninitial state, ors:\n");
    for ( j = 0; j < gnum_orig_initial_ors; j++ ) {
      print_PlNode( gorig_initial_ors[j], 0 );
    }
    printf("\ninitial state, oneofs:\n");
    for ( j = 0; j < gnum_orig_initial_oneofs; j++ ) {
      print_PlNode( gorig_initial_oneofs[j], 0 );
    }
    printf("\ninitial state, multis:\n");
    for ( j = 0; j < gnum_orig_initial_multis; j++ ) {
      print_PlNode( gorig_initial_multis[j], 0 );
    }
    printf("\n\ngoal formula:\n");
    print_PlNode( gorig_goal_facts, 0 );
    printf("\n\nops:");
    print_plops( gloaded_ops );
  }

  return TRUE;
      
}