SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
ContractionCandidateManager.cpp
Go to the documentation of this file.
2 
3 namespace smtrat
4 {
5 namespace icp
6 {
8  mCurrentId(1),
9  mCandidates() // TODO: initialize with a certain size
10  {}
11 
13  const Poly _rhs,
14  const ConstraintT& _constraint,
15  carl::Variable _derivationVar,
16  Contractor<carl::SimpleNewton>& _contractor,
17  bool _usePropagation)
18  {
19  ContractionCandidate* tmp = new ContractionCandidate(_lhs, _rhs, _constraint, _derivationVar, _contractor, mCurrentId, _usePropagation);
20 
21  assert( mCurrentId == mCandidates.size() + 1 );
22  mCandidates.push_back( tmp );
23  ++mCurrentId;
24 
25  return tmp;
26  }
27 
29  {
30  if( _id <= mCandidates.size() && _id > 0 )
31  {
32  return mCandidates[_id - 1];
33  }
34  return NULL;
35  }
36 
37  void ContractionCandidateManager::closure(const ContractionCandidate* const _candidate, std::set<const ContractionCandidate*>& _candidates) const
38  {
39  std::pair<std::set<const ContractionCandidate*>::iterator, bool> res = _candidates.insert(_candidate);
40  if ( res.second )
41  {
42 // std::cout << "[Closure] Add candidate ";
43  _candidate->print();
44  for( auto symbol: _candidate->constraint().variables())
45  {
46  for( auto candidateIt = mCandidates.begin(); candidateIt != mCandidates.end(); ++candidateIt )
47  {
48  if( (*candidateIt)->lhs() == symbol )
49  {
50  closure(*candidateIt, _candidates);
51  }
52  }
53  }
54  }
55  }
56 
57 } // namespace icp
58 } // namespace smtrat
void closure(const ContractionCandidate *const _candidate, std::set< const ContractionCandidate * > &_candidates) const
Calculates the closure of a certain candidate according to the variables contained.
std::vector< ContractionCandidate * > mCandidates
ContractionCandidate * getCandidate(unsigned _id) const
Returns the contraction candidate for the given id.
ContractionCandidate * createCandidate(carl::Variable _lhs, const Poly _rhs, const ConstraintT &_constraint, carl::Variable _derivationVar, Contractor< carl::SimpleNewton > &_contractor, bool _usePropagation)
Constructor & Functions.
const ConstraintT & constraint() const
void print(std::ostream &_out=std::cout) const
carl::Contraction< Operator, Poly > Contractor
Class to create the formulas for axioms.
carl::MultivariatePolynomial< Rational > Poly
Definition: types.h:25
carl::Constraint< Poly > ConstraintT
Definition: types.h:29