SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
IncWidthModule.h
Go to the documentation of this file.
1 /**
2  * @file IncWidthModule.h
3  * @author YOUR NAME <YOUR EMAIL ADDRESS>
4  *
5  * @version 2015-06-29
6  * Created on 2015-06-29.
7  */
8 
9 #pragma once
10 
11 #include <smtrat-solver/Module.h>
13 #include "../ICPModule/ICPModule.h"
14 #include "IncWidthSettings.h"
15 namespace smtrat
16 {
17  template<typename Settings>
18  class IncWidthModule : public Module
19  {
20  private:
21  // Members.
22  ///
24  /// Stores the current width for the variable domains.
26  /// Stores the substitutions of variables to variable plus a value, being the shift used to arrange the variable's domain.
27  std::map<carl::Variable,Poly> mVariableShifts;
28  /// Collection of bounds of all received formulas.
30  ///
32  std::vector<std::atomic_bool*> mICPFoundAnswer;
34  carl::FastMap<FormulaT,ModuleInput::iterator> mICPFormulaPositions;
35 
36 
37  public:
39 
40  std::string moduleName() const
41  {
42  return SettingsType::moduleName;
43  }
44 
45  IncWidthModule( const ModuleInput* _formula, Conditionals& _conditionals, Manager* _manager = NULL );
46 
48 
49  // Main interfaces.
50 
51  /**
52  * The module has to take the given sub-formula of the received formula into account.
53  *
54  * @param _subformula The sub-formula to take additionally into account.
55  * @return false, if it can be easily decided that this sub-formula causes a conflict with
56  * the already considered sub-formulas;
57  * true, otherwise.
58  */
59  bool addCore( ModuleInput::const_iterator _subformula );
60 
61  /**
62  * Removes the subformula of the received formula at the given position to the considered ones of this module.
63  * Note that this includes every stored calculation which depended on this subformula, but should keep the other
64  * stored calculation, if possible, untouched.
65  *
66  * @param _subformula The position of the subformula to remove.
67  */
69 
70  /**
71  * Updates the current assignment into the model.
72  * Note, that this is a unique but possibly symbolic assignment maybe containing newly introduced variables.
73  */
74  void updateModel() const;
75 
76  /**
77  * Checks the received formula for consistency.
78  * @return SAT, if the received formula is satisfiable;
79  * UNSAT, if the received formula is not satisfiable;
80  * Unknown, otherwise.
81  */
83 
84  private:
85 
86  void reset();
87  std::pair<ModuleInput::iterator,bool> addToICP( const FormulaT& _formula, bool _guaranteedNew = true );
88  bool tryToAddBounds( const EvalRationalIntervalMap& _varBounds, const carl::Variables& _allArithmeticVariables, std::vector<ModuleInput::iterator>& _addedBounds );
89  inline void addBound( std::vector<ModuleInput::iterator>& _addedBounds, ModuleInput::iterator _iterToBound ) const;
90  void removeFromICP( const FormulaT& _formula );
91  void useInfSubsetIfNoAddedBoundsAreContained( const Module& _module, const std::vector<ModuleInput::iterator>& _addedBounds );
92  void clearICP();
93  };
94 }
void removeCore(ModuleInput::const_iterator _subformula)
Removes the subformula of the received formula at the given position to the considered ones of this m...
Rational mHalfOfCurrentWidth
Stores the current width for the variable domains.
std::map< carl::Variable, Poly > mVariableShifts
Stores the substitutions of variables to variable plus a value, being the shift used to arrange the v...
std::vector< std::atomic_bool * > mICPFoundAnswer
void addBound(std::vector< ModuleInput::iterator > &_addedBounds, ModuleInput::iterator _iterToBound) const
bool addCore(ModuleInput::const_iterator _subformula)
The module has to take the given sub-formula of the received formula into account.
ICPModule< ICPSettings4 > * mICP
bool tryToAddBounds(const EvalRationalIntervalMap &_varBounds, const carl::Variables &_allArithmeticVariables, std::vector< ModuleInput::iterator > &_addedBounds)
ModuleInput * mICPFormula
carl::FastMap< FormulaT, ModuleInput::iterator > mICPFormulaPositions
void removeFromICP(const FormulaT &_formula)
void useInfSubsetIfNoAddedBoundsAreContained(const Module &_module, const std::vector< ModuleInput::iterator > &_addedBounds)
Answer checkCore()
Checks the received formula for consistency.
IncWidthModule(const ModuleInput *_formula, Conditionals &_conditionals, Manager *_manager=NULL)
vb::VariableBounds< FormulaT > mVarBounds
Collection of bounds of all received formulas.
std::pair< ModuleInput::iterator, bool > addToICP(const FormulaT &_formula, bool _guaranteedNew=true)
void updateModel() const
Updates the current assignment into the model.
std::string moduleName() const
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
super::const_iterator const_iterator
Passing through the list::const_iterator.
Definition: ModuleInput.h:146
super::iterator iterator
Passing through the list::iterator.
Definition: ModuleInput.h:144
A base class for all kind of theory solving methods.
Definition: Module.h:70
Class to create the formulas for axioms.
carl::Formula< Poly > FormulaT
Definition: types.h:37
const settings::Settings & Settings()
Definition: Settings.h:96
std::map< carl::Variable, RationalInterval > EvalRationalIntervalMap
Definition: model.h:30
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
mpq_class Rational
Definition: types.h:19