dReal4
contractor_worklist_fixpoint.h
1 #pragma once
2 
3 #include <ostream>
4 #include <vector>
5 
6 #include "dreal/contractor/contractor.h"
7 #include "dreal/contractor/contractor_cell.h"
8 #include "dreal/util/box.h"
9 
10 namespace dreal {
11 
12 /// Fixpoint contractor using the worklist algorithm: apply C₁, ..., Cₙ
13 /// until it reaches a fixpoint or it satisfies a given termination
14 /// condition.
16  public:
17  /// Deletes default constructor.
18  ContractorWorklistFixpoint() = delete;
19 
20  /// Constructs a fixpoint contractor with a termination condition
21  /// (Box × Box → Bool) and a sequence of Contractors {C₁, ..., Cₙ}.
22  ContractorWorklistFixpoint(TerminationCondition term_cond,
23  std::vector<Contractor> contractors,
24  const Config& config);
25 
26  /// Deleted copy constructor.
28 
29  /// Deleted move constructor.
31 
32  /// Deleted copy assign operator.
34  delete;
35 
36  /// Deleted move assign operator.
38 
39  /// Default destructor.
40  ~ContractorWorklistFixpoint() override = default;
41 
42  void Prune(ContractorStatus* cs) const override;
43  std::ostream& display(std::ostream& os) const override;
44 
45  private:
46  // Stop the fixed-point iteration if term_cond(old_box, new_box) is true.
47  const TerminationCondition term_cond_;
48  std::vector<Contractor> contractors_;
49 
50  // input_to_contractors_[i] is the set of contractors whose input
51  // includes the i-th variable. That is, `input_to_contractors_[i][j]
52  // = true` indicates that if i-th dimension of the current box
53  // changes in a pruning operation, we need to run contractors_[j]
54  // because i ∈ contractors_[j].input(). This map is constructed in
55  // the constructor.
56  std::vector<DynamicBitset> input_to_contractors_;
57 };
58 
59 } // namespace dreal
void Prune(ContractorStatus *cs) const override
Q : list of contractors Ctc : list of all contractors.
Definition: contractor_worklist_fixpoint.cc:75
~ContractorWorklistFixpoint() override=default
Default destructor.
Fixpoint contractor using the worklist algorithm: apply C₁, ..., Cₙ until it reaches a fixpoint or ...
Definition: contractor_worklist_fixpoint.h:15
const Config & config() const
Returns config.
Definition: contractor_cell.cc:33
Abstract base class of contractors.
Definition: contractor_cell.h:29
Sum type of symbolic::Expression and symbolic::Formula.
Definition: api.cc:9
std::ostream & display(std::ostream &os) const override
Outputs this contractor to os.
Definition: contractor_worklist_fixpoint.cc:143
ContractorWorklistFixpoint()=delete
Deletes default constructor.
ContractorWorklistFixpoint & operator=(const ContractorWorklistFixpoint &)=delete
Deleted copy assign operator.
Definition: config.h:12
Contractor status.
Definition: contractor_status.h:13