|
7 | 7 | import java.util.HashMap; |
8 | 8 | import java.util.List; |
9 | 9 | import java.util.Map; |
10 | | -import java.util.Map.Entry; |
11 | 10 | import java.util.Optional; |
12 | | -import java.util.Set; |
13 | 11 |
|
14 | 12 |
|
15 | 13 | import android.util.SparseIntArray; |
16 | | -import fr.lip6.move.gal.application.Application; |
17 | 14 | import fr.lip6.move.gal.application.mcc.MccTranslator; |
18 | 15 | import fr.lip6.move.gal.mcc.properties.ConcurrentHashDoneProperties; |
19 | 16 | import fr.lip6.move.gal.mcc.properties.DoneProperties; |
20 | 17 | import fr.lip6.move.gal.structural.CoverWalker; |
21 | | -import fr.lip6.move.gal.structural.FlowPrinter; |
22 | 18 | import fr.lip6.move.gal.structural.GlobalPropertySolvedException; |
23 | 19 | import fr.lip6.move.gal.structural.ISparsePetriNet; |
24 | 20 | import fr.lip6.move.gal.structural.InvariantCalculator; |
25 | | -import fr.lip6.move.gal.structural.PetriNet; |
26 | 21 | import fr.lip6.move.gal.structural.Property; |
27 | 22 | import fr.lip6.move.gal.structural.PropertyType; |
28 | 23 | import fr.lip6.move.gal.structural.RandomExplorer; |
@@ -165,6 +160,10 @@ public static List<Integer> applyReductions(MccTranslator reader, DoneProperties |
165 | 160 |
|
166 | 161 | printBounds("Before main loop", maxSeen, maxStruct); |
167 | 162 |
|
| 163 | + boolean again = true; |
| 164 | + |
| 165 | + while (again) { |
| 166 | + again = false; |
168 | 167 | boolean first = true; |
169 | 168 | do { |
170 | 169 | iter =0; |
@@ -420,9 +419,10 @@ public static List<Integer> applyReductions(MccTranslator reader, DoneProperties |
420 | 419 | if (testWithReachability(reader,maxSeen,maxStruct,doneProps)>0) { |
421 | 420 | checkStatus(spn, tocheck, maxStruct, maxSeen, doneProps, "REACHABILITY"); |
422 | 421 | printBounds("after reachability check", maxSeen, maxStruct); |
| 422 | + again = true; |
423 | 423 | } |
424 | 424 | } |
425 | | - |
| 425 | + } |
426 | 426 |
|
427 | 427 |
|
428 | 428 | return maxStruct; |
@@ -463,25 +463,33 @@ private static int testWithReachability(MccTranslator ori, List<Integer> maxSeen |
463 | 463 | e.printStackTrace(); |
464 | 464 | } |
465 | 465 | int seen = 0; |
466 | | - for (int id = spnori.getProperties().size() ; id >= 0 ; id--) { |
| 466 | + for (int id=0; id < spnori.getProperties().size() ; id++) { |
467 | 467 | boolean done = false; |
468 | | - Boolean b = localDone.getValue("MAX"+id); |
| 468 | + Boolean bmin = localDone.getValue("MIN"+id); |
| 469 | + Boolean bmax = localDone.getValue("MAX"+id); |
469 | 470 | String pname = propId.get(id); |
470 | | - if (b!=null && b) { |
| 471 | + if (bmax!=null && bmax) { |
471 | 472 | // We *can* reach the structural max. |
472 | 473 | doneProps.put(pname, maxStruct.get(id), "REACHABILITY_MAX"); |
473 | 474 | done = true; |
474 | | - } else { |
475 | | - b = localDone.getValue("MIN"+id); |
476 | | - |
477 | | - if (b!=null && b) { |
| 475 | + } else if (bmin!=null && bmin) { |
478 | 476 | // We *cannot exceed* the seen value. |
479 | 477 | doneProps.put(pname, maxSeen.get(id), "REACHABILITY_MIN"); |
480 | 478 | done = true; |
481 | | - } |
482 | | - } |
| 479 | + } |
483 | 480 | if (done) { |
484 | 481 | seen++; |
| 482 | + continue; |
| 483 | + } |
| 484 | + if (bmax!=null && !bmax) { |
| 485 | + // We cannot reach the structural max ! bound is tighter than that. |
| 486 | + maxStruct.set(id, maxStruct.get(id)-1); |
| 487 | + seen++; |
| 488 | + } |
| 489 | + if (bmin!=null && !bmin) { |
| 490 | + // We can exceed the seen value ! bound is looser than that. |
| 491 | + maxSeen.set(id, maxSeen.get(id)+1); |
| 492 | + seen++; |
485 | 493 | } |
486 | 494 | } |
487 | 495 | return seen; |
|
0 commit comments