Skip to content

Commit

Permalink
Add residual reduction algorithm
Browse files Browse the repository at this point in the history
Two implementations of residual reductions were added to the reduction
function. There is possible parametrization using the ParameterMap to
select the type of implementation and its direction. The types differ in
 whether the construction of residual automaton is done after the
final determinization or during the determinization. Both implementations
had similar results in effectivity and the result automata are mostly
the same, but the approaches may provide further inspiration and
different optimizations.

However, we were not able to find a way to utilize StateRenaming as it
is done for simulation, as for residual reduction the automaton is
reverted and determinized twice and there is no possible direct
connection between the state of the original and tthe result automaton.
For this reason, the parameter is not used.

Testing of this new functionality is also provided on various-sized
automaton, checking the result construction. In every case, the size of
both approaches should be the same(applies only for the same direction)
and on some automata the results are identical.
  • Loading branch information
notValord committed Apr 19, 2024
1 parent 2cddb2f commit f84683e
Show file tree
Hide file tree
Showing 3 changed files with 685 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/mata/nfa/nfa.hh
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <unordered_set>
#include <utility>
#include <vector>
#include <queue>

#include "mata/alphabet.hh"
#include "mata/parser/parser.hh"
Expand Down Expand Up @@ -535,11 +536,14 @@ Nfa determinize(const Nfa& aut, std::unordered_map<StateSet, State> *subset_map
* @param[in] aut Automaton to reduce.
* @param[out] state_renaming Mapping of original states to reduced states.
* @param[in] params Optional parameters to control the reduction algorithm:
* - "algorithm": "simulation".
* - "algorithm": "simulation", "residual",
* and options to parametrize residual reduction, not utilized in simulation
* - "type": "after", "with",
* - "direction": "forward", "backward".
* @return Reduced automaton.
*/
Nfa reduce(const Nfa &aut, StateRenaming *state_renaming = nullptr,
const ParameterMap& params = {{ "algorithm", "simulation" } });
const ParameterMap& params = {{ "algorithm", "simulation" }, { "type", "after" }, { "direction", "forward" } });

/**
* @brief Checks inclusion of languages of two NFAs: @p smaller and @p bigger (smaller <= bigger).
Expand Down
Loading

0 comments on commit f84683e

Please sign in to comment.