* iface/gspn/eesrg.cc (tgba_succ_iterator_gspn_eesrg::first_): New
attribute. (tgba_succ_iterator_gspn_eesrg::step): Use first_. Loop until succ returns some successors. Report from Soheib Baarir.
This commit is contained in:
parent
f31caafb50
commit
10b2511dda
2 changed files with 68 additions and 50 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
2003-11-07 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
|
* iface/gspn/eesrg.cc (tgba_succ_iterator_gspn_eesrg::first_): New
|
||||||
|
attribute.
|
||||||
|
(tgba_succ_iterator_gspn_eesrg::step): Use first_. Loop until
|
||||||
|
succ returns some successors.
|
||||||
|
Report from Soheib Baarir.
|
||||||
|
|
||||||
2003-11-06 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
2003-11-06 Alexandre Duret-Lutz <adl@src.lip6.fr>
|
||||||
|
|
||||||
* iface/gspn/eesrg.cc (tgba_succ_iterator_gspn_eesrg::step): Fix
|
* iface/gspn/eesrg.cc (tgba_succ_iterator_gspn_eesrg::step): Fix
|
||||||
|
|
|
||||||
|
|
@ -162,17 +162,15 @@ namespace spot
|
||||||
successors_(0),
|
successors_(0),
|
||||||
size_(0),
|
size_(0),
|
||||||
current_(0),
|
current_(0),
|
||||||
data_(data)
|
data_(data),
|
||||||
|
not_first_(false)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual
|
virtual
|
||||||
~tgba_succ_iterator_gspn_eesrg()
|
~tgba_succ_iterator_gspn_eesrg()
|
||||||
{
|
{
|
||||||
// If the iterator is done, successors_ has already
|
if (successors_)
|
||||||
// been freed from step(). (We can't use 0 do indicate
|
|
||||||
// this, because successor_==0 means something else to step().)
|
|
||||||
if (successors_ && !done())
|
|
||||||
succ_free(successors_);
|
succ_free(successors_);
|
||||||
if (operand_)
|
if (operand_)
|
||||||
delete operand_;
|
delete operand_;
|
||||||
|
|
@ -184,60 +182,71 @@ namespace spot
|
||||||
if (++current_ < size_)
|
if (++current_ < size_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (successors_)
|
do
|
||||||
succ_free(successors_);
|
|
||||||
|
|
||||||
if (all_conds_ == bddfalse)
|
|
||||||
{
|
{
|
||||||
// SUCCESSORS_ is 0 when step() is called from first().
|
|
||||||
if (successors_)
|
if (successors_)
|
||||||
{
|
{
|
||||||
assert(!operand_->done());
|
succ_free(successors_);
|
||||||
operand_->next();
|
successors_ = 0;
|
||||||
}
|
}
|
||||||
if (operand_->done())
|
|
||||||
return;
|
|
||||||
all_conds_ = operand_->current_condition();
|
|
||||||
outside_ = !all_conds_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bdd cond = bdd_satone(all_conds_);
|
if (all_conds_ == bddfalse)
|
||||||
cond = bdd_simplify(cond, cond | outside_);
|
|
||||||
all_conds_ -= cond;
|
|
||||||
|
|
||||||
// Translate COND into an array of properties.
|
|
||||||
signed char* props = data_->all_props;
|
|
||||||
memset(props, -1, data_->prop_count);
|
|
||||||
while (cond != bddtrue)
|
|
||||||
{
|
|
||||||
int var = bdd_var(cond);
|
|
||||||
|
|
||||||
bdd high = bdd_high(cond);
|
|
||||||
int res;
|
|
||||||
if (high == bddfalse)
|
|
||||||
{
|
{
|
||||||
cond = bdd_low(cond);
|
if (not_first_)
|
||||||
res = 0;
|
{
|
||||||
|
assert(!operand_->done());
|
||||||
|
operand_->next();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// operand_->first() has already been called from first().
|
||||||
|
not_first_ = true;
|
||||||
|
}
|
||||||
|
if (operand_->done())
|
||||||
|
return;
|
||||||
|
all_conds_ = operand_->current_condition();
|
||||||
|
outside_ = !all_conds_;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
bdd cond = bdd_satone(all_conds_);
|
||||||
|
cond = bdd_simplify(cond, cond | outside_);
|
||||||
|
all_conds_ -= cond;
|
||||||
|
|
||||||
|
// Translate COND into an array of properties.
|
||||||
|
signed char* props = data_->all_props;
|
||||||
|
memset(props, -1, data_->prop_count);
|
||||||
|
while (cond != bddtrue)
|
||||||
{
|
{
|
||||||
cond = high;
|
int var = bdd_var(cond);
|
||||||
res = 1;
|
|
||||||
|
bdd high = bdd_high(cond);
|
||||||
|
int res;
|
||||||
|
if (high == bddfalse)
|
||||||
|
{
|
||||||
|
cond = bdd_low(cond);
|
||||||
|
res = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cond = high;
|
||||||
|
res = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// It's OK if VAR is unknown from GreatSPN (it might
|
||||||
|
// have been used to synchornize another automaton or
|
||||||
|
// something), just skip it.
|
||||||
|
tgba_gspn_eesrg_private_::prop_map::iterator i =
|
||||||
|
data_->prop_dict.find(var);
|
||||||
|
if (i != data_->prop_dict.end())
|
||||||
|
props[i->second] = res;
|
||||||
|
|
||||||
|
assert(cond != bddfalse);
|
||||||
}
|
}
|
||||||
|
|
||||||
// It's OK if VAR is unknown from GreatSPN (it might have
|
succ(state_, props, &successors_, &size_);
|
||||||
// been used to synchornize other automaton or something),
|
current_ = 0;
|
||||||
// just skip it.
|
|
||||||
tgba_gspn_eesrg_private_::prop_map::iterator i =
|
|
||||||
data_->prop_dict.find(var);
|
|
||||||
if (i != data_->prop_dict.end())
|
|
||||||
props[i->second] = res;
|
|
||||||
|
|
||||||
assert(cond != bddfalse);
|
|
||||||
}
|
}
|
||||||
|
while (size_ == 0); // Repeat until we have a successor.
|
||||||
succ(state_, props, &successors_, &size_);
|
|
||||||
current_ = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void
|
virtual void
|
||||||
|
|
@ -309,6 +318,7 @@ namespace spot
|
||||||
size_t size_; /// size of successors_
|
size_t size_; /// size of successors_
|
||||||
size_t current_; /// current position in successors_
|
size_t current_; /// current position in successors_
|
||||||
tgba_gspn_eesrg_private_* data_;
|
tgba_gspn_eesrg_private_* data_;
|
||||||
|
bool not_first_; /// Whether this is not the first step.
|
||||||
}; // tgba_succ_iterator_gspn_eesrg
|
}; // tgba_succ_iterator_gspn_eesrg
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -355,8 +365,8 @@ namespace spot
|
||||||
|
|
||||||
tgba_succ_iterator*
|
tgba_succ_iterator*
|
||||||
tgba_gspn_eesrg::succ_iter(const state* state,
|
tgba_gspn_eesrg::succ_iter(const state* state,
|
||||||
const state* global_state,
|
const state* global_state,
|
||||||
const tgba* global_automaton) const
|
const tgba* global_automaton) const
|
||||||
{
|
{
|
||||||
const state_gspn_eesrg* s = dynamic_cast<const state_gspn_eesrg*>(state);
|
const state_gspn_eesrg* s = dynamic_cast<const state_gspn_eesrg*>(state);
|
||||||
assert(s);
|
assert(s);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue