* src/tgbaalgos/emptiness_stats.hh (accs_statistics): New class.
* src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/gtec/ce.hh (couvreur99_check_result): Inherit from acss_statistics. (couvreur99_check_result::acss_states): Implement it. * src/tgbatest/randtgba.cc: Display statistics about accepting cycle search space.
This commit is contained in:
parent
13183893dd
commit
ca2fe6c711
5 changed files with 165 additions and 48 deletions
|
|
@ -1,5 +1,12 @@
|
||||||
2005-01-03 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
2005-01-03 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
|
* src/tgbaalgos/emptiness_stats.hh (accs_statistics): New class.
|
||||||
|
* src/tgbaalgos/gtec/ce.cc, src/tgbaalgos/gtec/ce.hh
|
||||||
|
(couvreur99_check_result): Inherit from acss_statistics.
|
||||||
|
(couvreur99_check_result::acss_states): Implement it.
|
||||||
|
* src/tgbatest/randtgba.cc: Display statistics about accepting cycle
|
||||||
|
search space.
|
||||||
|
|
||||||
* src/tgbaalgos/ndfs_result.hh (construct_prefix): Do not call
|
* src/tgbaalgos/ndfs_result.hh (construct_prefix): Do not call
|
||||||
erase() after splice(), splice() already removes the elements.
|
erase() after splice(), splice() already removes the elements.
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,42 +33,58 @@ namespace spot
|
||||||
public :
|
public :
|
||||||
ec_statistics()
|
ec_statistics()
|
||||||
: states_(0), transitions_(0), depth_(0), max_depth_(0)
|
: states_(0), transitions_(0), depth_(0), max_depth_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void set_states(int n)
|
|
||||||
{
|
void
|
||||||
states_ = n;
|
set_states(int n)
|
||||||
}
|
{
|
||||||
void inc_states()
|
states_ = n;
|
||||||
{
|
}
|
||||||
++states_;
|
|
||||||
}
|
void
|
||||||
void inc_transitions()
|
inc_states()
|
||||||
{
|
{
|
||||||
++transitions_;
|
++states_;
|
||||||
}
|
}
|
||||||
void inc_depth()
|
|
||||||
{
|
void
|
||||||
++depth_;
|
inc_transitions()
|
||||||
if (depth_ > max_depth_)
|
{
|
||||||
max_depth_ = depth_;
|
++transitions_;
|
||||||
}
|
}
|
||||||
void dec_depth()
|
|
||||||
{
|
void
|
||||||
--depth_;
|
inc_depth()
|
||||||
}
|
{
|
||||||
int states() const
|
++depth_;
|
||||||
{
|
if (depth_ > max_depth_)
|
||||||
return states_;
|
max_depth_ = depth_;
|
||||||
}
|
}
|
||||||
int transitions() const
|
|
||||||
{
|
void
|
||||||
return transitions_;
|
dec_depth()
|
||||||
}
|
{
|
||||||
int max_depth() const
|
--depth_;
|
||||||
{
|
}
|
||||||
return max_depth_;
|
|
||||||
}
|
int
|
||||||
|
states() const
|
||||||
|
{
|
||||||
|
return states_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
transitions() const
|
||||||
|
{
|
||||||
|
return transitions_;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
max_depth() const
|
||||||
|
{
|
||||||
|
return max_depth_;
|
||||||
|
}
|
||||||
|
|
||||||
private :
|
private :
|
||||||
unsigned states_; /// number of disctint visited states
|
unsigned states_; /// number of disctint visited states
|
||||||
|
|
@ -77,6 +93,13 @@ namespace spot
|
||||||
unsigned max_depth_; /// maximal depth of the stack(s)
|
unsigned max_depth_; /// maximal depth of the stack(s)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// Accepting Cycle Search Space statistics
|
||||||
|
class acss_statistics
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual int acss_states() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
/// @}
|
/// @}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
@ -78,6 +78,19 @@ namespace spot
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
couvreur99_check_result::acss_states() const
|
||||||
|
{
|
||||||
|
int count = 0;
|
||||||
|
int scc_root = ecs_->root.s.top().index;
|
||||||
|
|
||||||
|
numbered_state_heap_const_iterator* i = ecs_->h->iterator();
|
||||||
|
for (i->first(); !i->done(); i->next())
|
||||||
|
if (i->get_index() >= scc_root)
|
||||||
|
++count;
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
tgba_run*
|
tgba_run*
|
||||||
couvreur99_check_result::accepting_run()
|
couvreur99_check_result::accepting_run()
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
@ -24,11 +24,14 @@
|
||||||
|
|
||||||
#include "status.hh"
|
#include "status.hh"
|
||||||
#include "tgbaalgos/emptiness.hh"
|
#include "tgbaalgos/emptiness.hh"
|
||||||
|
#include "tgbaalgos/emptiness_stats.hh"
|
||||||
|
|
||||||
namespace spot
|
namespace spot
|
||||||
{
|
{
|
||||||
/// Compute a counter example from a spot::couvreur99_check_status
|
/// Compute a counter example from a spot::couvreur99_check_status
|
||||||
class couvreur99_check_result: public emptiness_check_result
|
class couvreur99_check_result:
|
||||||
|
public emptiness_check_result,
|
||||||
|
public acss_statistics
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
couvreur99_check_result(const couvreur99_check_status* ecs);
|
couvreur99_check_result(const couvreur99_check_status* ecs);
|
||||||
|
|
@ -37,6 +40,8 @@ namespace spot
|
||||||
|
|
||||||
void print_stats(std::ostream& os) const;
|
void print_stats(std::ostream& os) const;
|
||||||
|
|
||||||
|
virtual int acss_states() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/// Called by accepting_run() to find a cycle which traverses all
|
/// Called by accepting_run() to find a cycle which traverses all
|
||||||
/// acceptance conditions in the accepted SCC.
|
/// acceptance conditions in the accepted SCC.
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright (C) 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
|
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
|
||||||
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
|
||||||
// et Marie Curie.
|
// et Marie Curie.
|
||||||
//
|
//
|
||||||
|
|
@ -223,6 +223,35 @@ struct ec_stat
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct acss_stat
|
||||||
|
{
|
||||||
|
int min_states;
|
||||||
|
int max_states;
|
||||||
|
int tot_states;
|
||||||
|
int n;
|
||||||
|
|
||||||
|
acss_stat()
|
||||||
|
: n(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
count(const spot::acss_statistics* acss)
|
||||||
|
{
|
||||||
|
int s = acss->acss_states();
|
||||||
|
if (n++)
|
||||||
|
{
|
||||||
|
min_states = std::min(min_states, s);
|
||||||
|
max_states = std::max(max_states, s);
|
||||||
|
tot_states += s;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
min_states = max_states = tot_states = s;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
struct ar_stat
|
struct ar_stat
|
||||||
{
|
{
|
||||||
int min_prefix;
|
int min_prefix;
|
||||||
|
|
@ -268,6 +297,9 @@ struct ar_stat
|
||||||
typedef std::map<std::string, ec_stat> ec_stats_type;
|
typedef std::map<std::string, ec_stat> ec_stats_type;
|
||||||
ec_stats_type ec_stats;
|
ec_stats_type ec_stats;
|
||||||
|
|
||||||
|
typedef std::map<std::string, acss_stat> acss_stats_type;
|
||||||
|
acss_stats_type acss_stats;
|
||||||
|
|
||||||
typedef std::map<std::string, ar_stat> ar_stats_type;
|
typedef std::map<std::string, ar_stat> ar_stats_type;
|
||||||
ar_stats_type ar_stats; // Statistics about accepting runs.
|
ar_stats_type ar_stats; // Statistics about accepting runs.
|
||||||
ar_stats_type mar_stats; // ... about minimized accepting runs.
|
ar_stats_type mar_stats; // ... about minimized accepting runs.
|
||||||
|
|
@ -282,7 +314,7 @@ print_ar_stats(ar_stats_type& ar_stats)
|
||||||
<< " | prefix | cycle |"
|
<< " | prefix | cycle |"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(22) << "algorithm"
|
<< std::setw(22) << "algorithm"
|
||||||
<< " | min < mean < max | min < mean < max | n "
|
<< " | min < mean < max | min < mean < max | n"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
@ -311,7 +343,7 @@ print_ar_stats(ar_stats_type& ar_stats)
|
||||||
<< " | runs | total |"
|
<< " | runs | total |"
|
||||||
<< std::endl <<
|
<< std::endl <<
|
||||||
std::setw(22) << "algorithm"
|
std::setw(22) << "algorithm"
|
||||||
<< " | min < mean < max | pre. cyc. runs | n "
|
<< " | min < mean < max | pre. cyc. runs | n"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
|
|
@ -540,13 +572,17 @@ main(int argc, char** argv)
|
||||||
}
|
}
|
||||||
tm_ec.stop(algo);
|
tm_ec.stop(algo);
|
||||||
const spot::ec_statistics* ecs =
|
const spot::ec_statistics* ecs =
|
||||||
dynamic_cast<const spot::ec_statistics*>(ec);
|
dynamic_cast<const spot::ec_statistics*>(ec);
|
||||||
if (opt_z && ecs)
|
if (opt_z && ecs)
|
||||||
ec_stats[algo].count(ecs);
|
ec_stats[algo].count(ecs);
|
||||||
if (res)
|
if (res)
|
||||||
{
|
{
|
||||||
std::cout << "acc. run";
|
std::cout << "acc. run";
|
||||||
++n_non_empty;
|
++n_non_empty;
|
||||||
|
const spot::acss_statistics* acss =
|
||||||
|
dynamic_cast<const spot::acss_statistics*>(res);
|
||||||
|
if (opt_z && acss)
|
||||||
|
acss_stats[algo].count(acss);
|
||||||
if (opt_replay)
|
if (opt_replay)
|
||||||
{
|
{
|
||||||
spot::tgba_run* run;
|
spot::tgba_run* run;
|
||||||
|
|
@ -658,6 +694,7 @@ main(int argc, char** argv)
|
||||||
|
|
||||||
if (!ec_stats.empty())
|
if (!ec_stats.empty())
|
||||||
{
|
{
|
||||||
|
std::cout << std::endl;
|
||||||
std::ios::fmtflags old = std::cout.flags();
|
std::ios::fmtflags old = std::cout.flags();
|
||||||
std::cout << std::right << std::fixed << std::setprecision(1);
|
std::cout << std::right << std::fixed << std::setprecision(1);
|
||||||
|
|
||||||
|
|
@ -665,12 +702,12 @@ main(int argc, char** argv)
|
||||||
std::cout << std::setw(22) << ""
|
std::cout << std::setw(22) << ""
|
||||||
<< " | states | transitions |"
|
<< " | states | transitions |"
|
||||||
<< std::endl << std::setw(22) << "algorithm"
|
<< std::endl << std::setw(22) << "algorithm"
|
||||||
<< " | min < mean < max | min < mean < max | n "
|
<< " | min < mean < max | min < mean < max | n"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
<< std::setw(79) << std::setfill('-') << "" << std::setfill(' ')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
for (ec_stats_type::const_iterator i = ec_stats.begin();
|
for (ec_stats_type::const_iterator i = ec_stats.begin();
|
||||||
i != ec_stats.end(); ++i)
|
i != ec_stats.end(); ++i)
|
||||||
std::cout << std::setw(22) << i->first << " |"
|
std::cout << std::setw(22) << i->first << " |"
|
||||||
<< std::setw(6) << i->second.min_states
|
<< std::setw(6) << i->second.min_states
|
||||||
<< " "
|
<< " "
|
||||||
|
|
@ -694,12 +731,12 @@ main(int argc, char** argv)
|
||||||
<< " | maximal depth |"
|
<< " | maximal depth |"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(22) << "algorithm"
|
<< std::setw(22) << "algorithm"
|
||||||
<< " | min < mean < max | n "
|
<< " | min < mean < max | n"
|
||||||
<< std::endl
|
<< std::endl
|
||||||
<< std::setw(59) << std::setfill('-') << "" << std::setfill(' ')
|
<< std::setw(53) << std::setfill('-') << "" << std::setfill(' ')
|
||||||
<< std::endl;
|
<< std::endl;
|
||||||
for (ec_stats_type::const_iterator i = ec_stats.begin();
|
for (ec_stats_type::const_iterator i = ec_stats.begin();
|
||||||
i != ec_stats.end(); ++i)
|
i != ec_stats.end(); ++i)
|
||||||
std::cout << std::setw(22) << i->first << " |"
|
std::cout << std::setw(22) << i->first << " |"
|
||||||
<< std::setw(6)
|
<< std::setw(6)
|
||||||
<< i->second.min_max_depth
|
<< i->second.min_max_depth
|
||||||
|
|
@ -716,6 +753,38 @@ main(int argc, char** argv)
|
||||||
std::cout << std::setiosflags(old);
|
std::cout << std::setiosflags(old);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!acss_stats.empty())
|
||||||
|
{
|
||||||
|
std::cout << std::endl;
|
||||||
|
std::ios::fmtflags old = std::cout.flags();
|
||||||
|
std::cout << std::right << std::fixed << std::setprecision(1);
|
||||||
|
|
||||||
|
std::cout << "Statistics about accepting cycle search space:"
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << std::setw(22) << ""
|
||||||
|
<< " | states |"
|
||||||
|
<< std::endl << std::setw(22) << "algorithm"
|
||||||
|
<< " | min < mean < max | total | n"
|
||||||
|
<< std::endl
|
||||||
|
<< std::setw(61) << std::setfill('-') << "" << std::setfill(' ')
|
||||||
|
<< std::endl;
|
||||||
|
for (acss_stats_type::const_iterator i = acss_stats.begin();
|
||||||
|
i != acss_stats.end(); ++i)
|
||||||
|
std::cout << std::setw(22) << i->first << " |"
|
||||||
|
<< std::setw(6) << i->second.min_states
|
||||||
|
<< " "
|
||||||
|
<< std::setw(8)
|
||||||
|
<< static_cast<float>(i->second.tot_states) / i->second.n
|
||||||
|
<< " "
|
||||||
|
<< std::setw(6) << i->second.max_states
|
||||||
|
<< " |"
|
||||||
|
<< std::setw(6) << i->second.tot_states
|
||||||
|
<< " |"
|
||||||
|
<< std::setw(4) << i->second.n
|
||||||
|
<< std::endl;
|
||||||
|
std::cout << std::setiosflags(old);
|
||||||
|
}
|
||||||
|
|
||||||
if (!ar_stats.empty())
|
if (!ar_stats.empty())
|
||||||
{
|
{
|
||||||
std::cout << std::endl
|
std::cout << std::endl
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue