ZonoOpt 2.5.0
Loading...
Searching...
No Matches
Zono.hpp
Go to the documentation of this file.
1#pragma once
2
14#include <memory>
15#include <string>
16
17#include "Eigen/Dense"
18#include "Eigen/Sparse"
19
20#include "ConZono.hpp"
21#include "Defines.hpp"
22
23namespace ZonoOpt
24{
25 using namespace detail;
26
37 class Zono : public ConZono
38 {
39 public:
40 // constructors
45 Zono() { sharp = true; }
46
55 Zono(const Eigen::SparseMatrix<zono_float>& G, const Eigen::Vector<zono_float, -1>& c,
56 const bool zero_one_form = false);
57
58 // virtual destructor
59 ~Zono() override = default;
60
61 // set method
70 void set(const Eigen::SparseMatrix<zono_float>& G, const Eigen::Vector<zono_float, -1>& c,
71 bool zero_one_form = false);
72
76 HybZono* clone() const override;
77
86 std::unique_ptr<Zono> reduce_order(int n_o);
87
96
101 Eigen::Vector<zono_float, -1> get_center();
102
103 // generator conversion between [-1,1] and [0,1]
104 void convert_form() override;
105
106 // display methods
107 std::string print() const override;
108
109 std::unique_ptr<ConZono> constraint_reduction() const override
110 {
111 return std::make_unique<Zono>(*this);
112 }
113
114 // in-place operators (type-preserving overrides)
115 using HybZono::operator+=; // restore vector and box overloads hidden by declarations below
116 using HybZono::operator*=; // restore scalar overload hidden by declarations below
117
122 void operator+=(Zono& other);
123
125 void operator+=(HybZono& other) = delete;
126
131 void operator*=(Zono& other);
132
134 void operator*=(HybZono& other) = delete;
135
136 protected:
137 bool do_is_empty(const SolverSettings&, std::shared_ptr<OptSolution>* sol, const WarmStartParams&) const override;
138
139 Box do_bounding_box(const SolverSettings&, std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
140
141 zono_float do_support(const Eigen::Vector<zono_float, -1>& d, const SolverSettings&,
142 std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
143 };
144
145 // forward declarations
153 std::unique_ptr<Zono> interval_2_zono(const Box& box);
154
166 std::unique_ptr<Zono> make_regular_zono_2D(zono_float radius, int n_sides, bool outer_approx = false,
167 const Eigen::Vector<zono_float, 2>& c = Eigen::Vector<
168 zono_float, 2>::Zero());
169} // namespace ZonoOpt
Constrained zonotope class for ZonoOpt library.
Defines for ZonoOpt library.
Box (i.e., interval vector) class.
Definition Box.hpp:46
Constrained zonotope class.
Definition ConZono.hpp:39
Hybrid zonotope class.
Definition HybZono.hpp:44
bool zero_one_form
flag to indicate whether the set is in 0-1 or -1-1 form
Definition HybZono.hpp:764
void set(const Eigen::SparseMatrix< zono_float > &Gc, const Eigen::SparseMatrix< zono_float > &Gb, const Eigen::Vector< zono_float, -1 > &c, const Eigen::SparseMatrix< zono_float > &Ac, const Eigen::SparseMatrix< zono_float > &Ab, const Eigen::Vector< zono_float, -1 > &b, bool zero_one_form=false, bool sharp=false)
Reset hybrid zonotope object with the given parameters.
Definition HybZono.cpp:48
bool sharp
flag to indicate whether the set is known to be sharp (i.e., convex relaxation = convex hull)
Definition HybZono.hpp:767
Eigen::Vector< zono_float, -1 > c
center vector
Definition HybZono.hpp:743
Eigen::SparseMatrix< zono_float > G
generator matrix G = [Gc, Gb]
Definition HybZono.hpp:737
Zonotope class.
Definition Zono.hpp:38
zono_float do_support(const Eigen::Vector< zono_float, -1 > &d, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Zono.cpp:210
std::unique_ptr< ConZono > constraint_reduction() const override
Execute constraint reduction algorithm from Scott et. al. 2016.
Definition Zono.hpp:109
std::string print() const override
Returns set information as a string.
Definition Zono.cpp:79
Eigen::Vector< zono_float, -1 > get_center()
get center of zonotope
Definition Zono.cpp:302
bool do_is_empty(const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) const override
Definition Zono.cpp:91
void operator+=(HybZono &other)=delete
Deleted: use operator+ instead — result type would be ConZono or HybZono.
HybZono * clone() const override
Clone method for polymorphic behavior.
Definition Zono.cpp:29
Box do_bounding_box(const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Zono.cpp:108
~Zono() override=default
std::unique_ptr< Zono > reduce_order(int n_o)
Perform zonotope order reduction.
Definition Zono.cpp:139
void set(const Eigen::SparseMatrix< zono_float > &G, const Eigen::Vector< zono_float, -1 > &c, bool zero_one_form=false)
Reset zonotope object with the given parameters.
Definition Zono.cpp:34
zono_float get_volume()
Get volume of zonotope.
Definition Zono.cpp:262
Zono()
Default constructor for Zono class.
Definition Zono.hpp:45
void convert_form() override
Converts the set representation between -1-1 and 0-1 forms.
Definition Zono.cpp:58
void operator*=(Zono &other)
In-place Cartesian product (type-preserving: Zono or Point argument). Use operator* for ConZono/HybZo...
Definition Zono.cpp:374
void operator*=(HybZono &other)=delete
Deleted: use operator* instead — result type would be ConZono or HybZono.
void operator+=(Zono &other)
In-place Minkowski sum (type-preserving: Zono or Point argument). Use operator+ for ConZono/HybZono a...
Definition Zono.cpp:369
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition Defines.hpp:22
std::unique_ptr< Zono > interval_2_zono(const Box &box)
Builds a zonotope from a Box object.
Definition Zono.cpp:347
std::unique_ptr< Zono > make_regular_zono_2D(zono_float radius, int n_sides, bool outer_approx=false, const Eigen::Vector< zono_float, 2 > &c=Eigen::Vector< zono_float, 2 >::Zero())
Builds a 2D regular zonotope with a given radius and number of sides.
Definition Zono.cpp:311
Definition ZonoOpt.hpp:51
Abstract base for all solver settings.
Definition SolverDataStructures.hpp:38
Warm start parameters for optimization routines in ZonoOpt library.
Definition SolverDataStructures.hpp:419