SMT-RAT  24.02
Toolbox for Strategic and Parallel Satisfiability-Modulo-Theories Solving
ContractionCandidateManager.h
Go to the documentation of this file.
1 /*
2  * File: ContractionCandidateManager.h
3  * Author: Stefan Schupp
4  *
5  * Created on 20. Dezember 2012, 14:26
6  */
7 
8 #pragma once
9 
10 #include "ContractionCandidate.h"
12 
13 namespace smtrat
14 {
15 namespace icp{
17  {
18 
19  private:
20 
21  /**
22  * Member variables
23  */
24  unsigned mCurrentId;
25  std::vector<ContractionCandidate*> mCandidates;
26 
27  public:
28  /**
29  * Constructors
30  */
31 
33 
35  {
36  while( !mCandidates.empty() )
37  {
38  ContractionCandidate* toDelete = mCandidates.back();
39  mCandidates.pop_back();
40  delete toDelete;
41  }
42  }
43 
44  /**
45  * Constructor & Functions
46  */
47 
48  /**
49  * Creates a new candidate with an unique id.
50  * @param _lhs The slack/nonlinear variable which represents the constraint
51  * @param _constraint The constraint which is to be replaced
52  * @param _derivationVar The variable from which the derivative is created when performing contraction
53  * @param _origin The pointer to the original formula, needed for assertions and removals of subformulas
54  * @return a pointer to the created contraction candidate
55  */
56  ContractionCandidate* createCandidate ( carl::Variable _lhs,
57  const Poly _rhs,
58  const ConstraintT& _constraint,
59  carl::Variable _derivationVar,
60  Contractor<carl::SimpleNewton>& _contractor,
61  bool _usePropagation );
62 
63  /**
64  * Returns the id of the given contraction candidate
65  * @param _candidate
66  * @return id of the candidate
67  */
68  unsigned getId ( const ContractionCandidate* const _candidate ) const;
69 
70  /**
71  * Returns the contraction candidate for the given id
72  * @param _id
73  * @return the pointer to the contraction candidate
74  */
75  ContractionCandidate* getCandidate ( unsigned _id ) const;
76 
77  /**
78  * Calculates the closure of a certain candidate according to the variables contained.
79  * @param _candidate
80  * @return the set of candidates in the closure of _candidate
81  */
82  void closure (const ContractionCandidate* const _candidate, std::set<const ContractionCandidate*>& _candidates) const;
83 
84  const std::vector<ContractionCandidate*>& candidates()
85  {
86  return mCandidates;
87  }
88 
89  private:
90  /**
91  * Auxiliary Functions
92  */
93 
94  }; // class ContractionCandidateManager
95 
96 }// namespace icp
97 }// namespace smtrat
unsigned getId(const ContractionCandidate *const _candidate) const
Returns the id of the given contraction candidate.
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 std::vector< ContractionCandidate * > & candidates()
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