Skip to content

Commit

Permalink
converter
Browse files Browse the repository at this point in the history
  • Loading branch information
ignacioDias committed Apr 3, 2024
1 parent 6beca7b commit dc517b8
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions TP/automata/ndfa/NotDeterministicFiniteAutomata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,20 @@ DeterministicFiniteAutomata NotDeterministicFiniteAutomata :: nfaToDfa() { //TOD

convertedAutomata.setE(getE());

calculateNewK(newK);
calculateNewK(newK, convertedAutomata);
convertedAutomata.setK(newK);
convertedAutomata.setF(calculateFinal(newK));
return convertedAutomata;
}
void NotDeterministicFiniteAutomata :: calculateNewK(set<set<int>> newK) {
void NotDeterministicFiniteAutomata :: calculateNewK(set<set<int>> newK, DeterministicFiniteAutomata dfa) {
set<set<int>> unvisitedNodes = newK;
for(const auto& currentNode : unvisitedNodes) {
for (auto currentNumber: getE()) {
set<int> currentSet = move(currentNode, currentNumber);
if (newK.count(currentSet) == 0) {
newK.insert(currentSet);
unvisitedNodes.insert((currentSet));
}
currentSet = getSymbolClosure(currentSet, LAMBDA);
newK.insert(currentSet);
unvisitedNodes.insert((currentSet));
dfa.addPath(currentNode, currentNumber,currentSet);
}
unvisitedNodes.erase(currentNode);
}
Expand Down
2 changes: 1 addition & 1 deletion TP/automata/ndfa/NotDeterministicFiniteAutomata.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ class NotDeterministicFiniteAutomata : public AutomataInterface {
set<int> getSymbolClosure(const set<int> Q, int symbol);
set<int> move(const set<int>& Q, int a);
set<set<int>> calculateFinal(set<set<int>> k);
void calculateNewK(set<set<int>> newK);
void calculateNewK(set<set<int>> newK, DeterministicFiniteAutomata dfa);
};
#endif //TPOB1_NOTDETERMINISTICFINITEAUTOMATA_H
4 changes: 2 additions & 2 deletions cmake-build-debug/Testing/Temporary/LastTest.log
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Start testing: Apr 01 18:58 -03
Start testing: Apr 03 11:27 -03
----------------------------------------------------------
End testing: Apr 01 18:58 -03
End testing: Apr 03 11:27 -03

0 comments on commit dc517b8

Please sign in to comment.