-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSolver.cpp
80 lines (56 loc) · 1.47 KB
/
Solver.cpp
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include "Solver.h"
#include <iostream>
#include "PreTableau.h"
#include "LTLFormula.h"
Solver::Solver(Model* model, std::unique_ptr<LTLFormula>&& formula) :
model(model),
formula(std::move(formula))
{
}
Solver::~Solver()
{
}
bool Solver::solveEE(bool verbose)
{
if (verbose)
{
std::cout << this->model->operator std::string();
std::cout.flush();
}
Tableau tableau;
this->computeTableau(&tableau, this->formula, verbose);
return tableau.isOpen();
}
bool Solver::solveAA(bool verbose)
{
if (verbose)
{
std::cout << this->model->operator std::string();
std::cout.flush();
}
Tableau tableau;
this->computeTableau(&tableau, this->formula->neg(), verbose);
return !tableau.isOpen();
}
void Solver::solveEES()
{
}
void Solver::computeTableau(Tableau * tableau, const std::unique_ptr<LTLFormula>& formula, bool verbose) const
{
PreTableau preTab(this->model, formula.get());
preTab.preTableauComputation();
if (verbose)
{
std::cout << "PreTableau Computation finished" << std::endl;
std::cout << "State count : " << preTab.states.size() << ", Prestate count : " << preTab.preStates.size() << std::endl;
}
*tableau = std::move(preTab.convertToTableau());
if (verbose)
std::cout << "\nState count before Tableau state elimination : " << tableau->getStateCount() << std::endl;
tableau->tableauComputation();
if (verbose)
{
std::cout << "Tableau Computation finished\nFinal Tableau : \n" << tableau->operator std::string();
std::cout.flush();
}
}