-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patherrorexploration.py
55 lines (51 loc) · 1.69 KB
/
errorexploration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import brotli
import glob
import os
import pickle
import time
from os.path import join
import argparse
import random
from cpmpy import *
from cpmpy.expressions.utils import is_any_list
from cpmpy.transformations.flatten_model import flatten_constraint, normalized_boolexpr, normalized_numexpr, \
negated_normal
from cpmpy.transformations.reification import only_bv_implies, reify_rewrite
from cpmpy.transformations.comparison import only_numexpr_equality
from metamorphic_tests import *
a = False
#a = True
b = False
#b = True
c = False
#c = True
#to read one of the original models: decompress as well
if c:
#f = 'internalcrashes\\internalfunctioncrashnormalizenumexpr'
f = 'models\\4_marco-mus-mcs-enumeration1665051222590934.bt'
with open(f, 'rb') as fpcl:
modle = pickle.loads(brotli.decompress(fpcl.read()))
cons = modle.constraints
print(modle.solve())
#read an internal crash
if a:
f = 'internalfunctioncrash5.pickle'
with open(f, 'rb') as fpcl:
funct,argum,lastmodel,e = pickle.loads(fpcl.read())
funct(argum)
#read lasterrormodel (unsat model)
elif b:
f = 'lasterrormodel1.pickle'
with open(f, 'rb') as fpcl:
modle, originalmodel, mutatorsused = pickle.loads(fpcl.read())
#redoing mutations on orignal model
with open(originalmodel, 'rb') as fpcl2:
cons = pickle.loads(brotli.decompress(fpcl2.read())).constraints
cons = lists_to_conjunction(cons)
for mut in mutatorsused:
cons = mut(cons)
#checking if subset of constraints is unsat
constraints = modle.constraints
n = len(constraints)
constr = constraints[:n-20]
print(Model(constr).solve())