inline bool ConstraintContainer1::insert_constraint_in_f(Constraint *c){
  /*
  std::cout << "pcs_to_f.size: " << pcs_to_f.size() << "\n"
            << "proc_count: " << proc_count << "\n"
            << "max_state_count: " << max_state_count << "\n"
            << "pc_index(c): " << pc_index(c) << "\n";
  */
  assert(int(pcs_to_f.size()) > pc_index(c));
  if(pcs_to_f[pc_index(c)].insert(c).second){
    f_size++;
    return true;
  }else{
    return false;
  }
};
Exemple #2
0
inline PbContainer2::wrapper_t *PbContainer2::insert_in_f(PbConstraint *c){
  int pci = pc_index(c);
  std::vector<wrapper_t*> &v = pcs_to_f[pci][c];
  bool subsumed = false;
  for(unsigned i = 0; !subsumed && i < v.size(); i++){
    switch(c->entailment_compare(*v[i]->constraint)){
    case Constraint::LESS:
      /* v[i] is subsumed */
      remove_from_q(v[i]);
      break;
    case Constraint::GREATER: case Constraint::EQUAL:
      subsumed = true;
      break;
    case Constraint::INCOMPARABLE:
      // Do nothing
      break;
    }
  }
  if(subsumed){
    delete c;
    return 0;
  }else{
    wrapper_t *w = new wrapper_t(c);
    v.push_back(w);
    return w;
  }
};
Trace *ConstraintContainer1::clear_and_get_trace(Constraint *c){
  /* Create the trace */
  Trace *trace = new Trace(c);
  pcs_to_f[pc_index(c)].erase(c); // Remove from F to avoid later deallocation
  int i = edge_count-1; // Index into edges
  while(i >= 0){
    if(edges[i].child == c){
      c = edges[i].parent;
      pcs_to_f[pc_index(c)].erase(c); // Remove from F to avoid later deallocation
      trace->push_front(c,*edges[i].transition);
    }
    i--;
  }

  /* Clear */
  clear();

  return trace;
};
Exemple #4
0
bool PbContainer2::pointer_in_f(PbConstraint *c){
  int pci = pc_index(c);
  std::vector<wrapper_t*> &v = pcs_to_f[pci][c];
  for(unsigned i = 0; i < v.size(); i++){
    if(v[i]->constraint == c){
      return true;
    }
  }
  return false;
};
Exemple #5
0
PbContainer2::wrapper_t *PbContainer2::get_wrapper(PbConstraint *c){
  if(c == prev_popped->constraint){
    return prev_popped;
  }
  int pci = pc_index(c);
  std::vector<wrapper_t*> &v = pcs_to_f[pci][c];
  for(unsigned i = 0; i < v.size(); i++){
    if(v[i]->constraint == c){
      return v[i];
    }
  }
  throw new std::logic_error("PbContainer2::get_wrapper: Constraint not in F.");
};