@@ -979,10 +979,10 @@ public Automaton determinize() {
979
979
HashSet <Transition > dGamma = new HashSet <Transition >();
980
980
HashSet <State > newStates = new HashSet <State >();
981
981
982
- dStates .put (epsilonClosure (initialState ), false );
982
+ dStates .put (epsilonClosure (this . getInitialState () ), false );
983
983
HashSet <State > T ;
984
984
985
- State newInitialState = new State (createName (epsilonClosure (initialState )) , true , isPartitionFinalState (epsilonClosure (initialState )));
985
+ State newInitialState = new State (createName (epsilonClosure (this . getInitialState ())) , true , isPartitionFinalState (epsilonClosure (this . getInitialState () )));
986
986
987
987
newStates .add (newInitialState );
988
988
@@ -1202,7 +1202,7 @@ public Automaton removeUnreachableStates() {
1202
1202
*/
1203
1203
public void minimize () {
1204
1204
1205
- this .reverse ();
1205
+ /* this.reverse();
1206
1206
Automaton a = this.determinize();
1207
1207
a = a.removeUnreachableStates();
1208
1208
a.reverse();
@@ -1212,6 +1212,13 @@ public void minimize() {
1212
1212
this.initialState = a.initialState;
1213
1213
this.delta = a.delta;
1214
1214
this.states = a.states;
1215
+ this.adjacencyList = this.computeAdjacencyList();*/
1216
+ this .hopcroftMinimize ();
1217
+
1218
+ Automaton a = this .deMerge (++initChar );
1219
+ this .initialState = a .initialState ;
1220
+ this .states = a .states ;
1221
+ this .delta = a .delta ;
1215
1222
this .adjacencyList = this .computeAdjacencyList ();
1216
1223
}
1217
1224
@@ -1333,7 +1340,13 @@ private HashSet<State> setSubtraction(HashSet<State> first, HashSet<State> secon
1333
1340
}
1334
1341
1335
1342
public void hopcroftMinimize (){
1336
- this .determinize ();
1343
+ if (!isDeterministic (this )) {
1344
+ Automaton a = this .determinize ();
1345
+ this .initialState = a .initialState ;
1346
+ this .delta = a .delta ;
1347
+ this .states = a .states ;
1348
+ }
1349
+
1337
1350
this .hopcroftremoveUnreachableStates ();
1338
1351
1339
1352
// the partition P
0 commit comments