dReal4
contractor_ibex_polytope.h
1 #pragma once
2 
3 #include <memory>
4 #include <ostream>
5 #include <vector>
6 
7 #include "./ibex.h"
8 
9 #include "dreal/contractor/contractor.h"
10 #include "dreal/contractor/contractor_cell.h"
12 #include "dreal/util/box.h"
13 
14 namespace dreal {
15 
16 // Custom deleter for ibex::ExprCtr. It deletes the internal
17 // ibex::ExprNode while keeping the ExprSymbols intact. Note that the
18 // ExprSymbols will be deleted separately in
19 // ~ContractorIbexPolytope().
21  void operator()(const ibex::ExprCtr* const p) const {
22  if (p) {
23  ibex::cleanup(p->e, false);
24  delete p;
25  }
26  }
27 };
28 
30  public:
31  /// Constructs IbexPolytope contractor using @p f and @p vars.
32  ContractorIbexPolytope(std::vector<Formula> formulas, const Box& box,
33  const Config& config);
34 
35  /// Deleted copy constructor.
37 
38  /// Deleted move constructor.
40 
41  /// Deleted copy assign operator.
42  ContractorIbexPolytope& operator=(const ContractorIbexPolytope&) = delete;
43 
44  /// Deleted move assign operator.
45  ContractorIbexPolytope& operator=(ContractorIbexPolytope&&) = delete;
46 
47  /// Default destructor.
48  ~ContractorIbexPolytope() override = default;
49 
50  void Prune(ContractorStatus* cs) const override;
51  std::ostream& display(std::ostream& os) const override;
52 
53  /// Returns true if it has no internal ibex contractor.
54  bool is_dummy() const;
55 
56  private:
57  const std::vector<Formula> formulas_;
58  bool is_dummy_{false};
59 
60  IbexConverter ibex_converter_;
61  std::unique_ptr<ibex::SystemFactory> system_factory_;
62  std::unique_ptr<ibex::System> system_;
63  std::unique_ptr<ibex::LinearizerCombo> linear_relax_combo_;
64  std::unique_ptr<ibex::CtcPolytopeHull> ctc_;
65  std::vector<std::unique_ptr<const ibex::ExprCtr, ExprCtrDeleter>> expr_ctrs_;
66 };
67 
68 } // namespace dreal
Abstract base class of contractors.
Definition: contractor_cell.h:29
Visitor class which converts a symbolic Formula into ibex::ExprCtr.
Definition: ibex_converter.h:15
Sum type of symbolic::Expression and symbolic::Formula.
Definition: api.cc:9
Definition: contractor_ibex_polytope.h:20
Represents a n-dimensional interval vector.
Definition: box.h:17
Definition: config.h:12
This is the header file that we consolidate Drake&#39;s symbolic classes and expose them inside of dreal ...
Definition: contractor_ibex_polytope.h:29
Contractor status.
Definition: contractor_status.h:13