forked from martinjonas/Q3B
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolver.h
57 lines (45 loc) · 1.48 KB
/
Solver.h
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
56
57
#ifndef BDDSOLVER_H
#define BDDSOLVER_H
#include <z3++.h>
#include <bdd.h>
#include "ExprToBDDTransformer.h"
enum Result { SAT, UNSAT, UNKNOWN };
enum Approximation { UNDERAPPROXIMATION, OVERAPPROXIMATION, NO_APPROXIMATION };
class Solver
{
public:
Solver() : m_approximationType(NO_APPROXIMATION), m_effectiveBitWidth(0) { }
Solver(bool propagateUncoinstrained) :
m_approximationType(NO_APPROXIMATION), m_effectiveBitWidth(0), m_propagateUncoinstrained(propagateUncoinstrained), m_negateMul(false), m_initialOrder(HEURISTIC) { }
Result GetResult(z3::expr);
void SetApproximation(Approximation approximation, int bitWidth)
{
m_approximationType = approximation;
m_effectiveBitWidth = bitWidth;
}
void SetReorderType(ReorderType reorderType)
{
m_reorderType = reorderType;
}
void SetInitialOrder(InitialOrder initialOrder)
{
m_initialOrder = initialOrder;
}
void SetNegateMul(bool negateMul)
{
m_negateMul = negateMul;
}
private:
Approximation m_approximationType;
int m_effectiveBitWidth;
bool m_propagateUncoinstrained;
bool m_negateMul;
ReorderType m_reorderType;
InitialOrder m_initialOrder;
void set_bdd();
Result runUnderApproximation(ExprToBDDTransformer&, int);
Result runOverApproximation(ExprToBDDTransformer&, int);
Result runWithOverApproximations(ExprToBDDTransformer&);
Result runWithUnderApproximations(ExprToBDDTransformer&);
};
#endif // BDDSOLVER_H