TA Product optimization and WFair Formulas generation
* src/ta/taproduct.cc: TA Product optimization * src/ltltest/randltl.cc: WFair Formulas generation
This commit is contained in:
parent
c774ba141d
commit
2aad5b10d2
2 changed files with 98 additions and 50 deletions
|
|
@ -28,6 +28,7 @@
|
|||
#include <string>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <sstream>
|
||||
#include "ltlast/atomic_prop.hh"
|
||||
#include "ltlvisit/randomltl.hh"
|
||||
#include "ltlvisit/tostring.hh"
|
||||
|
|
@ -36,6 +37,14 @@
|
|||
#include "ltlenv/defaultenv.hh"
|
||||
#include "misc/random.hh"
|
||||
|
||||
#include "ltlast/allnodes.hh"
|
||||
|
||||
|
||||
using namespace spot;
|
||||
using namespace spot::ltl;
|
||||
|
||||
environment& env(default_environment::instance());
|
||||
|
||||
void
|
||||
syntax(char* prog)
|
||||
{
|
||||
|
|
@ -86,6 +95,35 @@ to_int(const char* s)
|
|||
return res;
|
||||
}
|
||||
|
||||
|
||||
// GF(p_1) & GF(p_2) & ... & GF(p_n)
|
||||
formula* GF_n(spot::ltl::atomic_prop_set* ap, int n)
|
||||
{
|
||||
|
||||
formula* result = 0;
|
||||
|
||||
multop::type op = multop::And;
|
||||
|
||||
spot::ltl::atomic_prop_set::const_iterator i = ap->begin();
|
||||
while (i != ap->end())
|
||||
{
|
||||
|
||||
std::ostringstream p;
|
||||
p << (*i)->name();
|
||||
++i;
|
||||
formula* f = unop::instance(unop::G,
|
||||
unop::instance(unop::F,
|
||||
env.require(p.str())));
|
||||
|
||||
if (result)
|
||||
result = multop::instance(op, f, result);
|
||||
else
|
||||
result = f;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
|
|
@ -102,6 +140,7 @@ main(int argc, char** argv)
|
|||
bool opt_u = false;
|
||||
spot::ltl::ltl_simplifier_options simpopt(true, true, true, true, true);
|
||||
spot::ltl::ltl_simplifier simp(simpopt);
|
||||
bool opt_wFair = false;
|
||||
|
||||
spot::ltl::environment& env(spot::ltl::default_environment::instance());
|
||||
spot::ltl::atomic_prop_set* ap = new spot::ltl::atomic_prop_set;
|
||||
|
|
@ -183,6 +222,10 @@ main(int argc, char** argv)
|
|||
{
|
||||
opt_u = true;
|
||||
}
|
||||
else if (!strcmp(argv[argn], "-wf"))
|
||||
{
|
||||
opt_wFair = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ap->insert(static_cast<const spot::ltl::atomic_prop*>
|
||||
|
|
@ -315,6 +358,10 @@ main(int argc, char** argv)
|
|||
while (max_tries_r--)
|
||||
{
|
||||
f = rf->generate(opt_f);
|
||||
if (opt_wFair)
|
||||
{
|
||||
f = GF_n(atomic_prop_collect(f, 0), f->hash());
|
||||
}
|
||||
if (opt_r)
|
||||
{
|
||||
const spot::ltl::formula* g = simp.simplify(f);
|
||||
|
|
|
|||
|
|
@ -157,9 +157,11 @@ namespace spot
|
|||
return;
|
||||
}
|
||||
|
||||
if (ta_succ_it_ == 0){
|
||||
if (ta_succ_it_ == 0)
|
||||
{
|
||||
current_condition_ = bdd_setxor(sc, dc);
|
||||
ta_succ_it_ = ta_->succ_iter(source_->get_ta_state(), current_condition_);
|
||||
ta_succ_it_ = ta_->succ_iter(source_->get_ta_state(),
|
||||
current_condition_);
|
||||
ta_succ_it_->first();
|
||||
}
|
||||
|
||||
|
|
@ -249,25 +251,24 @@ namespace spot
|
|||
ta::states_set_t::const_iterator it;
|
||||
|
||||
ta::states_set_t initial_states_set;
|
||||
state* kripke_init_state = kripke_->get_init_state();
|
||||
bdd kripke_init_state_condition = kripke_->state_condition(
|
||||
kripke_init_state);
|
||||
|
||||
for (it = ta_init_states_set.begin(); it != ta_init_states_set.end(); it++)
|
||||
{
|
||||
state* kripke_init_state = kripke_->get_init_state();
|
||||
if ((kripke_->state_condition(kripke_init_state))
|
||||
== (ta_->get_state_condition(*it)))
|
||||
|
||||
if (kripke_init_state_condition == (ta_->get_state_condition(*it)))
|
||||
{
|
||||
state_ta_product* stp = new state_ta_product((*it),
|
||||
kripke_init_state);
|
||||
kripke_init_state->clone());
|
||||
|
||||
initial_states_set.insert(stp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
kripke_init_state->destroy();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return initial_states_set;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue