Example #1
0
void make_instantiate_numeric_effects( PseudoActionEffect *e, NumericEffect *ne )

{

  int m = 0, i;
  NumericEffect *n;

  for ( n = ne; n; n = n->next ) m++;

  e->numeric_effects_neft = ( NumericEffectType * ) calloc( m, sizeof( NumericEffectType ) );
  e->numeric_effects_fluent = ( Fluent * ) calloc( m, sizeof( Fluent ) );
  e->numeric_effects_rh = ( ExpNode_pointer * ) calloc( m, sizeof( ExpNode_pointer ) );
  e->num_numeric_effects = m;

  m = 0;
  for ( n = ne; n; n = n->next ) {
    e->numeric_effects_neft[m] = n->neft;
    e->numeric_effects_fluent[m].function = n->fluent.function;
    for ( i = 0; i < gf_arity[n->fluent.function]; i++ ) {
      e->numeric_effects_fluent[m].args[i] = ( n->fluent.args[i] < 0 ) ?
	linst_table[DECODE_VAR( n->fluent.args[i] )] : n->fluent.args[i];
    }
    e->numeric_effects_rh[m] = copy_Exp( n->rh );
    instantiate_exp( &(e->numeric_effects_rh[m]) );
    m++;
  }

}
Example #2
0
E_list * copy_E_list(E_list * l) {
    E_list * nl;
    if (l == NULL) return NULL;
    nl = (E_list *) xalloc(sizeof(E_list));
    *nl = *l;    /* not necessary -- both fields will be built below */
    nl->next = copy_E_list(l->next);
    nl->e = copy_Exp(l->e);
    return nl;
}
Example #3
0
X_node* morpheme_dict_node_maker(Dictionary dict, Morpheme *morpheme_list){
	Morpheme *morph;
	Feature_list *f_list;
	Dict_node *dn, *dnx;
	Feature *f1, *f2,*f3=NULL;
    X_node * x, * y;
	int n;
	int unifiable;
	char word[MAX_WORD];
	char temp[MAX_LINE]="";
	Feature * subcat;
	x=NULL;
	for(morph=morpheme_list; morph!=NULL; morph=morph->next){
		n=0;
		for(f_list=morph->f_list; f_list!=NULL; f_list=f_list->next){
			if ((subcat = find_feature_path_string(f_list->f, "root subcat"))==NULL)
				continue;
			dn = dictionary_lookup(dict, subcat->attribute);
			for (dnx=dn; dnx!=NULL; dnx=dnx->right){
				f1= feature_copy_driver(USE_SOURCE_STRING_SET, dnx->f);
				f2= feature_copy_driver(dict->string_set, f_list->f);
				if (PRINT_DIAGRAM){
					temp[0] = '\0';
					print_a_feature(f1,temp);
					printf("dn_feature : \n %s",temp);
					temp[0] = '\0';
					print_a_feature(f2,temp);
					printf("\nhead_feature : \n %s",temp);
				}
				unifiable=unify_features(f1,f2,&f3);
				if(unifiable==TRUE){
					y = (X_node *) xalloc(sizeof(X_node));
					y->next = x;
					x = y;
					x->exp = copy_Exp(dnx->exp);
					sprintf(word, "%s_%d", morph->word, n);
					x->string = string_set_add(word, dict->string_set);
	//					x->string = morph->word;
					x->feature = f3;
					n++;
				}
				else{
					feature_free(f3);
				}
			}
		}
	}

return x;
}
Example #4
0
/**
 * build_word_expressions() -- build list of expressions for a word
 *
 * Looks up the word s in the dictionary.  Returns NULL if it's not there.
 * If there, it builds the list of expressions for the word, and returns
 * a pointer to it.
 */
X_node * build_word_expressions(Sentence sent, const char * s)
{
	Dict_node * dn, *dn_head;
	X_node * x, * y;

	dn_head = dictionary_lookup_list(sent->dict, s);
	dn = dn_head;

	x = NULL;
	while (dn != NULL)
	{
		y = (X_node *) xalloc(sizeof(X_node));
		y->next = x;
		x = y;
		x->exp = copy_Exp(dn->exp);
		x->string = dn->string;
		dn = dn->right;
	}
	free_lookup_list (dn_head);
	return x;
}
Example #5
0
X_node* morpheme_dict_node_maker(Dictionary dict, Morpheme *morpheme_list){
	Morpheme *morph;
	Feature_list *f_list;
	Dict_node *dn, *dnx;
	Feature *f1, *f2,*f3=NULL;
    X_node * x, * y;
	int n;
	int unifiable;
	char word[MAX_WORD];

	x=NULL;
	for(morph=morpheme_list; morph!=NULL; morph=morph->next){
		dn=dictionary_lookup(dict, morph->word);
		for(dnx=dn; dnx!=NULL; dnx=dnx->right){
			n=0;
			for(f_list=morph->f_list; f_list!=NULL; f_list=f_list->next){
				f1= feature_copy_driver(USE_SOURCE_DICT, dn->f);
				f2= feature_copy_driver(dict, f_list->f);
				unifiable=unify_features(f1,f2,&f3);
				if(unifiable==TRUE){
					y = (X_node *) xalloc(sizeof(X_node));
					y->next = x;
					x = y;
					x->exp = copy_Exp(dnx->exp);
					sprintf(word, "%s_%d", dn->string, n);
					x->string = string_set_add(word, dict->string_set);
//					x->string = morph->word;
					x->feature = f3;
					n++;
				}
				else{
					feature_free(f3);
				}
			}
		}
	}

return x;
}
Example #6
0
NormEffect *new_NormEffect2( NormEffect *e )

{

  int i, j;

  NormEffect *result = ( NormEffect * ) calloc( 1, sizeof( NormEffect ) );
  CHECK_PTR(result);

  result->num_vars = 0;

  result->conditions = ( Fact * ) calloc( e->num_conditions, sizeof( Fact ) );
  result->num_conditions = e->num_conditions;
  for ( i = 0; i < e->num_conditions; i++ ) {
    result->conditions[i].predicate = e->conditions[i].predicate;
    for ( j = 0; j < garity[e->conditions[i].predicate]; j++ ) {
      result->conditions[i].args[j] = e->conditions[i].args[j];
    }
  }
  result->adds = ( Fact * ) calloc( e->num_adds, sizeof( Fact ) );
  result->num_adds = e->num_adds;
  for ( i = 0; i < e->num_adds; i++ ) {
    result->adds[i].predicate = e->adds[i].predicate;
    for ( j = 0; j < garity[e->adds[i].predicate]; j++ ) {
      result->adds[i].args[j] = e->adds[i].args[j];
    }
  }
  result->dels = ( Fact * ) calloc( e->num_dels, sizeof( Fact ) );
  result->num_dels = e->num_dels;
  for ( i = 0; i < e->num_dels; i++ ) {
    result->dels[i].predicate = e->dels[i].predicate;
    for ( j = 0; j < garity[e->dels[i].predicate]; j++ ) {
      result->dels[i].args[j] = e->dels[i].args[j];
    }
  }

  result->numeric_conditions_comp = ( Comparator * ) 
    calloc( e->num_numeric_conditions, sizeof( Comparator ) );
  result->numeric_conditions_lh = ( ExpNode_pointer * ) 
    calloc( e->num_numeric_conditions, sizeof( ExpNode_pointer ) );
  result->numeric_conditions_rh = ( ExpNode_pointer * ) 
    calloc( e->num_numeric_conditions, sizeof( ExpNode_pointer ) );
  for ( i = 0; i < e->num_numeric_conditions; i++ ) {
    result->numeric_conditions_comp[i] = e->numeric_conditions_comp[i];
    result->numeric_conditions_lh[i] = copy_Exp( e->numeric_conditions_lh[i] );
    result->numeric_conditions_rh[i] = copy_Exp( e->numeric_conditions_rh[i] );
  }
  result->num_numeric_conditions = e->num_numeric_conditions;
  result->numeric_effects_neft = ( NumericEffectType * ) 
    calloc( e->num_numeric_effects, sizeof( NumericEffectType ) );
  result->numeric_effects_fluent = ( Fluent * ) 
    calloc( e->num_numeric_effects, sizeof( Fluent ) );
  result->numeric_effects_rh = ( ExpNode_pointer * ) 
    calloc( e->num_numeric_effects, sizeof( ExpNode_pointer ) );
  for ( i = 0; i < e->num_numeric_effects; i++ ) {
    result->numeric_effects_neft[i] = e->numeric_effects_neft[i];
    result->numeric_effects_fluent[i].function = e->numeric_effects_fluent[i].function;
    for ( j = 0; j < gf_arity[e->numeric_effects_fluent[i].function]; j++ ) {
      result->numeric_effects_fluent[i].args[j] = e->numeric_effects_fluent[i].args[j];
    }
    result->numeric_effects_rh[i] = copy_Exp( e->numeric_effects_rh[i] );
  }
  result->num_numeric_effects = e->num_numeric_effects;

  result->next = NULL;
  result->prev = NULL;

  return result;

}
Example #7
0
WffNode *instantiate_wff( WffNode *w )

{

  WffNode *res = NULL, *tmp, *i;
  int j, m, h;
  Bool ok, ct;

  switch ( w->connective ) {
  case AND:
    m = 0;
    i = w->sons;
    while ( i ) {
      tmp = instantiate_wff( i );
      if ( tmp->connective == FAL ) {
	free_WffNode( res );
	return tmp;
      }
      if ( tmp->connective == TRU ) {
	free( tmp );
	i = i->next;
	continue;
      }
      tmp->next = res;
      if ( res ) {
	res->prev = tmp;
      }
      res = tmp;
      i = i->next;
      m++;
    }
    if ( m == 0 ) {
      res = new_WffNode( TRU );
      break;
    }
    if ( m == 1 ) {
      break;
    }
    tmp = new_WffNode( AND );
    tmp->sons = res;
    res = tmp;
    break;
  case OR:
    m = 0;
    i = w->sons;
    while ( i ) {
      tmp = instantiate_wff( i );
      if ( tmp->connective == TRU ) {
	free_WffNode( res );
	return tmp;
      }
      if ( tmp->connective == FAL ) {
	free( tmp );
	i = i->next;
	continue;
      }
      tmp->next = res;
      if ( res ) {
	res->prev = tmp;
      }
      res = tmp;
      i = i->next;
      m++;
    }
    if ( m == 0 ) {
      res = new_WffNode( FAL );
      break;
    }
    if ( m == 1 ) {
      break;
    }
    tmp = new_WffNode( OR );
    tmp->sons = res;
    res = tmp;
    break;
  case ATOM:
    res = new_WffNode( ATOM );
    res->fact = new_Fact();
    res->fact->predicate = w->fact->predicate;
    ok = TRUE;
    for ( j = 0; j < garity[res->fact->predicate]; j++ ) {
      h = ( w->fact->args[j] < 0 ) ?
	linst_table[DECODE_VAR( w->fact->args[j] )] : w->fact->args[j];
      if ( h < 0 ) {
	ok = FALSE;
	res->fact->args[j] = w->fact->args[j];
      } else {
	res->fact->args[j] = h;
      }
    }
    if ( !ok ) {/* contains ef params */
      break;
    }
    if ( !full_possibly_negative( res->fact ) ) {
      free( res->fact );
      res->fact = NULL;
      res->connective = TRU;
      break;
    }
    if ( !full_possibly_positive( res->fact ) ) {
      free( res->fact );
      res->fact = NULL;
      res->connective = FAL;
      break;
    }
    break;
  case COMP:
    res = new_WffNode( COMP );
    res->comp = w->comp;
    res->lh = copy_Exp( w->lh );
    res->rh = copy_Exp( w->rh );
    instantiate_exp( &(res->lh) );
    instantiate_exp( &(res->rh) );
    if ( res->lh->connective != NUMBER ||
	 res->rh->connective != NUMBER ) {
      /* logical simplification only possible if both parts are numbers
       */
      break;
    }
    ct = number_comparison_holds( res->comp, res->lh->value, res->rh->value );
    if ( ct ) {
      res->connective = TRU;
      free_ExpNode( res->lh );
      res->lh = NULL;
      free_ExpNode( res->rh );
      res->rh = NULL;
      res->comp = -1;
    } else {
      res->connective = FAL;
      free_ExpNode( res->lh );
      res->lh = NULL;
      free_ExpNode( res->rh );
      res->rh = NULL;
      res->comp = -1;
    }
    break;
  case TRU:
  case FAL:
    res = new_WffNode( w->connective );
    break;
  default:
    printf("\n\nillegal connective %d in instantiate formula\n\n",
	   w->connective);
    exit( 1 );
  }

  return res;

}
Example #8
0
Effect *instantiate_Effect( Effect *e )

{

  Effect *res = NULL, *tmp, *i;
  Literal *tt, *l;
  NumericEffect *ne, *ttt;
  int j;

  for ( i = e; i; i = i->next ) {
    tmp = new_Effect();

    for ( j = 0; j < i->num_vars; j++ ) {
      tmp->var_types[j] = i->var_types[j];
    }
    tmp->num_vars = i->num_vars;

    tmp->conditions = instantiate_wff( i->conditions );

    if ( tmp->conditions->connective == FAL ) {
      free_partial_Effect( tmp );
      continue;
    }

    for ( l = i->effects; l; l = l->next ) {
      tt = new_Literal();
      tt->negated = l->negated;
      tt->fact.predicate = l->fact.predicate;
      for ( j = 0; j < garity[tt->fact.predicate]; j++ ) {
	tt->fact.args[j] = l->fact.args[j];
	if ( tt->fact.args[j] < 0 &&
	     linst_table[DECODE_VAR( tt->fact.args[j] )] != -1 ) {
	  tt->fact.args[j] = linst_table[DECODE_VAR( tt->fact.args[j] )];
	}
      }
      tt->next = tmp->effects;
      if ( tmp->effects ) {
	tmp->effects->prev = tt;
      }
      tmp->effects = tt;
    }

    for ( ne = i->numeric_effects; ne; ne = ne->next ) {
      ttt = new_NumericEffect();
      ttt->neft = ne->neft;
      ttt->fluent.function = ne->fluent.function;
      for ( j = 0; j < gf_arity[ttt->fluent.function]; j++ ) {
	ttt->fluent.args[j] = ne->fluent.args[j];
	if ( ttt->fluent.args[j] < 0 &&
	     linst_table[DECODE_VAR( ttt->fluent.args[j] )] != -1 ) {
	  ttt->fluent.args[j] = linst_table[DECODE_VAR( ttt->fluent.args[j] )];
	}
      }
      ttt->rh = copy_Exp( ne->rh );
      instantiate_exp( &(ttt->rh) );
      ttt->next = tmp->numeric_effects;
      if ( tmp->numeric_effects ) {
	tmp->numeric_effects->prev = ttt;
      }
      tmp->numeric_effects = ttt;
    }

    tmp->next = res;
    if ( res ) {
      res->prev = tmp;
    }
    res = tmp;
  }

  return res;

}
Example #9
0
void create_hard_mixed_operators( Operator *o, int curr_var )

{

  int t, i, m, mn;
  WffNode *tmp1, *w, *ww;
  MixedOperator *tmp2;

  if ( curr_var < o->num_vars ) {
    if ( o->removed[curr_var] ) {
      /* param doesn't matter -- select any appropriate type constant
       * at least one there; otherwise, op would not have been translated.
       */
      linst_table[curr_var] = gtype_consts[o->var_types[curr_var]][0];
      create_hard_mixed_operators( o, curr_var + 1 );
      linst_table[curr_var] = -1;
      return;
    }

    t = o->var_types[curr_var];
    for ( i = 0; i < gtype_size[t]; i++ ) {
      linst_table[curr_var] = gtype_consts[t][i];

      create_hard_mixed_operators( o, curr_var + 1 );

      linst_table[curr_var] = -1;
    }
    return;
  }


  tmp1 = instantiate_wff( o->preconds );

  if ( tmp1->connective == FAL ) {
    free_WffNode( tmp1 );
    return;
  }

  dnf( &tmp1 );
  cleanup_wff( &tmp1 );

  if ( tmp1->connective == FAL ) {
    free_WffNode( tmp1 );
    return;
  }

  /* only debugging, REMOVE LATER
   */
  if ( is_dnf( tmp1 ) == -1 ) {
    printf("\n\nILLEGAL DNF %s AFTER INSTANTIATION\n\n", o->name);
    print_Wff( tmp1, 0 );
    exit( 1 );
  }

  switch ( tmp1->connective ) {
  case OR:
    for ( w = tmp1->sons; w; w = w->next ) {
      tmp2 = new_MixedOperator( o );
      for ( i = 0; i < o->num_vars; i++ ) {
	tmp2->inst_table[i] = linst_table[i];
      }
      if ( w->connective == AND ) {
	m = 0;
	mn = 0;
	for ( ww = w->sons; ww; ww = ww->next ) {
	  if ( ww->connective == ATOM ) m++;
	  if ( ww->connective == COMP ) mn++;
	}
	tmp2->preconds = ( Fact * ) calloc( m, sizeof( Fact ) );
	tmp2->numeric_preconds_comp = ( Comparator * ) calloc( mn, sizeof( Comparator ) );
	tmp2->numeric_preconds_lh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
	tmp2->numeric_preconds_rh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
	tmp2->num_preconds = m;
	tmp2->num_numeric_preconds = mn;
	m = 0; mn = 0;
	for ( ww = w->sons; ww; ww = ww->next ) {
	  if ( ww->connective == ATOM ) {
	    tmp2->preconds[m].predicate = ww->fact->predicate;
	    for ( i = 0; i < garity[ww->fact->predicate]; i++ ) {
	      tmp2->preconds[m].args[i] = ww->fact->args[i];
	    }
	    m++;
	  }
	  if ( ww->connective == COMP ) {
	    tmp2->numeric_preconds_comp[mn] = ww->comp;
	    tmp2->numeric_preconds_lh[mn] = copy_Exp( ww->lh );
	    tmp2->numeric_preconds_rh[mn] = copy_Exp( ww->rh );
	    mn++;
	  }
	}
      } else {
	if ( w->connective == ATOM ) {
	  tmp2->preconds = ( Fact * ) calloc( 1, sizeof( Fact ) );
	  tmp2->num_preconds = 1;
	  tmp2->preconds[0].predicate = w->fact->predicate;
	  for ( i = 0; i < garity[w->fact->predicate]; i++ ) {
	    tmp2->preconds[0].args[i] = w->fact->args[i];
	  }
	}
	if ( w->connective == COMP ) {
	  tmp2->numeric_preconds_comp = ( Comparator * ) calloc( 1, sizeof( Comparator ) );
	  tmp2->numeric_preconds_lh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
	  tmp2->numeric_preconds_rh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
	  tmp2->numeric_preconds_comp[0] = w->comp;
	  tmp2->numeric_preconds_lh[0] = copy_Exp( w->lh );
	  tmp2->numeric_preconds_rh[0] = copy_Exp( w->rh );
	  tmp2->num_numeric_preconds = 1;
	}
      }
      tmp2->effects = instantiate_Effect( o->effects );
      tmp2->next = ghard_mixed_operators;
      ghard_mixed_operators = tmp2;
      gnum_hard_mixed_operators++;
    }
    break;
  case AND:
    tmp2 = new_MixedOperator( o );
    for ( i = 0; i < o->num_vars; i++ ) {
      tmp2->inst_table[i] = linst_table[i];
    }
    m = 0;
    mn = 0;
    for ( w = tmp1->sons; w; w = w->next ) {
      if ( w->connective == ATOM ) m++;
      if ( w->connective == COMP ) mn++;
    }
    tmp2->preconds = ( Fact * ) calloc( m, sizeof( Fact ) );
    tmp2->numeric_preconds_comp = ( Comparator * ) calloc( mn, sizeof( Comparator ) );
    tmp2->numeric_preconds_lh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
    tmp2->numeric_preconds_rh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
    tmp2->num_preconds = m;
    tmp2->num_numeric_preconds = mn;
    m = 0; mn = 0;
    for ( w = tmp1->sons; w; w = w->next ) {
      if ( w->connective == ATOM ) {
	tmp2->preconds[m].predicate = w->fact->predicate;
	for ( i = 0; i < garity[w->fact->predicate]; i++ ) {
	  tmp2->preconds[m].args[i] = w->fact->args[i];
	}
	m++;
      }
      if ( w->connective == COMP ) {
	tmp2->numeric_preconds_comp[mn] = w->comp;
	tmp2->numeric_preconds_lh[mn] = copy_Exp( w->lh );
	tmp2->numeric_preconds_rh[mn] = copy_Exp( w->rh );
	mn++;
      }
    }
    tmp2->effects = instantiate_Effect( o->effects );
    tmp2->next = ghard_mixed_operators;
    ghard_mixed_operators = tmp2;
    gnum_hard_mixed_operators++;
    break;
  case ATOM:
    tmp2 = new_MixedOperator( o );
    for ( i = 0; i < o->num_vars; i++ ) {
      tmp2->inst_table[i] = linst_table[i];
    }
    tmp2->preconds = ( Fact * ) calloc( 1, sizeof( Fact ) );
    tmp2->num_preconds = 1;
    tmp2->preconds[0].predicate = tmp1->fact->predicate;
    for ( i = 0; i < garity[tmp1->fact->predicate]; i++ ) {
      tmp2->preconds[0].args[i] = tmp1->fact->args[i];
    }
    tmp2->effects = instantiate_Effect( o->effects );
    tmp2->next = ghard_mixed_operators;
    ghard_mixed_operators = tmp2;
    gnum_hard_mixed_operators++;
    break;
  case COMP:
    tmp2 = new_MixedOperator( o );
    for ( i = 0; i < o->num_vars; i++ ) {
      tmp2->inst_table[i] = linst_table[i];
    }
    tmp2->numeric_preconds_comp = ( Comparator * ) calloc( 1, sizeof( Comparator ) );
    tmp2->numeric_preconds_lh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
    tmp2->numeric_preconds_rh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
    tmp2->numeric_preconds_comp[0] = tmp1->comp;
    tmp2->numeric_preconds_lh[0] = copy_Exp( tmp1->lh );
    tmp2->numeric_preconds_rh[0] = copy_Exp( tmp1->rh );
    tmp2->num_numeric_preconds = 1;
    tmp2->effects = instantiate_Effect( o->effects );
    tmp2->next = ghard_mixed_operators;
    ghard_mixed_operators = tmp2;
    gnum_hard_mixed_operators++;    
    break;
  case TRU:
    tmp2 = new_MixedOperator( o );
    for ( i = 0; i < o->num_vars; i++ ) {
      tmp2->inst_table[i] = linst_table[i];
    }
    tmp2->effects = instantiate_Effect( o->effects );
    tmp2->next = ghard_mixed_operators;
    ghard_mixed_operators = tmp2;
    gnum_hard_mixed_operators++;
    break;
  default:
    printf("\n\nillegal connective %d in parsing DNF precond.\n\n",
	   tmp1->connective);
    exit( 1 );
  }

  free_WffNode( tmp1 );

}
Example #10
0
void create_hard_pseudo_effects( PseudoAction *a, Effect *e, int curr_var )

{

  int par, t, i, m, mn;
  WffNode *tmp1, *w, *ww;
  PseudoActionEffect *tmp2;

  if ( curr_var < e->num_vars ) {
    par = a->operator->num_vars + curr_var;

    t = e->var_types[curr_var];
    for ( i = 0; i < gtype_size[t]; i++ ) {
      linst_table[par] = gtype_consts[t][i];

      create_hard_pseudo_effects( a, e, curr_var + 1 );

      linst_table[par] = -1;
    }
    return;
  }

  tmp1 = instantiate_wff( e->conditions );

  if ( tmp1->connective == FAL ) {
    free_WffNode( tmp1 );
    return;
  }

  dnf( &tmp1 );
  cleanup_wff( &tmp1 );

  /* only debugging, REMOVE LATER
   */
  if ( is_dnf( tmp1 ) == -1 ) {
    printf("\n\nILLEGAL DNF %s AFTER INSTANTIATION\n\n", a->operator->name);
    print_Wff( tmp1, 0 );
    exit( 1 );
  }

  switch ( tmp1->connective ) {
  case OR:
    for ( w = tmp1->sons; w; w = w->next ) {
      tmp2 = new_PseudoActionEffect();
      if ( w->connective == AND ) {
	m = 0;
	mn = 0;
	for ( ww = w->sons; ww; ww = ww->next ) {
	  if ( ww->connective == ATOM ) m++;
	  if ( ww->connective == COMP ) mn++;
	}
	tmp2->conditions = ( Fact * ) calloc( m, sizeof( Fact ) );
	tmp2->numeric_conditions_comp = ( Comparator * ) calloc( mn, sizeof( Comparator ) );
	tmp2->numeric_conditions_lh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
	tmp2->numeric_conditions_rh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
	tmp2->num_conditions = m;
	tmp2->num_numeric_conditions = mn;
	m = 0; mn = 0;
	for ( ww = w->sons; ww; ww = ww->next ) {
	  if ( ww->connective == ATOM ) {
	    tmp2->conditions[m].predicate = ww->fact->predicate;
	    for ( i = 0; i < garity[ww->fact->predicate]; i++ ) {
	      tmp2->conditions[m].args[i] = ww->fact->args[i];
	    }
	    m++;
	  }
	  if ( ww->connective == COMP ) {
	    tmp2->numeric_conditions_comp[mn] = ww->comp;
	    tmp2->numeric_conditions_lh[mn] = copy_Exp( ww->lh );
	    tmp2->numeric_conditions_rh[mn] = copy_Exp( ww->rh );
	    mn++;
	  }
	}
      } else {
	if ( w->connective == ATOM ) {
	  tmp2->conditions = ( Fact * ) calloc( 1, sizeof( Fact ) );
	  tmp2->num_conditions = 1;
	  tmp2->conditions[0].predicate = w->fact->predicate;
	  for ( i = 0; i < garity[w->fact->predicate]; i++ ) {
	    tmp2->conditions[0].args[i] = w->fact->args[i];
	  }
	}
 	if ( w->connective == COMP ) {
	  tmp2->numeric_conditions_comp = ( Comparator * ) calloc( 1, sizeof( Comparator ) );
	  tmp2->numeric_conditions_lh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
	  tmp2->numeric_conditions_rh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
	  tmp2->numeric_conditions_comp[0] = w->comp;
	  tmp2->numeric_conditions_lh[0] = copy_Exp( w->lh );
	  tmp2->numeric_conditions_rh[0] = copy_Exp( w->rh );
	  tmp2->num_numeric_conditions = 1;
	}
      }
      make_instantiate_literals( tmp2, e->effects );
      make_instantiate_numeric_effects( tmp2, e->numeric_effects );
      tmp2->next = a->effects;
      a->effects = tmp2;
      a->num_effects++;
    }
    break;
  case AND:
    tmp2 = new_PseudoActionEffect();
    m = 0;
    mn = 0;
    for ( w = tmp1->sons; w; w = w->next ) {
      if ( w->connective == ATOM ) m++;
      if ( w->connective == COMP ) mn++;
    }
    tmp2->conditions = ( Fact * ) calloc( m, sizeof( Fact ) );
    tmp2->numeric_conditions_comp = ( Comparator * ) calloc( mn, sizeof( Comparator ) );
    tmp2->numeric_conditions_lh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
    tmp2->numeric_conditions_rh = ( ExpNode_pointer * ) calloc( mn, sizeof( ExpNode_pointer ) );
    tmp2->num_conditions = m;
    tmp2->num_numeric_conditions = mn;
    m = 0; mn = 0;
    for ( w = tmp1->sons; w; w = w->next ) {
      if ( w->connective == ATOM ) {
	tmp2->conditions[m].predicate = w->fact->predicate;
	for ( i = 0; i < garity[w->fact->predicate]; i++ ) {
	  tmp2->conditions[m].args[i] = w->fact->args[i];
	}
	m++;
      }
      if ( w->connective == COMP ) {
	tmp2->numeric_conditions_comp[mn] = w->comp;
	tmp2->numeric_conditions_lh[mn] = copy_Exp( w->lh );
	tmp2->numeric_conditions_rh[mn] = copy_Exp( w->rh );
	mn++;
      }
    }
    make_instantiate_literals( tmp2, e->effects );
    make_instantiate_numeric_effects( tmp2, e->numeric_effects );
    tmp2->next = a->effects;
    a->effects = tmp2;
    a->num_effects++;
    break;
  case ATOM:
    tmp2 = new_PseudoActionEffect();
    tmp2->conditions = ( Fact * ) calloc( 1, sizeof( Fact ) );
    tmp2->num_conditions = 1;
    tmp2->conditions[0].predicate = tmp1->fact->predicate;
    for ( i = 0; i < garity[tmp1->fact->predicate]; i++ ) {
      tmp2->conditions[0].args[i] = tmp1->fact->args[i];
    }
    make_instantiate_literals( tmp2, e->effects );
    make_instantiate_numeric_effects( tmp2, e->numeric_effects );
    tmp2->next = a->effects;
    a->effects = tmp2;
    a->num_effects++;
    break;
  case COMP:
    tmp2 = new_PseudoActionEffect();
    tmp2->numeric_conditions_comp = ( Comparator * ) calloc( 1, sizeof( Comparator ) );
    tmp2->numeric_conditions_lh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
    tmp2->numeric_conditions_rh = ( ExpNode_pointer * ) calloc( 1, sizeof( ExpNode_pointer ) );
    tmp2->numeric_conditions_comp[0] = tmp1->comp;
    tmp2->numeric_conditions_lh[0] = copy_Exp( tmp1->lh );
    tmp2->numeric_conditions_rh[0] = copy_Exp( tmp1->rh );
    tmp2->num_numeric_conditions = 1;
    make_instantiate_literals( tmp2, e->effects );
    make_instantiate_numeric_effects( tmp2, e->numeric_effects );
    tmp2->next = a->effects;
    a->effects = tmp2;
    a->num_effects++;
    break;
  case TRU:
    tmp2 = new_PseudoActionEffect();
    make_instantiate_literals( tmp2, e->effects );
    make_instantiate_numeric_effects( tmp2, e->numeric_effects );
    tmp2->next = a->effects;
    a->effects = tmp2;
    a->num_effects++;
    break;
  default:
    printf("\n\nillegal connective %d in parsing DNF condition.\n\n",
	   tmp1->connective);
    exit( 1 );
  }

  free_WffNode( tmp1 );

}