Skip to content

Commit a26484b

Browse files
committed
Experimental : use reachability queries to refine our bounds ?
1 parent 9f35b1e commit a26484b

1 file changed

Lines changed: 23 additions & 15 deletions

File tree

pnmcc/fr.lip6.move.gal.application.pnmcc/src/fr/lip6/move/gal/application/solver/UpperBoundsSolver.java

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,17 @@
77
import java.util.HashMap;
88
import java.util.List;
99
import java.util.Map;
10-
import java.util.Map.Entry;
1110
import java.util.Optional;
12-
import java.util.Set;
1311

1412

1513
import android.util.SparseIntArray;
16-
import fr.lip6.move.gal.application.Application;
1714
import fr.lip6.move.gal.application.mcc.MccTranslator;
1815
import fr.lip6.move.gal.mcc.properties.ConcurrentHashDoneProperties;
1916
import fr.lip6.move.gal.mcc.properties.DoneProperties;
2017
import fr.lip6.move.gal.structural.CoverWalker;
21-
import fr.lip6.move.gal.structural.FlowPrinter;
2218
import fr.lip6.move.gal.structural.GlobalPropertySolvedException;
2319
import fr.lip6.move.gal.structural.ISparsePetriNet;
2420
import fr.lip6.move.gal.structural.InvariantCalculator;
25-
import fr.lip6.move.gal.structural.PetriNet;
2621
import fr.lip6.move.gal.structural.Property;
2722
import fr.lip6.move.gal.structural.PropertyType;
2823
import fr.lip6.move.gal.structural.RandomExplorer;
@@ -165,6 +160,10 @@ public static List<Integer> applyReductions(MccTranslator reader, DoneProperties
165160

166161
printBounds("Before main loop", maxSeen, maxStruct);
167162

163+
boolean again = true;
164+
165+
while (again) {
166+
again = false;
168167
boolean first = true;
169168
do {
170169
iter =0;
@@ -420,9 +419,10 @@ public static List<Integer> applyReductions(MccTranslator reader, DoneProperties
420419
if (testWithReachability(reader,maxSeen,maxStruct,doneProps)>0) {
421420
checkStatus(spn, tocheck, maxStruct, maxSeen, doneProps, "REACHABILITY");
422421
printBounds("after reachability check", maxSeen, maxStruct);
422+
again = true;
423423
}
424424
}
425-
425+
}
426426

427427

428428
return maxStruct;
@@ -463,25 +463,33 @@ private static int testWithReachability(MccTranslator ori, List<Integer> maxSeen
463463
e.printStackTrace();
464464
}
465465
int seen = 0;
466-
for (int id = spnori.getProperties().size() ; id >= 0 ; id--) {
466+
for (int id=0; id < spnori.getProperties().size() ; id++) {
467467
boolean done = false;
468-
Boolean b = localDone.getValue("MAX"+id);
468+
Boolean bmin = localDone.getValue("MIN"+id);
469+
Boolean bmax = localDone.getValue("MAX"+id);
469470
String pname = propId.get(id);
470-
if (b!=null && b) {
471+
if (bmax!=null && bmax) {
471472
// We *can* reach the structural max.
472473
doneProps.put(pname, maxStruct.get(id), "REACHABILITY_MAX");
473474
done = true;
474-
} else {
475-
b = localDone.getValue("MIN"+id);
476-
477-
if (b!=null && b) {
475+
} else if (bmin!=null && bmin) {
478476
// We *cannot exceed* the seen value.
479477
doneProps.put(pname, maxSeen.get(id), "REACHABILITY_MIN");
480478
done = true;
481-
}
482-
}
479+
}
483480
if (done) {
484481
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++;
485493
}
486494
}
487495
return seen;

0 commit comments

Comments
 (0)