4 #include "../utils/Origin.h"
17 using ECMap = std::map<Origin::BaseType, ECData>;
20 std::vector<ECMap::const_iterator>
mUsedEC;
30 assert(
mECs.find(origin) ==
mECs.end());
35 return mECs.find(origin) !=
mECs.end();
39 auto it =
mECs.find(origin);
40 if (it ==
mECs.end())
return;
41 if (it->second.level == 0 || it->second.level == level) {
42 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"Adding " << level <<
"/" << pid <<
" to EC " << origin);
43 it->second.polynomials.set(pid);
45 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection",
"EC " << origin <<
" is primitive due to " << level <<
"/" << pid);
67 std::vector<EquationalConstraint>
mData;
72 return mData.size() - 1;
76 mData[id].polynomials.set(pid);
80 return !
mData.empty();
85 const auto&
getEC(std::size_t ecid)
const {
165 std::vector<std::vector<std::optional<PolyInfo>>>
mPolyData;
168 bool hasInfo(std::size_t level, std::size_t pid)
const {
170 if (
mPolyData[level].size() <= pid)
return false;
171 return mPolyData[level][pid].has_value();
173 void emplace(std::size_t level, std::size_t pid) {
178 const auto&
operator()(std::size_t level, std::size_t pid)
const {
186 void clear(std::size_t level, std::size_t pid) {
217 const auto&
operator()(std::size_t level, std::size_t pid)
const {
218 return mPoly(level, pid);
221 return mPoly(level, pid);
223 void clear(std::size_t level, std::size_t pid) {
226 void emplace(std::size_t level, std::size_t pid) {
229 bool hasInfo(std::size_t level, std::size_t pid)
const {
233 bool isActive(std::size_t level, std::size_t
id)
const {
235 if ((*
this)().mInactive.test(
id)) {
236 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is inactive on level 0.");
239 if ((*
this)(level).isEvaluated(
id) && (*
this)(level).isPurged(
id)) {
240 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is inactive as being purged.");
243 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is active on level 0.");
246 if ((*
this)(level).isBound(
id)) {
247 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is active as a bound polynomial.");
250 if (!(*
this)(level,
id).origin.isActive()) {
251 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is inactive without active origins.");
254 if ((*
this)(level).isEvaluated(
id) && (*
this)(level).isPurged(
id)) {
255 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is inactive as being purged.");
258 SMTRAT_LOG_DEBUG(
"smtrat.cad.projection", level <<
"/" <<
id <<
" is active.");
270 std::size_t ecid = (*this)(0).ecs.addEC();
271 (*this)(0).ecs.addPolyToEC(ecid, pid);
278 bool hasEC(std::size_t level)
const {
279 return (*
this)(level).ecs.hasEC();
282 return (*
this)().mUsedEC[level] != (*
this)().mECs.end();
284 const carl::Bitset&
getUsedEC(std::size_t level)
const {
285 assert(
hasEC(level));
286 assert((*
this)().mUsedEC[level]->second.level == level);
287 return (*
this)().mUsedEC[level]->second.polynomials;
290 assert(
hasEC(level));
292 for (std::size_t ecid = 0; ecid < (*this)(level).ecs.count(); ++ecid) {
293 if (!(*
this)(level).ecs.getEC(ecid).suitable)
continue;
294 const auto& polys = (*this)(level).ecs.getEC(ecid).polynomials;
295 bool ec_active =
true;
296 for (
auto pid: polys) {
302 if (!ec_active)
continue;
304 const auto& ecs = (*this)().mECs;
305 for (
auto it = ecs.begin(); it != ecs.end(); ++it) {
307 (*this)().mUsedEC[level] = it;
315 (*this)().mUsedEC[level] = (*
this)().mECs.end();
320 for (
const auto& ec: gi.
mECs) {
321 os <<
"\t" << ec.first <<
" -> " << ec.second.level <<
"/" << ec.second.polynomials << std::endl;
330 os <<
"origin: " << pi.
origin;
This class represents one or more origins of some object.
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
#define SMTRAT_LOG_DEBUG(channel, msg)