forked from DrorFried/Synthesis-via-Decomposition
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMSSSpec.cc
46 lines (37 loc) · 1008 Bytes
/
MSSSpec.cc
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
#include "MSSSpec.hpp"
#include <utility>
#include <algorithm>
using std::move;
using std::function;
using std::max_element;
using std::max;
MSSSpec::MSSSpec(Vector<BVar> indicatorVars,
Set<BVar> outputVars,
CNFFormula outputCNF)
: _indicatorVars(move(indicatorVars)),
_outputVars(move(outputVars)),
_outputCNF(move(outputCNF))
{}
const CNFFormula& MSSSpec::outputCNF() const
{
return _outputCNF;
}
const Vector<BVar>& MSSSpec::indicatorVars() const
{
return _indicatorVars;
}
const Set<BVar>& MSSSpec::outputVars() const
{
return _outputVars;
}
BVar MSSSpec::maxVar() const
{
BVar maxIndicator = *max_element(_indicatorVars.begin(), _indicatorVars.end());
BVar maxOutput = *max_element(_outputVars.begin(), _outputVars.end());
return max(maxIndicator, maxOutput);
}
void MSSSpec::forEach(function<void(BVar, const CNFClause&)> visitor) const
{
for (size_t i = 0; i < _indicatorVars.size(); i++)
visitor(_indicatorVars[i], _outputCNF[i]);
}