toparity: rename iar_old()/iar_maybe_old() to iar()/iar_maybe()
* spot/twaalgos/toparity.hh, spot/twaalgos/toparity.cc: Use the original names, to minimize differences with spot 2.8. Deprecate them. * tests/python/except.py: Adjust. * NEWS: Mention the change.
This commit is contained in:
parent
0a95314dca
commit
2b918d1c02
4 changed files with 44 additions and 27 deletions
12
NEWS
12
NEWS
|
|
@ -100,8 +100,16 @@ New in spot 2.8.7.dev (not yet released)
|
|||
same transition structure (where the ..._maybe() variant would
|
||||
modify the Rabin automaton if needed).
|
||||
|
||||
- to_parity() now combines several strategies for paritizing any
|
||||
automaton.
|
||||
- to_parity() has been rewritten now combines several strategies for
|
||||
paritizing automata with any acceptance condition.
|
||||
|
||||
Backward-incompatible changes:
|
||||
|
||||
- iar() and iar_maybe() have been moved from
|
||||
spot/twaalgos/rabin2parity.hh spot/twaalgos/toparity.hh and marked
|
||||
as deprecated, they should be replaced by to_parity(). In case
|
||||
the input is Rabin-like or Streett-like, to_parity() should be at
|
||||
least as good as iar().
|
||||
|
||||
New in spot 2.8.7 (2020-03-13)
|
||||
|
||||
|
|
|
|||
|
|
@ -39,8 +39,8 @@
|
|||
namespace spot
|
||||
{
|
||||
|
||||
// Old version of IAR.
|
||||
namespace
|
||||
// Old version of IAR.
|
||||
namespace
|
||||
{
|
||||
|
||||
using perm_t = std::vector<unsigned>;
|
||||
|
|
@ -346,10 +346,11 @@ namespace
|
|||
std::vector<unsigned> state2pos_iar_states;
|
||||
std::vector<std::pair<iar_state, unsigned>> iar_states;
|
||||
};
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
iar_maybe_old(const const_twa_graph_ptr& aut, bool pretty_print)
|
||||
// Make this a function different from iar_maybe(), so that
|
||||
// iar() does not have to call a deprecated function.
|
||||
static twa_graph_ptr
|
||||
iar_maybe_(const const_twa_graph_ptr& aut, bool pretty_print)
|
||||
{
|
||||
std::vector<acc_cond::rs_pair> pairs;
|
||||
if (!aut->acc().is_rabin_like(pairs))
|
||||
|
|
@ -366,11 +367,18 @@ namespace
|
|||
return gen.run();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
iar_old(const const_twa_graph_ptr& aut, bool pretty_print)
|
||||
iar_maybe(const const_twa_graph_ptr& aut, bool pretty_print)
|
||||
{
|
||||
if (auto res = iar_maybe_old(aut, pretty_print))
|
||||
return iar_maybe_(aut, pretty_print);
|
||||
}
|
||||
|
||||
twa_graph_ptr
|
||||
iar(const const_twa_graph_ptr& aut, bool pretty_print)
|
||||
{
|
||||
if (auto res = iar_maybe_(aut, pretty_print))
|
||||
return res;
|
||||
throw std::runtime_error("iar() expects Rabin-like or Streett-like input");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ namespace spot
|
|||
/// It is better to use to_parity() instead, as it will use better
|
||||
/// strategies when possible, and has additional optimizations.
|
||||
SPOT_API twa_graph_ptr
|
||||
to_parity_old(const const_twa_graph_ptr& aut, bool pretty_print=false);
|
||||
to_parity_old(const const_twa_graph_ptr& aut, bool pretty_print = false);
|
||||
|
||||
/// \ingroup twa_acc_transform
|
||||
/// \brief Turn a Rabin-like or Streett-like automaton into a parity automaton
|
||||
|
|
@ -113,17 +113,18 @@ namespace spot
|
|||
///
|
||||
/// It is better to use to_parity() instead, as it will use better
|
||||
/// strategies when possible, and has additional optimizations.
|
||||
SPOT_DEPRECATED("use to_parity() instead") // deprecated since Spot 2.9
|
||||
SPOT_API twa_graph_ptr
|
||||
iar_old(const const_twa_graph_ptr& aut, bool pretty_print = false);
|
||||
iar(const const_twa_graph_ptr& aut, bool pretty_print = false);
|
||||
|
||||
/// \ingroup twa_acc_transform
|
||||
/// \brief Turn a Rabin-like or Streett-like automaton into a parity automaton
|
||||
/// based on the index appearence record (IAR)
|
||||
///
|
||||
/// Returns nullptr if the input automaton is neither Rabin-like nor
|
||||
/// Streett-like, and calls spot::iar_old() otherwise.
|
||||
SPOT_API
|
||||
twa_graph_ptr
|
||||
iar_maybe_old(const const_twa_graph_ptr& aut, bool pretty_print = false);
|
||||
/// Streett-like, and calls spot::iar() otherwise.
|
||||
SPOT_DEPRECATED("use to_parity() and spot::acc_cond::is_rabin_like() instead")
|
||||
SPOT_API twa_graph_ptr // deprecated since Spot 2.9
|
||||
iar_maybe(const const_twa_graph_ptr& aut, bool pretty_print = false);
|
||||
|
||||
} // namespace spot
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ def report_missing_exception():
|
|||
aut = spot.translate('GFa & GFb & GFc')
|
||||
aut.set_acceptance(spot.acc_cond("parity min even 4"))
|
||||
try:
|
||||
spot.iar_old(aut)
|
||||
spot.iar(aut)
|
||||
except RuntimeError as e:
|
||||
assert 'iar() expects Rabin-like or Streett-like input' in str(e)
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue