SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
IntEqModule.h
Go to the documentation of this file.
1 /**
2  * @file IntEqModule.h
3  * @author Dustin Huetter <dustin.huetter@rwth-aachen.de>
4  *
5  * @version 2014-10-17
6  * Created on 2014-10-17.
7  */
8 #pragma once
9 #include <smtrat-solver/Module.h>
10 #include "IntEqSettings.h"
11 #include <stdio.h>
12 namespace smtrat
13 {
14  typedef std::map< FormulaT, std::shared_ptr< std::vector<FormulaT> > > Formula_Origins;
15 
16  /**
17  * A module which checks whether the equations contained in the received
18  * (linear integer) formula have a solution.
19  */
20  template<typename Settings>
21  class IntEqModule : public Module
22  {
23  private:
24  // Stores the current equations of the received constraints and their origins
26  // Stores the equations of every iteration step
27  std::vector< Formula_Origins > mRecent_Constraints;
28  // Stores the calculated substitutions in the order they occured
29  std::vector< std::pair< carl::Variable, Poly > > mSubstitutions;
30  // Stores the origins of the calculated substitutions
31  std::map< carl::Variable, std::shared_ptr< std::vector<FormulaT> > > mVariables;
32  // Stores the auxiliary variables that are possibly created during the algorithm
33  std::set< carl::Variable > mAuxiliaries;
34  // Stores the determined (temporary) model
35  mutable Model mTemp_Model;
36  // Stores whether a new substitution has been found in the last ckeckCore call and
37  // we had afterwards no addCore call with an equality
39 
40  /*
41  * This method constructs a solution when it's possible and returns
42  * true in this case. Otherwise, e.g. if a disequality is not satisfied,
43  * it returns false.
44  */
46 
47  public:
48 
50 std::string moduleName() const {
51 return SettingsType::moduleName;
52 }
53  IntEqModule( const ModuleInput* _formula, Conditionals& _conditionals, Manager* _manager = NULL );
54 
56 
57  /**
58  * The module has to take the given sub-formula of the received formula into account.
59  *
60  * @param _subformula The sub-formula to take additionally into account.
61  * @return false, if it can be easily decided that this sub-formula causes a conflict with
62  * the already considered sub-formulas;
63  * true, otherwise.
64  */
65  bool addCore( ModuleInput::const_iterator _subformula );
66 
67  /**
68  * Removes the subformula of the received formula at the given position to the considered ones of this module.
69  * Note that this includes every stored calculation which depended on this subformula, but should keep the other
70  * stored calculation, if possible, untouched.
71  *
72  * @param _subformula The position of the subformula to remove.
73  */
75 
76  /**
77  * Updates the current assignment into the model.
78  * Note, that this is a unique but possibly symbolic assignment maybe containing newly introduced variables.
79  */
80  void updateModel() const;
81 
82  /**
83  * Checks the received formula for consistency.
84  * @return SAT, if the received formula is satisfiable;
85  * UNSAT, if the received formula is not satisfiable;
86  * Unknown, otherwise.
87  */
89  };
90 }
A module which checks whether the equations contained in the received (linear integer) formula have a...
Definition: IntEqModule.h:22
IntEqModule(const ModuleInput *_formula, Conditionals &_conditionals, Manager *_manager=NULL)
void removeCore(ModuleInput::const_iterator _subformula)
Removes the subformula of the received formula at the given position to the considered ones of this m...
Answer checkCore()
Checks the received formula for consistency.
Settings SettingsType
Definition: IntEqModule.h:49
std::vector< std::pair< carl::Variable, Poly > > mSubstitutions
Definition: IntEqModule.h:29
std::vector< Formula_Origins > mRecent_Constraints
Definition: IntEqModule.h:27
void updateModel() const
Updates the current assignment into the model.
std::string moduleName() const
Definition: IntEqModule.h:50
std::set< carl::Variable > mAuxiliaries
Definition: IntEqModule.h:33
Formula_Origins mProc_Constraints
Definition: IntEqModule.h:25
std::map< carl::Variable, std::shared_ptr< std::vector< FormulaT > > > mVariables
Definition: IntEqModule.h:31
bool addCore(ModuleInput::const_iterator _subformula)
The module has to take the given sub-formula of the received formula into account.
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
A base class for all kind of theory solving methods.
Definition: Module.h:70
Class to create the formulas for axioms.
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
std::map< FormulaT, std::shared_ptr< std::vector< FormulaT > > > Formula_Origins
Definition: IntEqModule.h:14