SoundPluginRack::SoundPluginRack(QWidget *p_parent,PropertyEditUpdater *p_updater,Editor *p_editor) : QScrollArea(p_parent) {
	
	editor=p_editor;
	property_edit_updater=p_updater;
	rack_box=NULL;
	track=NULL;
	viewport()->setBackgroundRole(QPalette::NoRole);
	QPalette p=viewport()->palette();
	p.setColor(QPalette::Background,QColor(0,0,0));
	viewport()->setPalette(p);
	setLineWidth(0);
	setFrameStyle(QFrame::NoFrame);
	setFocusPolicy(Qt::NoFocus);
	viewport()->setContentsMargins(0,0,0,0);
	setContentsMargins(0,0,0,0);
	scrollbar=NULL;
	spacer=NULL;
	setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
	
	setFixedHeight(GET_CONSTANT(CONSTANT_RACK_MINIMUM_HEIGHT));

	setBackgroundRole(QPalette::NoRole);
	p=palette();
	p.setColor(QPalette::Background,QColor(0,0,0));
	setPalette(p);
	
	QObject::connect(horizontalScrollBar(),SIGNAL(rangeChanged( int,int )),this,SLOT(h_qscrollbar_range_changed( int,int )));
	
}
Example #2
0
void collect_relevant_facts( void )

{

  Action *a;
  Operator *o;
  int i, j, adr;


  /* mark all deleted facts; such facts, that are also pos, are relevant.
   */
  for ( a = gactions; a; a = a->next ) {
    o = goperators[a->op];

    for ( i = 0; i < o->num_dels; i++ ) {
      lp = o->dels[i].predicate;
      for ( j = 0; j < garity[lp]; j++ ) {
	largs[j] = GET_CONSTANT( o->dels[i].args[j], a );
      }
      adr = fact_adress();

      lneg[lp][adr] = 1;
      if ( lpos[lp][adr] &&
	   !luse[lp][adr] ) {
	luse[lp][adr] = 1;
	lindex[lp][adr] = gnum_relevant_facts;
	if ( gnum_relevant_facts == MAX_RELEVANT_FACTS ) {
	  printf("\nincrease MAX_RELEVANT_FACTS! (current value: %d)\n\n",
		 MAX_RELEVANT_FACTS);
	  exit( 1 );
	}
	grelevant_facts[gnum_relevant_facts].predicate = lp;
	for ( j = 0; j < garity[lp]; j++ ) {
	  grelevant_facts[gnum_relevant_facts].args[j] = largs[j];
	}
	lindex[lp][adr] = gnum_relevant_facts;
	gnum_relevant_facts++;
      }
    }
  }
      
  /* now build final action instances
   */
  for ( a = gactions; a; a = a->next ) {
    o = goperators[a->op];

    for ( i = 0; i < o->num_preconds; i++ ) {
      lp = o->preconds[i].predicate;
      for ( j = 0; j < garity[lp]; j++ ) {
	largs[j] = GET_CONSTANT( o->preconds[i].args[j], a );
      }
      adr = fact_adress();

      if ( !lneg[lp][adr] ) {
	continue;
      }

      a->preconds[a->num_preconds++] = lindex[lp][adr];
    }

    for ( i = 0; i < o->num_adds; i++ ) {
      lp = o->adds[i].predicate;
      for ( j = 0; j < garity[lp]; j++ ) {
	largs[j] = GET_CONSTANT( o->adds[i].args[j], a );
      }
      adr = fact_adress();

      if ( !lneg[lp][adr] ) {
	continue;
      }

      a->adds[a->num_adds++] = lindex[lp][adr];
    }

    for ( i = 0; i < o->num_dels; i++ ) {
      lp = o->dels[i].predicate;
      for ( j = 0; j < garity[lp]; j++ ) {
	largs[j] = GET_CONSTANT( o->dels[i].args[j], a );
      }
      adr = fact_adress();

      if ( !lpos[lp][adr] ) {
	continue;
      }

      a->dels[a->num_dels++] = lindex[lp][adr];
    }
  }

  /* build final initial and goal representation
   */
  ginitial_state.num_F = 0;
  for ( i = 0; i < gnum_initial; i++ ) {
    lp = ginitial[i].predicate;
    for ( j = 0; j < garity[lp]; j++ ) {
      largs[j] = ginitial[i].args[j];
    }
    adr = fact_adress();

    if ( !lneg[lp][adr] ) {
      continue;
    }

    ginitial_state.F[ginitial_state.num_F++] = lindex[lp][adr];
  }

  ggoal_state.num_F = 0;
  for ( i = 0; i < gnum_goal; i++ ) {
    lp = ggoal[i].predicate;
    for ( j = 0; j < garity[lp]; j++ ) {
      largs[j] = ggoal[i].args[j];
    }
    adr = fact_adress();

    if ( !lneg[lp][adr] ) {
      continue;
    }

    ggoal_state.F[ggoal_state.num_F++] = lindex[lp][adr];
  }

  if ( gcmd_line.display_info == 110 ) {
    printf("\n\nfinal domain representation:");

    printf("\n\nall actions:");
    for ( a = gactions; a; a = a->next ) {
      print_Action( a );
    }

    printf("\n\ninitial_state:");
    for ( i = 0; i < ginitial_state.num_F; i++ ) {
      printf("\n");
      print_ft_name( ginitial_state.F[i] );
    }

    printf("\n\ngoal_state:");
    for ( i = 0; i < ggoal_state.num_F; i++ ) {
      printf("\n");
      print_ft_name( ggoal_state.F[i] );
    }
  }
  
}
Example #3
0
void perform_reachability_analysis( void )

{

  int size, i, j, adr;
  Bool fixpoint;
  ActionTemplate *t1, *t2, *t3;
  Operator *o;
  Action *tmp, *a;

  for ( i = 0; i < gnum_predicates; i++ ) {
    size =  1;
    for ( j = 0; j < garity[i]; j++ ) {
      size *= gnum_constants;
    }

    lpos[i] = ( int_pointer ) calloc( size, sizeof( int ) );
    lneg[i] = ( int_pointer ) calloc( size, sizeof( int ) );
    luse[i] = ( int_pointer ) calloc( size, sizeof( int ) );
    lindex[i] = ( int_pointer ) calloc( size, sizeof( int ) );

    for ( j = 0; j < size; j++ ) {
      lpos[i][j] = 0;
      lneg[i][j] = 0;
      luse[i][j] = 0;
      lindex[i][j] = -1;
    }
  }

  /* mark initial facts as possibly positive
   */
  for ( i = 0; i < gnum_initial; i++ ) {
    lp = ginitial[i].predicate;
    for ( j = 0; j < garity[lp]; j++ ) {
      largs[j] = ginitial[i].args[j];
    }
    lpos[lp][fact_adress()] = 1;
  }

  /* compute fixpoint
   */
  fixpoint = FALSE;
  while ( !fixpoint ) {
    fixpoint = TRUE;

    t1 = gtemplates;
    while ( t1 ) {
      o = goperators[t1->op];
      for ( i = 0; i < o->num_preconds; i++ ) {
	lp = o->preconds[i].predicate;
	for ( j = 0; j < garity[lp]; j++ ) {
	  largs[j] = GET_CONSTANT( o->preconds[i].args[j], t1 );
	}
	if ( !lpos[lp][fact_adress()] ) {
	  break;
	}
      }

      if ( i < o->num_preconds ) {
	break;
      }

      for ( i = 0; i < o->num_adds; i++ ) {
	lp = o->adds[i].predicate;
	for ( j = 0; j < garity[lp]; j++ ) {
	  largs[j] = GET_CONSTANT( o->adds[i].args[j], t1 );
	}
	adr = fact_adress();
	if ( !lpos[lp][adr] ) {
	  /* new relevant fact! (added non initial)
	   */
	  lpos[lp][adr] = 1;
	  lneg[lp][adr] = 1;
	  luse[lp][adr] = 1;
	  if ( gnum_relevant_facts == MAX_RELEVANT_FACTS ) {
	    printf("\ntoo many relevant facts! increase MAX_RELEVANT_FACTS (currently %d)\n\n",
		   MAX_RELEVANT_FACTS);
	    exit( 1 );
	  }
	  grelevant_facts[gnum_relevant_facts].predicate = lp;
	  for ( j = 0; j < garity[lp]; j++ ) {
	    grelevant_facts[gnum_relevant_facts].args[j] = largs[j];
	  }
	  lindex[lp][adr] = gnum_relevant_facts;
	  gnum_relevant_facts++;
	  fixpoint = FALSE;
	}
      }

      tmp = new_Action( t1->op );
      for ( i = 0; i < o->num_vars; i++ ) {
	tmp->inst_table[i] = t1->inst_table[i];
      }
      tmp->next = gactions;
      gactions = tmp;
      gnum_actions++;

      t2 = t1;
      t1 = t1->next;
      free_single_ActionTemplate( t2 );
    }
    gtemplates = t1;
    t3 = t1;
    if ( t1 ) t1 = t1->next;
    while ( t1 ) {
      o = goperators[t1->op];
      for ( i = 0; i < o->num_preconds; i++ ) {
	lp = o->preconds[i].predicate;
	for ( j = 0; j < garity[lp]; j++ ) {
	  largs[j] = GET_CONSTANT( o->preconds[i].args[j], t1 );
	}
	if ( !lpos[lp][fact_adress()] ) {
	  break;
	}
      }

      if ( i == o->num_preconds ) {
	for ( i = 0; i < o->num_adds; i++ ) {
	  lp = o->adds[i].predicate;
	  for ( j = 0; j < garity[lp]; j++ ) {
	    largs[j] = GET_CONSTANT( o->adds[i].args[j], t1 );
	  }
	  adr = fact_adress();
	  if ( !lpos[lp][adr] ) {
	    /* new relevant fact! (added non initial)
	     */
	    lpos[lp][adr] = 1;
	    lneg[lp][adr] = 1;
	    luse[lp][adr] = 1;
	    if ( gnum_relevant_facts == MAX_RELEVANT_FACTS ) {
	      printf("\ntoo many relevant facts! increase MAX_RELEVANT_FACTS (currently %d)\n\n",
		     MAX_RELEVANT_FACTS);
	      exit( 1 );
	    }
	    grelevant_facts[gnum_relevant_facts].predicate = lp;
	    for ( j = 0; j < garity[lp]; j++ ) {
	      grelevant_facts[gnum_relevant_facts].args[j] = largs[j];
	    }
	    lindex[lp][adr] = gnum_relevant_facts;
	    gnum_relevant_facts++;
	    fixpoint = FALSE;
	  }
	}

	tmp = new_Action( t1->op );
	for ( i = 0; i < o->num_vars; i++ ) {
	  tmp->inst_table[i] = t1->inst_table[i];
	}
	tmp->next = gactions;
	gactions = tmp;
	gnum_actions++;
	
	t3->next = t1->next;
	t2 = t1;
	t1 = t1->next;
	free_single_ActionTemplate( t2 );
      } else {
	t3 = t3->next;
	t1 = t1->next;
      }
    }
  }

  gnum_pp_facts = gnum_initial + gnum_relevant_facts;

  if ( gcmd_line.display_info == 109 ) {
    printf("\nreachability analysys came up with:");

    printf("\n\npossibly positive facts:");
    for ( i = 0; i < gnum_initial; i++ ) {
      printf("\n");
      print_Fact( &(ginitial[i]) );
    }      
    for ( i = 0; i < gnum_relevant_facts; i++ ) {
      printf("\n");
      print_Fact( &(grelevant_facts[i]) );
    }

    printf("\n\nthis yields these %d action templates:", gnum_actions);
    for ( i = 0; i < gnum_operators; i++ ) {
      printf("\n\noperator %s:", goperators[i]->name);
      for ( a = gactions; a; a = a->next ) {
	if ( a->op != i ) {
	  continue;
	}
	printf("\ntemplate: ");
	for ( j = 0; j < goperators[i]->num_vars; j++ ) {
	  printf("%s", gconstants[a->inst_table[j]]);
	  if ( j < goperators[i]->num_vars-1 ) {
	    printf(" ");
	  }
	}
      }
    }
    printf("\n\n");
  }

  /* if a goal is not possibly positive, the problem
   * is unsolvable.
   */
  for ( i = 0; i < gnum_goal; i++ ) {
    lp = ggoal[i].predicate;
    for ( j = 0; j < garity[lp]; j++ ) {
      largs[j] = ggoal[i].args[j];
    }
    if ( !lpos[lp][fact_adress()] ) {
      printf("\nproblem is unsolvable! goals can't be reached\n\n");
      output_planner_info();
    }
  }
  

}