15 namespace po = boost::program_options;
16 auto& settings = settings::Settings::getInstance();
19 parser.add(
"CAD Preprocessor settings").add_options()
20 (
"cad.pp.no-elimination", po::bool_switch(&s.disable_variable_elimination),
"disable variable elimination")
21 (
"cad.pp.no-resultants", po::bool_switch(&s.disable_resultants),
"disable resultant rule")
36 namespace preprocessor {
37 struct ConstraintUpdate {
38 std::vector<ConstraintT>
toAdd;
48 using Trail = std::vector<std::pair<ConstraintT,Origins>>;
51 const std::vector<carl::Variable>&
mVars;
99 template<
typename Map>
101 std::set<ConstraintT> newC =
mCurrent;
106 std::vector<ConstraintT> toAdd;
107 std::vector<ConstraintT> toRemove;
109 for (
const auto& c: newC) {
110 if (oldC.find(c) == oldC.end()) toAdd.emplace_back(c);
112 for (
const auto& c: oldC) {
113 if (newC.find(c.first) == newC.end()) toRemove.emplace_back(c.first);
119 return {toAdd, toRemove};
124 os <<
"Current Trail:" << std::endl;
125 for (
const auto& t: cadpp.
mTrail) {
129 os <<
"\t" << t.first <<
"\t" << t.second << std::endl;
131 os <<
"Model: " << cadpp.
mModel << std::endl;
133 os <<
"Current: " << cadpp.
mCurrent << std::endl;
void addConstraint(const ConstraintT &c)
void apply_assignments(const ConstraintT &c)
carl::Variable main_variable_of(const ConstraintT &c) const
const Model & model() const
FormulaT simplify(const FormulaT &f) const
const auto & getConflict() const
preprocessor::ConstraintUpdate result(const Map &oldC) const
friend std::ostream & operator<<(std::ostream &os, const Preprocessor &cadpp)
std::optional< std::set< FormulaT > > mConflict
A possibly found conflict.
void removeConstraint(const ConstraintT &c)
void compute_resultants(const ConstraintT &cur)
std::size_t mTrailID
Next element to be processed.
std::map< ConstraintT, carl::Variable > mAssignments
Origins for the assignments.
const std::vector< carl::Variable > & mVars
Variable ordering.
Model mModel
The model used for variable elimination.
std::vector< ConstraintT > Origins
std::vector< std::pair< ConstraintT, Origins > > Trail
std::set< ConstraintT > mCurrent
Current set of equalities.
bool try_variable_elimination(const ConstraintT &cur)
Preprocessor(const std::vector< carl::Variable > &vars)
void postprocessConflict(std::set< FormulaT > &mis) const
std::ostream & operator<<(std::ostream &os, const SampleIteratorQueue< I, C > &siq)
const auto & settings_cadpp()
bool substitute(const FormulaT &constr, const carl::Variable var, const carl::vs::Term< Poly > &term, FormulaT &result)
std::vector< carl::Variable > vars(const std::pair< QuantifierType, std::vector< carl::Variable >> &p)
carl::Formula< Poly > FormulaT
carl::Model< Rational, Poly > Model
carl::Constraint< Poly > ConstraintT
#define SMTRAT_LOG_DEBUG(channel, msg)
static bool register_hook()
static void register_settings(SettingsParser &parser)
bool disable_variable_elimination
std::vector< ConstraintT > toAdd
std::vector< ConstraintT > toRemove