SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
MCBModule.h
Go to the documentation of this file.
1 /**
2  * @file MCBModule.h
3  * @author Gereon Kremer <gereon.kremer@cs.rwth-aachen.de>
4  *
5  * Multiple-Choice Blasting
6  * Detects arithmetic variabls that allow for a finite number of choices.
7  * Blasts there choices to boolean variables.
8  *
9  * Supports optimization.
10  *
11  * @version 2015-12-10
12  * Created on 2015-12-10.
13  */
14 
15 #pragma once
16 
17 #include <smtrat-solver/PModule.h>
18 #include "MCBSettings.h"
19 #include <carl-formula/formula/functions/ConstraintBounds.h>
20 
21 namespace smtrat
22 {
23  template<typename Settings>
24  class MCBModule : public PModule
25  {
26  private:
27  using AVar = carl::Variable;
28  using BVar = carl::Variable;
29 
30  std::map<AVar, std::map<Rational, std::pair<BVar,FormulaT>>> mChoices;
31  std::set<AVar> mRemaining;
33 
34  public:
36  MCBModule(const ModuleInput* _formula, Conditionals& _conditionals, Manager* _manager = nullptr);
37 
39 
40  /**
41  * Checks the received formula for consistency.
42  * @return SAT, if the received formula is satisfiable;
43  * UNSAT, if the received formula is not satisfiable;
44  * Unknown, otherwise.
45  */
47  void updateModel() const;
48  private:
49  void collectBounds(carl::ConstraintBounds<Poly>& cb, const FormulaT& formula, bool conjunction) const;
50  void collectChoices(const FormulaT& formula);
51  std::function<void(FormulaT)> collectChoicesFunction;
53  };
54 }
All preprocessing modules shall derive from this module, that is modules, which simplify their receiv...
carl::Variable AVar
Definition: MCBModule.h:27
std::set< AVar > mRemaining
Definition: MCBModule.h:31
std::function< void(FormulaT)> collectChoicesFunction
Definition: MCBModule.h:51
void collectChoices(const FormulaT &formula)
void updateModel() const
Updates the model, if the solver has detected the consistency of the received formula,...
void collectBounds(carl::ConstraintBounds< Poly > &cb, const FormulaT &formula, bool conjunction) const
Settings SettingsType
Definition: MCBModule.h:35
std::map< AVar, std::map< Rational, std::pair< BVar, FormulaT > > > mChoices
Definition: MCBModule.h:30
MCBModule(const ModuleInput *_formula, Conditionals &_conditionals, Manager *_manager=nullptr)
Answer checkCore()
Checks the received formula for consistency.
carl::Variable BVar
Definition: MCBModule.h:28
Model mAssignments
Definition: MCBModule.h:32
FormulaT applyReplacements(const FormulaT &f)
Base class for solvers.
Definition: Manager.h:34
The input formula a module has to consider for it's satisfiability check.
Definition: ModuleInput.h:131
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
Definition: types.h:37
const settings::Settings & Settings()
Definition: Settings.h:96
carl::Model< Rational, Poly > Model
Definition: model.h:13
Answer
An enum with the possible answers a Module can give.
Definition: types.h:57
std::vector< std::atomic_bool * > Conditionals
A vector of atomic bool pointers.
Definition: types.h:17