Main Page | Class Hierarchy | Class List | Directories | File List | Class Members | File Members

pntgbautils.hh File Reference

Go to the source code of this file.

Functions

void count_markings (const petri_net *n)
 Display some statistics concerning the Petri net n.
void print_reachability_graph (const petri_net *n)
 Display the reachability graph of the Petri net n.
const std::string * check_at_prop (const petri_net *p, const spot::ltl::formula *f)
 Check if the atomic propositions in f are places of the Petri net p. Return a pointer on the first atomic proposition which is not a place name if any and 0 otherwise.
void model_check (const petri_net *n, const spot::ltl::formula *f, bool ce_expected, bool fm_exprop_opt=false, bool fm_symb_merge_opt=true, bool post_branching=false, bool fair_loop_approx=false)
 Check if the Petri net n can produce at least one infinite sequence accepted by the formula f.


Function Documentation

const std::string* check_at_prop const petri_net p,
const spot::ltl::formula f
 

Check if the atomic propositions in f are places of the Petri net p. Return a pointer on the first atomic proposition which is not a place name if any and 0 otherwise.

const std::string* check_at_prop(const petri_net* p,
                                 const spot::ltl::formula* f) {
  spot::ltl::atomic_prop_set* sap = spot::ltl::atomic_prop_collect(f);

  if (sap) {
    spot::ltl::atomic_prop_set::iterator it;
    for(it=sap->begin(); it!=sap->end(); ++it) {
      if(!p->place_exists( (*it)->name() )) {
        return &((*it)->name());
      }
    }
  }
  return 0;
} //

void count_markings const petri_net n  ) 
 

Display some statistics concerning the Petri net n.

void count_markings(const petri_net* n) {
  double start_time, visit_time;

  pn_tgba p(n);
  
  start_time = ((double)(clock()) / CLOCKS_PER_SEC);
  
  spot::tgba_statistics st = spot::stats_reachable(&p);
  
  visit_time = ((double)(clock()) / CLOCKS_PER_SEC) - start_time;

  std::cout << "the state graph is composed of " << st.states;
  std::cout << " states and " << st.transitions << " edges" << std::endl;
  std::cout << "visiting time: " << visit_time << std::endl;
} //

void model_check const petri_net n,
const spot::ltl::formula f,
bool  ce_expected,
bool  fm_exprop_opt = false,
bool  fm_symb_merge_opt = true,
bool  post_branching = false,
bool  fair_loop_approx = false
 

Check if the Petri net n can produce at least one infinite sequence accepted by the formula f.

If this is the case and ce_expected is true, such a sequence is displayed. In other case, a message indicating if the test is satisfied or not is printed. The four last parameters specify options for the translation of the formula f in a TGBA as indicated for the function spot::ltl_to_tgba_fm.

void model_check(const petri_net* n, const spot::ltl::formula* f,
                  bool ce_expected, bool fm_exprop_opt, bool fm_symb_merge_opt,
                                  bool post_branching, bool fair_loop_approx) {
  double start_time, build_time, check_time;


  const std::string* s;
  if ((s = check_at_prop(n, f))) {
    std::cout << "the atomic proposition '" << *s
              << "' does not correspond to a place name" << std::endl;
    return;
  }

  spot::bdd_dict dict;

  spot::ltl::atomic_prop_set* sap = spot::ltl::atomic_prop_collect(f);

  pn_tgba p(n, sap, &dict);

  spot::timer_map timers;
  timers.start("construction");
  spot::tgba* a = spot::ltl_to_tgba_fm(f, &dict, fm_exprop_opt,
                         fm_symb_merge_opt, post_branching, fair_loop_approx);

  spot::tgba_product prod(a, &p);

  spot::emptiness_check *ec= new spot::couvreur99_check(&prod);
  timers.stop("construction");

  timers.start("emptiness check");
  spot::emptiness_check_result* res = ec->check();
  timers.stop("emptiness check");

  ec->print_stats(std::cout);

  timers.print(std::cout);

  if (res) {
    if (ce_expected) {
      std::cout << "an accepting run exists" << std::endl;
      spot::tgba_run* run = res->accepting_run();
      if (run)
        {
          spot::print_tgba_run(std::cout, &prod, run);
          delete run;
        }
    }
    else {
      std::cout << "an accepting run exists (use option '-e' to print it)"
                << std::endl;
    }
    delete res;
  }
  else {
    std::cout << "no accepting run found" << std::endl;
  }

  delete ec;
  delete a;
  delete sap;

  return;
} //

void print_reachability_graph const petri_net n  ) 
 

Display the reachability graph of the Petri net n.

void print_reachability_graph(const petri_net* n) {

  pn_tgba p(n);
  marking_graph_visitor mgv(&p);
  mgv.run();
} //


Please comment this page and report errors about it on the RefDocComments page.
Generated on Mon Jan 31 15:17:13 2005 for checkpn by doxygen 1.4.0