Skip to content
Snippets Groups Projects
Commit 39ec19e7 authored by Jan Trávníček's avatar Jan Trávníček
Browse files

fix Minimize

parent eb562760
No related branches found
No related tags found
Loading
......@@ -24,10 +24,11 @@ automaton::State fromInteger(int number) {
automaton::FSM Minimize::minimize(automaton::FSM& fsm) {
std::map<automaton::State, std::map<alphabet::Symbol, automaton::State > > refactor;
 
for(std::set<automaton::State>::const_iterator iter = fsm.getStates().begin(); iter != fsm.getStates().end(); iter++) {
refactor.insert(std::pair<automaton::State, std::map<alphabet::Symbol, automaton::State> >(*iter, std::map<alphabet::Symbol, automaton::State>()));
}
for(std::set<automaton::TransitionFSM>::const_iterator iter = fsm.getTransitions().begin(); iter != fsm.getTransitions().end(); iter++) {
if(refactor.find(iter->getFrom()) == refactor.end()) {
refactor.insert(std::pair<automaton::State, std::map<alphabet::Symbol, automaton::State> >(iter->getFrom(), std::map<alphabet::Symbol, automaton::State>()));
}
refactor[iter->getFrom()].insert(std::pair<alphabet::Symbol, automaton::State>(iter->getInput(), iter->getTo()));
}
 
......@@ -94,7 +95,7 @@ automaton::FSM Minimize::minimize(automaton::FSM& fsm) {
}
 
} while(toEquvivalentStates1 != toEquvivalentStates2);
} while(minimizedTransitionFunction1.size() != minimizedTransitionFunction2.size());
 
automaton::FSM result;
for(auto iter = fsm.getInputAlphabet().begin(); iter != fsm.getInputAlphabet().end(); iter++) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment