show how to implement product in Python
* wrap/python/tests/product.ipynb: New file. * wrap/python/tests/Makefile.am, doc/org/tut.org: Add it. * wrap/python/tests/ipnbdoctest.py: Ignore %timeit results. * wrap/python/spot_impl.i: Add bindings for set_state_names()/get_state_names(). * spot/twaalgos/product.cc: Fix computation of properties. * doc/org/hoa.org: Name. * NEWS: Update.
This commit is contained in:
parent
ad37cacbc0
commit
74ec9c54c4
8 changed files with 2055 additions and 3 deletions
|
|
@ -339,6 +339,7 @@ namespace std {
|
|||
%template(liststr) list<std::string>;
|
||||
%template(vectorformula) vector<spot::formula>;
|
||||
%template(vectorunsigned) vector<unsigned>;
|
||||
%template(vectorstring) vector<string>;
|
||||
%template(atomic_prop_set) set<spot::formula>;
|
||||
%template(relabeling_map) map<spot::formula, spot::formula>;
|
||||
}
|
||||
|
|
@ -465,6 +466,18 @@ namespace std {
|
|||
std::string __str__() { return spot::str_psl(*self); }
|
||||
}
|
||||
|
||||
%extend spot::bdd_dict {
|
||||
bool operator==(const spot::bdd_dict& b) const
|
||||
{
|
||||
return self == &b;
|
||||
}
|
||||
|
||||
bool operator!=(const spot::bdd_dict& b) const
|
||||
{
|
||||
return self != &b;
|
||||
}
|
||||
}
|
||||
|
||||
%extend spot::twa {
|
||||
void set_name(std::string name)
|
||||
{
|
||||
|
|
@ -475,6 +488,17 @@ namespace std {
|
|||
{
|
||||
return self->get_named_prop<std::string>("automaton-name");
|
||||
}
|
||||
|
||||
void set_state_names(std::vector<std::string> names)
|
||||
{
|
||||
self->set_named_prop("state-names",
|
||||
new std::vector<std::string>(std::move(names)));
|
||||
}
|
||||
|
||||
std::vector<std::string>* get_state_names()
|
||||
{
|
||||
return self->get_named_prop<std::vector<std::string>>("state-names");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ TESTS = \
|
|||
optionmap.py \
|
||||
parsetgba.py \
|
||||
piperead.ipynb \
|
||||
product.ipynb \
|
||||
randaut.ipynb \
|
||||
randgen.py \
|
||||
randltl.ipynb \
|
||||
|
|
|
|||
|
|
@ -70,6 +70,9 @@ def sanitize(s):
|
|||
# normalize graphviz version
|
||||
s = re.sub(r'Generated by graphviz version.*', 'VERSION', s)
|
||||
|
||||
# ignore %timeit results
|
||||
s = re.sub(r'^[0-9]+ loops, best of 3:.*per loop', '', s)
|
||||
|
||||
# SVG generated by graphviz may put note at different positions
|
||||
# depending on the graphviz build. Let's just strip anything that
|
||||
# look like a position.
|
||||
|
|
|
|||
2001
wrap/python/tests/product.ipynb
Normal file
2001
wrap/python/tests/product.ipynb
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue