Fix non determinism in the simulation.
* src/tgbaalgos/simulation.cc: Fix non determinism. * src/tgbatest/simdet.test: Test that the behavior is now correct. * src/tgbatest/Makefile.am (TESTS): Add the new test to the test-suite.
This commit is contained in:
parent
49d384b1eb
commit
d10e772d35
3 changed files with 55 additions and 6 deletions
|
|
@ -147,8 +147,10 @@ namespace spot
|
||||||
map_state_unsigned::const_iterator i = state2int.find(s);
|
map_state_unsigned::const_iterator i = state2int.find(s);
|
||||||
if (i == state2int.end())
|
if (i == state2int.end())
|
||||||
{
|
{
|
||||||
i = state2int.insert(std::make_pair(s, ++current_max)).first;
|
i = state2int.insert(std::make_pair(s, ++current_max)).first;
|
||||||
previous_class_[out_->add_state(current_max)] = bddfalse;
|
const state* to_add = out_->add_state(current_max);
|
||||||
|
previous_class_[to_add] = bddfalse;
|
||||||
|
order_.push_back(to_add);
|
||||||
}
|
}
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
|
|
@ -192,6 +194,7 @@ namespace spot
|
||||||
size_t size;
|
size_t size;
|
||||||
tgba_explicit_number* out_;
|
tgba_explicit_number* out_;
|
||||||
map_state_bdd previous_class_;
|
map_state_bdd previous_class_;
|
||||||
|
std::list<const state*> order_;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const tgba* ea_;
|
const tgba* ea_;
|
||||||
|
|
@ -262,6 +265,8 @@ namespace spot
|
||||||
}
|
}
|
||||||
|
|
||||||
relation_[init] = init;
|
relation_[init] = init;
|
||||||
|
|
||||||
|
order_ = acc_compl.order_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -369,11 +374,11 @@ namespace spot
|
||||||
// all the reachable states of this automaton. We do not
|
// all the reachable states of this automaton. We do not
|
||||||
// have to make (again) a traversal. We just have to run
|
// have to make (again) a traversal. We just have to run
|
||||||
// through this map.
|
// through this map.
|
||||||
for (map_state_bdd::iterator it = previous_class_.begin();
|
for (std::list<const state*>::const_iterator it = order_.begin();
|
||||||
it != previous_class_.end();
|
it != order_.end();
|
||||||
++it)
|
++it)
|
||||||
{
|
{
|
||||||
const state* src = it->first;
|
const state* src = previous_class_.find(*it)->first;
|
||||||
|
|
||||||
bdd_lstate_[compute_sig(src)].push_back(src);
|
bdd_lstate_[compute_sig(src)].push_back(src);
|
||||||
}
|
}
|
||||||
|
|
@ -711,6 +716,9 @@ namespace spot
|
||||||
state* initial_state;
|
state* initial_state;
|
||||||
|
|
||||||
automaton_size stat;
|
automaton_size stat;
|
||||||
|
|
||||||
|
// The order of the state.
|
||||||
|
std::list<const state*> order_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // End namespace anonymous.
|
} // End namespace anonymous.
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ tripprod_SOURCES = tripprod.cc
|
||||||
# because such failures will be easier to diagnose and fix.
|
# because such failures will be easier to diagnose and fix.
|
||||||
TESTS = \
|
TESTS = \
|
||||||
intvcomp.test \
|
intvcomp.test \
|
||||||
|
simdet.test \
|
||||||
eltl2tgba.test \
|
eltl2tgba.test \
|
||||||
explicit.test \
|
explicit.test \
|
||||||
explicit2.test \
|
explicit2.test \
|
||||||
|
|
|
||||||
40
src/tgbatest/simdet.test
Executable file
40
src/tgbatest/simdet.test
Executable file
|
|
@ -0,0 +1,40 @@
|
||||||
|
#! /bin/sh
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
# Copyright (C) 2012 Laboratoire de Recherche et Développement
|
||||||
|
# de l'Epita (LRDE).
|
||||||
|
#
|
||||||
|
# This file is part of Spot, a model checking library.
|
||||||
|
#
|
||||||
|
# Spot is free software; you can redistribute it and/or modify it
|
||||||
|
# under the terms of the GNU General Public License as published by
|
||||||
|
# the Free Software Foundation; either version 3 of the License, or
|
||||||
|
# (at your option) any later version.
|
||||||
|
#
|
||||||
|
# Spot is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||||
|
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
||||||
|
# License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
. ./defs
|
||||||
|
set -e
|
||||||
|
|
||||||
|
run 0 ../ltl2tgba -R3 -RIS \
|
||||||
|
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
|
||||||
|
> exp
|
||||||
|
run 0 ../ltl2tgba -R3 -RIS \
|
||||||
|
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
|
||||||
|
> out
|
||||||
|
|
||||||
|
diff exp out
|
||||||
|
|
||||||
|
run 0 ../ltl2tgba -R3 -RIS \
|
||||||
|
'G("P_1.p2" <-> (F"P_1.p3" & ("P_0.p3" | (X"P_1.CS" U "P_1.p2")))) U G"P_1.p2"'\
|
||||||
|
> out
|
||||||
|
|
||||||
|
diff exp out
|
||||||
|
|
||||||
|
rm exp out
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue