4 #include "../Settings.h"
13 template<CoreHeuristic CH>
18 template<
typename CAD>
21 cad.
mLifting.restoreRemovedSamples();
32 auto it = cad.
mLifting.getNextSample();
34 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Sample " << s <<
" at depth " << it.depth());
36 assert(0 <= it.depth() && it.depth() < cad.
dim());
38 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Sample " << s <<
" already has a conflict.");
44 const auto& poly = cad.
mProjection.getPolynomialById(cad.
idLP(it.depth() + 1), *polyID);
50 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Got nothing to lift anymore, projecting into level " << idLP(it.depth() + 1) <<
" ...");
51 carl::Bitset gotNewPolys = cad.
mProjection.projectNewPolynomial();
52 if (gotNewPolys.any()) {
54 cad.
mLifting.restoreRemovedSamples();
65 template<
typename CAD>
68 cad.
mLifting.restoreRemovedSamples();
78 auto it = cad.
mLifting.getNextSample();
80 assert(0 <= it.depth() && it.depth() < cad.
dim());
88 const auto& poly = cad.
mProjection.getPolynomialById(cad.
idLP(it.depth() + 1), *polyID);
92 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Got no polynomial for " << s <<
", projecting into level " << cad.
idLP(it.depth() + 1) <<
" ...");
94 auto gotNewPolys = cad.
mProjection.projectNewPolynomial();
95 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Tried to project polynomials into level " << cad.
idLP(it.depth() + 1) <<
", result = " << gotNewPolys);
96 if (gotNewPolys.any()) {
97 cad.
mLifting.restoreRemovedSamples();
99 if (!cad.
mLifting.addTrivialSample(it)) {
112 template<
typename CAD>
116 cad.
mLifting.restoreRemovedSamples();
122 if (!cad.
mLifting.hasNextSample())
break;
124 auto it = cad.
mLifting.getNextSample();
127 assert(0 <= it.depth() && it.depth() < cad.
dim());
135 const auto& poly = cad.
mProjection.getPolynomialById(cad.
idLP(it.depth() + 1), *polyID);
144 if (CAD::SettingsT::debugStepsToTikz) {
150 if (CAD::SettingsT::debugProjection) {
151 static std::size_t counter = 0;
153 std::ofstream out(
"projection_" + std::to_string(counter) +
".dot");
154 out <<
"digraph G {" << std::endl;
156 out <<
"}" << std::endl;
161 SMTRAT_LOG_INFO(
"smtrat.cad",
"Projection has finished, returning UNSAT");
171 template<
typename It>
173 return it->value().is_numeric();
175 template<
typename CAD>
185 template<
typename CAD>
187 if (!cad.
mLifting.hasNextSample())
return false;
188 auto it = cad.
mLifting.getNextSample();
191 assert(0 <= it.depth() && it.depth() < cad.
dim());
199 const auto& poly = cad.
mProjection.getPolynomialById(cad.
idLP(it.depth() + 1), *polyID);
210 template<
typename CAD>
212 cad.
mLifting.restoreRemovedSamples();
217 if (!cad.
mLifting.hasNextSample()) {
219 cad.
mLifting.restoreRemovedSamples();
221 if (preferLifting(cad.
mLifting.getNextSample())) {
222 doLifting(cad, ignore_nullifications);
225 cad.
mLifting.restoreRemovedSamples();
233 template<
typename CAD>
236 cad.
mLifting.restoreRemovedSamples();
238 carl::Bitset gotNewPolys = cad.
mProjection.projectNewPolynomial();
239 if (gotNewPolys.none())
break;
241 while (cad.
mLifting.hasNextSample()) {
242 auto it = cad.
mLifting.getNextSample();
244 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Sample " << s <<
" at depth " << it.depth());
246 assert(0 <= it.depth() && it.depth() < cad.
dim());
248 SMTRAT_LOG_DEBUG(
"smtrat.cad",
"Sample " << s <<
" already has a conflict.");
254 const auto& poly = cad.
mProjection.getPolynomialById(cad.
idLP(it.depth() + 1), *polyID);
262 std::size_t number_of_cells = 0;
263 const auto& tree = cad.
mLifting.getTree();
264 for (
auto it = tree.begin_leaf(); it != tree.end_leaf(); ++it) {
271 for (
const auto& a: assignments) {
277 assignment = assignments.front();
LiftingTree< Settings > mLifting
Answer checkFullSamples(Assignment &assignment)
std::vector< Assignment > enumerateSolutions()
ProjectionT< Settings > mProjection
debug::TikzHistoryPrinter thp
Answer checkPartialSample(Iterator &it, std::size_t level)
std::size_t idLP(std::size_t level) const
const SampleLiftedWith & liftedWith() const
bool hasConflictWithConstraint() const
void addLifting(const L &l)
void addProjection(const P &p)
std::map< carl::Variable, RAN > Assignment
Class to create the formulas for axioms.
Answer
An enum with the possible answers a Module can give.
#define SMTRAT_LOG_TRACE(channel, msg)
#define SMTRAT_LOG_WARN(channel, msg)
#define SMTRAT_LOG_INFO(channel, msg)
#define SMTRAT_LOG_DEBUG(channel, msg)
Answer operator()(Assignment &assignment, CAD &cad, bool ignore_nullifications)
Answer operator()(Assignment &assignment, CAD &cad, bool ignore_nullifications)
bool doProjection(CAD &cad)
bool doLifting(CAD &cad, bool ignore_nullifications)
Answer operator()(Assignment &assignment, CAD &cad, bool ignore_nullifications)
bool preferLifting(const It &it)
Answer operator()(Assignment &assignment, CAD &cad, bool ignore_nullifications)
Answer operator()(Assignment &assignment, CAD &cad, bool ignore_nullifications)