17 template<
typename Settings>
21 using Super::callRemoveCallback;
22 using Super::canBePurgedByBounds;
25 using Super::isPurged;
26 using Super::mConstraints;
28 using Super::mLiftingQueues;
29 using Super::mOperator;
47 : level(l), first(f), second(s) {}
48 friend std::ostream&
operator<<(std::ostream& os,
const QueueEntry&
qe) {
49 return os <<
"(" <<
qe.first <<
"," <<
qe.second <<
")@" <<
qe.level;
52 struct ProjectionCandidateComparator {
60 bool operator()(
const QueueEntry& lhs,
const QueueEntry& rhs)
const {
62 UPoly lp = mPG(lhs.level, lhs.first);
63 UPoly lq = mPG(lhs.level, lhs.second);
64 UPoly rp = mPG(rhs.level, rhs.first);
65 UPoly rq = mPG(rhs.level, rhs.second);
90 return std::string(
dim() - level,
'\t');
97 return !(active(
qe.level,
qe.first) && active(
qe.level,
qe.second));
104 for (std::size_t lvl = 1; lvl <= level; lvl++) {
105 for (
const auto& it : mPolynomialIDs[lvl]) {
106 active(lvl, it.second);
116 bool active(std::size_t level, std::size_t
id)
const {
120 bool isQueueEntryActive(std::size_t level, std::size_t first, std::size_t second,
bool usingEC)
const {
122 if (!active(level, second))
return false;
125 if (ec.test(first)) {
128 }
else if (ec.test(second)) {
133 if (Settings::semiRestrictedProjection && first == second) {
134 if (!Settings::restrictedIfPossible || (level > 1 && level <
dim() - 1)) {
135 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Single projection in semi-restricted projection");
142 return active(level, second);
152 assert(level <
dim());
155 for (
const auto& it : mPolynomialIDs[level]) {
156 assert(mPolynomials[level][it.second]);
157 if (isQueueEntryActive(level,
id, it.second, usingEC)) {
158 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Adding to PQ (" << it.second <<
"," <<
id <<
")@" << level);
159 mProjectionQueue.emplace(level, it.second,
id);
161 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Adding to IQ (" << it.second <<
"," <<
id <<
")@" << level);
162 mInactiveQueue.emplace(level, it.second,
id);
173 assert(mPolynomials[0][cid]);
174 assert(*mPolynomials[0][cid] == p);
176 mProjectionQueue.
removeIf([cid](
const QueueEntry&
qe) {
return (
qe.level == 0) && (
qe.first == cid ||
qe.second == cid); });
177 mInactiveQueue.
removeIf([cid](
const QueueEntry&
qe) {
return (
qe.level == 0) && (
qe.first == cid ||
qe.second == cid); });
178 carl::Bitset filter = carl::Bitset().set(cid);
179 for (std::size_t level = 1; level <=
dim(); level++) {
180 for (std::size_t lvl = level; lvl <=
dim(); lvl++) {
181 for (
auto it = mPolynomialIDs[level].begin(); it != mPolynomialIDs[level].end(); it++) {
182 mInfo(level, it->second).origin.erase(level, filter);
185 carl::Bitset removed;
186 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Purging from level " << level <<
" with filter " << filter);
187 for (
auto it = mPolynomialIDs[level].begin(); it != mPolynomialIDs[level].end();) {
188 std::size_t
id = it->second;
189 assert(mPolynomials[level][
id]);
190 if (
mInfo(level, it->second).origin.empty()) {
191 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Purging " <<
id <<
" from level " << level);
193 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"Removing " <<
id <<
" on " << level);
195 mProjectionQueue.
removeIf([level,
id](
const QueueEntry&
qe) {
return (
qe.level == level) && (
qe.first ==
id ||
qe.second ==
id); });
196 mInactiveQueue.
removeIf([level,
id](
const QueueEntry&
qe) {
return (
qe.level == level) && (
qe.first ==
id ||
qe.second ==
id); });
198 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Removing polynomial");
202 it = mPolynomialIDs[level].erase(it);
207 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"Calling callback for level " << level <<
", removed [" << removed <<
"]");
217 for (std::size_t lvl = level; lvl <
dim(); lvl++) {
220 for (std::size_t
id = 0;
id < mPolynomials[lvl].size(); ++id) {
221 if (!mPolynomials[lvl][
id])
continue;
222 if (!active(lvl,
id)) {
223 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Purging " <<
id <<
" from level " << lvl);
227 SMTRAT_LOG_TRACE(
"smtrat.cad.projection",
"Calling callback for level " << level <<
", removed [" <<
remove <<
"]");
232 for (std::size_t l = lvl + 1; l <=
dim(); l++) {
233 for (
const auto& it : mPolynomialIDs[l]) {
234 assert(mPolynomials[l][it.second]);
235 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Purging " << l <<
"/" << it.second <<
" with " << lvl <<
" / " <<
remove);
236 mInfo(l, it.second).origin.deactivate(lvl,
remove);
238 if (!active(l, it.second)) {
250 carl::Bitset changed_levels;
251 for (std::size_t lvl = level; lvl <
dim(); lvl++) {
253 carl::Bitset activate;
254 for (std::size_t
id = 0;
id < mPolynomials[lvl].size(); ++id) {
255 if (!mPolynomials[lvl][
id])
continue;
256 if (active(lvl,
id)) {
257 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> " <<
id <<
" from level " << lvl <<
" is active");
259 changed_levels.set(lvl);
261 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> " <<
id <<
" from level " << lvl <<
" remains inactive");
265 for (std::size_t l = lvl + 1; l <=
dim(); l++) {
266 for (
const auto& it : mPolynomialIDs[l]) {
267 assert(mPolynomials[l][it.second]);
268 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Activating origins for " << it.second <<
" from level " << lvl <<
" with " << activate);
269 mInfo(l, it.second).origin.activate(lvl, activate);
271 if (active(l, it.second)) {
277 updateInactiveQueue =
true;
278 return changed_levels;
286 std::size_t lvl = level;
287 bool restricted =
false;
293 for (std::size_t l = lvl + 1; l <=
dim(); l++) {
294 for (
const auto& it : mPolynomialIDs[l]) {
295 assert(mPolynomials[l][it.second]);
296 mInfo(l, it.second).origin.deactivateEC(lvl, eqc);
297 if (!active(l, it.second)) {
305 deactivatePolynomials(level + 1);
314 std::size_t level = 1;
318 if (mPolynomialIDs[level].
find(carl::switch_main_variable(p,
var(level))) == mPolynomialIDs[level].end()) {
321 std::size_t
id = mPolynomialIDs[level].find(carl::switch_main_variable(p,
var(level)))->second;
322 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Checking if " << p <<
" is part of an EC in " << level);
328 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Level " << level <<
" is using an EC");
329 std::size_t lvl = level;
331 while (lvl == level || (
mInfo.
usingEC(lvl) && !Settings::interruptions)) {
333 for (std::size_t l = lvl + 1; l <=
dim(); l++) {
334 for (
const auto& it : mPolynomialIDs[l]) {
335 assert(mPolynomials[l][it.second]);
336 mInfo(l, it.second).origin.activateEC(lvl, eqc);
337 if (active(l, it.second)) {
345 activatePolynomials(level + 1);
348 eqc = carl::Bitset().set(
id);
349 for (std::size_t l = level + 1; l <=
dim(); l++) {
350 for (
const auto& it : mPolynomialIDs[l]) {
351 assert(mPolynomials[l][it.second]);
352 mInfo(l, it.second).origin.activateEC(level, eqc);
353 if (active(l, it.second)) {
359 activatePolynomials(level + 1);
360 restrictProjection(level);
366 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"Receiving " << p <<
" for level " << level);
368 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> but is safely removed.");
369 return carl::Bitset();
372 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> but is forwarded to " << (level + 1));
373 return insertPolynomialTo(level + 1, carl::switch_main_variable(p,
var(level + 1)), origin, setBound);
375 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"Inserting " << p <<
" into level " << level);
376 assert(level <=
dim());
377 auto it = mPolynomialIDs[level].find(p);
378 if (it != mPolynomialIDs[level].end()) {
379 assert(mPolynomials[level][it->second]);
380 bool activated = active(level, it->second);
381 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Polynomial was already present. Already active? " << activated);
382 if (Settings::simplifyProjectionByBounds && setBound) {
383 assert(level > 0 && level <=
dim());
384 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Setting " << level <<
"/" << it->second <<
" is a bound.");
385 mInfo(level).setBound(it->second,
true);
387 if (Settings::restrictProjectionByEC) {
388 SMTRAT_LOG_INFO(
"smtrat.cad.projection",
"Checking whether " << p <<
" is from an equational constraint.");
391 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Polynomial was already present, adding origins " << origin);
392 mInfo(level, it->second).origin += origin;
394 if (activated ==
false && active(level, it->second)) {
395 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Polynomial was inactive and is now active");
396 activatePolynomials(level);
398 updateInactiveQueue =
true;
399 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Restored polynomial");
401 return carl::Bitset({level});
403 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> nothing changed.");
404 return carl::Bitset();
406 std::size_t
id =
getID(level);
407 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Got new id " <<
id);
408 if (
id >= mPolynomials[level].
size()) mPolynomials[level].resize(
id + 1);
409 assert(!mPolynomials[level][
id]);
412 mPolynomials[level][id] = p;
414 mPolynomialIDs[level].emplace(p,
id);
415 if (Settings::simplifyProjectionByBounds && setBound) {
416 assert(level > 0 && level <=
dim());
417 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Setting " << level <<
"/" <<
id <<
" is a bound.");
418 mInfo(level).setBound(
id,
true);
421 if (Settings::restrictProjectionByEC) {
423 SMTRAT_LOG_INFO(
"smtrat.cad.projection",
"Checking whether " << p <<
" is from an equational constraint.");
424 mInfo().addToEC(origin, level,
id);
427 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(level) <<
"-> Inserting " <<
id <<
" into queue for level " << (level + 1));
428 insertIntoProjectionQueue(level,
id);
431 if (Settings::restrictProjectionByEC) {
432 SMTRAT_LOG_INFO(
"smtrat.cad.projection",
"Possibly enabling EC " << p);
433 restrictProjection(level);
436 return carl::Bitset({level});
440 while (!mProjectionQueue.empty()) {
441 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Using next projection candidate " << mProjectionQueue.top());
442 QueueEntry
qe = mProjectionQueue.top();
443 mProjectionQueue.pop();
444 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> Checking if the candidate is active.");
445 bool moveToInactive =
false;
446 if (Settings::simplifyProjectionByBounds &&
isPurged(
qe)) {
447 moveToInactive =
true;
449 }
else if (!active(
qe.level,
qe.first) || !active(
qe.level,
qe.second)) {
450 moveToInactive =
true;
452 }
else if (Settings::restrictProjectionByEC &&
qe.level != 0 &&
mInfo.
usingEC(
qe.level)) {
454 if (Settings::semiRestrictedProjection) {
455 if (
qe.first !=
qe.second) {
456 moveToInactive =
true;
457 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> disabled due to semi restricted projection");
458 }
else if (
qe.level <= 1 ||
qe.level >=
dim()-1) {
459 moveToInactive =
true;
460 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> disabled due to restricted projection in first or last level");
462 }
else if (!Settings::semiRestrictedProjection) {
463 moveToInactive =
true;
464 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> disabled due to restricted projection");
468 if (moveToInactive) {
470 mInactiveQueue.push(
qe);
472 carl::Bitset res = projectCandidate(
qe);
474 if (res.any())
return res;
478 return carl::Bitset();
482 assert(
qe.level <
dim());
485 assert(
qe.first ==
qe.second);
486 assert(mPolynomials[
qe.level][
qe.first]);
487 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Moving into level 1: " << *mPolynomials[
qe.level][
qe.first]);
489 bool isBound =
mInfo(0).isBound(
qe.first);
491 [&](
const UPoly& np) { res |= insertPolynomialTo(1, np, origin, isBound); }
494 if (Settings::restrictProjectionByEC &&
mInfo().isEC(origin)) {
495 if (res.count() == 1) {
499 mInfo().removeEC(origin);
503 else if (
qe.first ==
qe.second) {
504 assert(
qe.first < mPolynomials[
qe.level].size());
505 assert(mPolynomials[
qe.level][
qe.first]);
506 const auto& p = *mPolynomials[
qe.level][
qe.first];
507 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Projecting single " << p <<
" into " <<
qe.level);
509 [&](
const UPoly& np) { res |= insertPolynomialTo(qe.level + 1, np, Origin::BaseType(qe.level, qe.first)); }
513 assert(
qe.first < mPolynomials[
qe.level].size());
514 assert(
qe.second < mPolynomials[
qe.level].size());
515 assert(mPolynomials[
qe.level][
qe.first] && mPolynomials[
qe.level][
qe.second]);
516 const auto& p = *mPolynomials[
qe.level][
qe.first];
517 const auto& q = *mPolynomials[
qe.level][
qe.second];
518 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Projecting paired " << p <<
", " << q <<
" into " <<
qe.level);
520 [&](
const UPoly& np) { res |= insertPolynomialTo(qe.level + 1, np, Origin::BaseType(qe.level, qe.first, qe.second), false); }
530 mCanBePurged([this](std::size_t level, std::size_t id) {
533 mProjectionQueue(ProjectionCandidateComparator([&](std::size_t level, std::size_t
id) {
return getPolynomialById(level,
id); })),
534 mInactiveQueue(ProjectionCandidateComparator([&](std::size_t level, std::size_t
id) {
return getPolynomialById(level,
id); }))
539 mPolynomialIDs.clear();
540 mPolynomialIDs.resize(
dim() + 1);
542 mPolynomials.clear();
543 mPolynomials.resize(
dim() + 1);
544 mProjectionQueue.
clear();
545 mInactiveQueue.
clear();
547 updateInactiveQueue =
false;
551 if (cid >= mPolynomials[0].
size()) {
552 mPolynomials[0].resize(cid + 1);
553 }
else if (mPolynomials[0][cid]) {
556 activatePolynomials(0);
557 if (Settings::simplifyProjectionByBounds && isBound) {
558 mInfo(0).setBound(cid,
true);
559 mInfo(0).restrictEvaluatedToPurged();
560 std::size_t level = 1;
561 while (level <=
dim()) {
562 mInfo(level).restrictEvaluatedToPurged();
566 checkPurged = std::max(level, checkPurged);
568 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(0) <<
"-> Polynomial was already present, reactivated");
569 return carl::Bitset();
571 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Adding " << p <<
" with id " << cid);
572 assert(!mPolynomials[0][cid]);
574 mPolynomials[0][cid] = p;
575 mPolynomialIDs[0].emplace(p, cid);
576 printPolynomialIDs();
577 if (Settings::simplifyProjectionByBounds && isBound) {
578 mInfo(0).setBound(cid,
true);
580 std::size_t level = 1;
581 while (level <=
dim()) {
582 mInfo(level).restrictEvaluatedToPurged();
586 checkPurged = std::max(level, checkPurged);
587 mProjectionQueue.emplace(0, cid, cid);
589 mProjectionQueue.emplace(0, cid, cid);
591 return carl::Bitset();
594 if (cid >= mPolynomials[0].
size()) {
595 mPolynomials[0].resize(cid + 1);
596 }
else if (mPolynomials[0][cid]) {
598 if (Settings::simplifyProjectionByBounds && isBound) {
599 mInfo(0).setBound(cid,
true);
600 std::size_t level = 1;
601 while (level <=
dim()) {
602 mInfo(level).restrictEvaluatedToPurged();
606 checkPurged = std::max(level, checkPurged);
609 activatePolynomials(0);
610 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", logPrefix(0) <<
"-> Polynomial was already present, reactivated");
611 return carl::Bitset();
613 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Adding " << p <<
" with id " << cid);
614 assert(!mPolynomials[0][cid]);
616 mPolynomials[0][cid] = p;
617 mPolynomialIDs[0].emplace(p, cid);
620 if (Settings::simplifyProjectionByBounds && isBound) {
621 mInfo(0).setBound(cid,
true);
622 std::size_t level = 1;
623 while (level <=
dim()) {
624 mInfo(level).restrictEvaluatedToPurged();
628 checkPurged = std::max(level, checkPurged);
629 mProjectionQueue.emplace(0, cid, cid);
631 mProjectionQueue.emplace(0, cid, cid);
633 return carl::Bitset();
637 printPolynomialIDs();
638 assert(mPolynomials[0][cid]);
639 assert(*mPolynomials[0][cid] == p);
640 mInfo().mInactive.set(cid);
642 if (Settings::restrictProjectionByEC) {
645 if (Settings::deletePolynomials) {
646 deletePolynomials(p, cid);
648 printPolynomialIDs();
650 deactivatePolynomials(0);
652 if (Settings::simplifyProjectionByBounds && isBound) {
653 updateInactiveQueue =
true;
654 std::size_t level = 1;
655 while (level <=
dim()) {
656 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Resetting evaluated on level " << level <<
": " <<
mInfo(level).evaluated <<
" -= " <<
mInfo(level).purged);
657 mInfo(level).removePurgedFromEvaluated();
661 checkPurged = std::max(level, checkPurged);
665 std::size_t
size(std::size_t level)
const override {
666 assert(level <=
dim());
667 std::size_t number = 0;
668 for (
const auto& it : mPolynomialIDs[level]) {
669 assert(mPolynomials[level][it.second]);
670 if (active(level, it.second)) {
676 bool empty(std::size_t level)
const override {
677 assert(level <=
dim());
678 return mPolynomialIDs[level].empty();
682 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Projecting new polynomial from constraints " << cs);
683 if (updateInactiveQueue) {
684 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Going through mInactiveQueue...");
686 for (
auto it = mInactiveQueue.
begin(); it != mInactiveQueue.
end();) {
687 if (active(it->level, it->first) && active(it->level, it->second)) {
690 mProjectionQueue.push((*it));
691 it = mInactiveQueue.
erase(it);
694 mProjectionQueue.push((*it));
695 it = mInactiveQueue.
erase(it);
703 mInactiveQueue.
fix();
704 updateInactiveQueue =
false;
706 if (checkPurged > 0) {
707 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"-> ComputePurgedPolynomials, until level " << checkPurged);
708 computePurgedPolynomials(checkPurged);
709 deactivatePolynomials(1);
710 carl::Bitset levels = activatePolynomials(1);
712 if (levels.any())
return levels;
718 assert(level <=
dim());
719 assert(
id < mPolynomials[level].
size());
720 return bool(mPolynomials[level][
id]);
723 assert(level <=
dim());
724 assert(
id < mPolynomials[level].
size());
725 assert(mPolynomials[level][
id]);
726 return *mPolynomials[level][id];
731 std::size_t originID = 0;
732 for (std::size_t level = 0; level <=
dim(); level++) {
734 for (std::size_t
id = 0;
id < mPolynomials[level].size();
id++) {
735 const auto& p = mPolynomials[level][id];
737 out <<
"\t\tp_" << level <<
"_" <<
id <<
" [label=\"" << *p <<
"\"];" << std::endl;
738 dsg.
add(
"p_" + std::to_string(level) +
"_" + std::to_string(
id));
739 for (
const auto& origin :
mInfo(level,
id).origin) {
740 std::string target = (origin.level == 0 ?
"orig_" :
"p_" + std::to_string(origin.level - 1) +
"_");
741 if (origin.first != origin.second) {
742 out <<
"\t\torigin_" << originID <<
" [label=\"\", shape=point];" << std::endl;
743 out <<
"\t\torigin_" << originID <<
" -> p_" << level <<
"_" <<
id <<
";" << std::endl;
744 out <<
"\t\t" << target << origin.first <<
" -> origin_" << originID <<
";" << std::endl;
745 out <<
"\t\t" << target << origin.second <<
" -> origin_" << originID <<
";" << std::endl;
747 out <<
"\t\t" << target << origin.first <<
" -> p_" << level <<
"_" <<
id <<
";" << std::endl;
752 out <<
"\t" << dsg << std::endl;
758 for (std::size_t lvl = 0; lvl <=
dim(); lvl++) {
759 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", lvl <<
": " << mPolynomialIDs[lvl]);
766 os <<
"Constraints:" << std::endl << p.
mConstraints << std::endl;
767 os <<
"Global:" << std::endl << p.
mInfo() << std::endl;
768 for (std::size_t level = 0; level <= p.
dim(); level++) {
770 os << level << std::endl;
772 os << level <<
" / " << p.
var(level) << std::endl;
773 os <<
"\tP: " << p.mPolynomials[level] << std::endl;
777 os <<
"\tInfo: " << p.
mInfo(level) << std::endl;
778 for (
const auto& poly: p.mPolynomialIDs[level]) {
779 os <<
"\t" << poly.first <<
" -> " << p.
mInfo(level, poly.second) << std::endl;
785 os <<
"Q: " << p.mProjectionQueue << std::endl;
786 os <<
"I: " << p.mInactiveQueue << std::endl;
auto erase(typename std::vector< T >::const_iterator it)
ProjectionOperator mOperator
The projection operator.
const Constraints & mConstraints
std::size_t dim() const
Returns the dimension of the projection.
void freeID(std::size_t level, std::size_t id)
Frees a currently used polynomial id for the given level.
ProjectionInformation mInfo
Additional info on projection, projection levels and projection polynomials.
std::size_t getID(std::size_t level)
Returns a fresh polynomial id for the given level.
virtual const UPoly & getPolynomialById(std::size_t level, std::size_t id) const =0
Retrieves a polynomial from its id.
std::vector< PolynomialLiftingQueue< BaseProjection > > mLiftingQueues
List of lifting queues that can be used for incremental projection.
carl::Variable var(std::size_t level) const
Returns the variable that corresponds to the given level, that is the variable eliminated in this lev...
bool canBePurgedByBounds(const UPoly &p) const
Checks whether a polynomial can safely be ignored due to the bounds.
void callRemoveCallback(std::size_t level, const SampleLiftedWith &slw) const
bool isPurged(std::size_t level, std::size_t id)
void exportAsDot(std::ostream &out) const
This class represents one or more origins of some object.
carl::Bitset addPolynomial(const UPoly &p, std::size_t cid, bool isBound) override
Adds the given polynomial to the projection.
bool empty(std::size_t level) const override
void insertIntoProjectionQueue(std::size_t level, std::size_t id)
Add projection candidates for a new polynomial.
std::vector< std::vector< full_ec::Polynomial > > mPolynomials
bool active(std::size_t level, std::size_t id) const
void extendProjection(const UPoly &p)
Activate polynomials in the projection (in lvl > level) that become again relevant if an equational c...
void exportAsDot(std::ostream &out) const override
std::string logPrefix(std::size_t level) const
carl::Bitset project(const ConstraintSelection &)
std::vector< std::map< UPoly, std::size_t > > mPolynomialIDs
carl::Bitset activatePolynomials(std::size_t level)
Activate active polynomials in mProjection.
Projection(const Constraints &c)
void deactivatePolynomials(std::size_t level)
Deactivate inactive polynomials in mProjection.
bool isPurged(const QueueEntry &qe)
std::size_t size(std::size_t level) const override
std::function< bool(std::size_t, std::size_t)> mCanBePurged
void computePurgedPolynomials(std::size_t level)
carl::Bitset insertPolynomialTo(std::size_t level, const UPoly &p, const Origin::BaseType &origin, bool setBound=false)
Inserts a polynomial with the given origin into the given level.
void printPolynomialIDs() const
PriorityQueue< QueueEntry, ProjectionCandidateComparator > mProjectionQueue
carl::Bitset addEqConstraint(const UPoly &p, std::size_t cid, bool isBound) override
Adds the given polynomial of an equational constraint to the projection.
const UPoly & getPolynomialById(std::size_t level, std::size_t id) const override
Retrieves a polynomial from its id.
void removePolynomial(const UPoly &p, std::size_t cid, bool isBound) override
Removes the given polynomial from the projection.
PriorityQueue< QueueEntry, ProjectionCandidateComparator > mInactiveQueue
void deletePolynomials(const UPoly &p, std::size_t cid)
Delete polynomial in mProjection and all other datastructures.
carl::Bitset projectNewPolynomial(const ConstraintSelection &cs=carl::Bitset(true))
carl::Bitset projectCandidate(const QueueEntry &qe)
bool hasPolynomialById(std::size_t level, std::size_t id) const override
bool isQueueEntryActive(std::size_t level, std::size_t first, std::size_t second, bool usingEC) const
void restrictProjection(std::size_t level)
Deactivate polynomials in the projection (in lvl > level) that become irrelevant due to a new equatio...
static bool find(V &ts, const T &t)
static void remove(V &ts, const T &t)
std::optional< UPoly > Polynomial
bool canBeRemoved(const UPoly &p)
Checks whether a polynomial can safely be ignored.
bool canBeForwarded(std::size_t, const UPoly &p)
Checks whether a polynomial can safely be forwarded to the next level.
void returnPoly(const Poly &p, Callback &&cb)
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
carl::UnivariatePolynomial< Poly > UPoly
projection_compare::Candidate< Poly > candidate(const Poly &p, const Poly &q, std::size_t level)
carl::Bitset ConstraintSelection
std::optional< FormulaT > qe(const FormulaT &input)
Class to create the formulas for axioms.
const settings::Settings & Settings()
#define SMTRAT_LOG_TRACE(channel, msg)
#define SMTRAT_LOG_INFO(channel, msg)
#define SMTRAT_LOG_DEBUG(channel, msg)
std::function< UPoly(std::size_t, std::size_t)> PolyGetter
ProjectionCandidateComparator()=delete
bool operator()(const QueueEntry &lhs, const QueueEntry &rhs) const
ProjectionCandidateComparator(const PolyGetter &pg)
ProjectionComparator< Settings::projectionComparator > mComparator
ProjectionCandidateComparator(const ProjectionCandidateComparator &pcc)
QueueEntry(std::size_t l, std::size_t f, std::size_t s)
friend std::ostream & operator<<(std::ostream &os, const QueueEntry &qe)
void add(const std::string &n)