ZonoOpt 2.4.0
Loading...
Searching...
No Matches
Zono.hpp
Go to the documentation of this file.
1#ifndef ZONOOPT_ZONO_HPP_
2#define ZONOOPT_ZONO_HPP_
3
15#include "ConZono.hpp"
16
17namespace ZonoOpt
18{
19 using namespace detail;
20
31 class Zono : public ConZono
32 {
33 public:
34 // constructors
39 Zono() { sharp = true; }
40
49 Zono(const Eigen::SparseMatrix<zono_float>& G, const Eigen::Vector<zono_float, -1>& c,
50 const bool zero_one_form = false);
51
52 // virtual destructor
53 ~Zono() override = default;
54
55 // set method
64 void set(const Eigen::SparseMatrix<zono_float>& G, const Eigen::Vector<zono_float, -1>& c,
65 bool zero_one_form = false);
66
70 HybZono* clone() const override;
71
80 std::unique_ptr<Zono> reduce_order(int n_o);
81
90
95 Eigen::Vector<zono_float, -1> get_center();
96
97 // generator conversion between [-1,1] and [0,1]
98 void convert_form() override;
99
100 // display methods
101 std::string print() const override;
102
103 std::unique_ptr<ConZono> constraint_reduction() const override
104 {
105 return std::make_unique<Zono>(*this);
106 }
107
108 // in-place operators (type-preserving overrides)
109 using HybZono::operator+=; // restore vector and box overloads hidden by declarations below
110 using HybZono::operator*=; // restore scalar overload hidden by declarations below
111
116 void operator+=(Zono& other);
117
119 void operator+=(HybZono& other) = delete;
120
125 void operator*=(Zono& other);
126
128 void operator*=(HybZono& other) = delete;
129
130 protected:
131 bool do_is_empty(const SolverSettings&, std::shared_ptr<OptSolution>* sol, const WarmStartParams&) const override;
132
133 Box do_bounding_box(const SolverSettings&, std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
134
135 zono_float do_support(const Eigen::Vector<zono_float, -1>& d, const SolverSettings&,
136 std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
137 };
138
139 // forward declarations
147 std::unique_ptr<Zono> interval_2_zono(const Box& box);
148
160 std::unique_ptr<Zono> make_regular_zono_2D(zono_float radius, int n_sides, bool outer_approx = false,
161 const Eigen::Vector<zono_float, 2>& c = Eigen::Vector<
162 zono_float, 2>::Zero());
163} // namespace ZonoOpt
164
165#endif
Constrained zonotope class for ZonoOpt library.
Box (i.e., interval vector) class.
Definition Box.hpp:25
Constrained zonotope class.
Definition ConZono.hpp:32
Hybrid zonotope class.
Definition HybZono.hpp:43
bool zero_one_form
flag to indicate whether the set is in 0-1 or -1-1 form
Definition HybZono.hpp:746
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:23
bool sharp
flag to indicate whether the set is known to be sharp (i.e., convex relaxation = convex hull)
Definition HybZono.hpp:749
Eigen::Vector< zono_float, -1 > c
center vector
Definition HybZono.hpp:725
Eigen::SparseMatrix< zono_float > G
generator matrix G = [Gc, Gb]
Definition HybZono.hpp:707
Zonotope class.
Definition Zono.hpp:32
zono_float do_support(const Eigen::Vector< zono_float, -1 > &d, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Zono.cpp:209
std::unique_ptr< ConZono > constraint_reduction() const override
Execute constraint reduction algorithm from Scott et. al. 2016.
Definition Zono.hpp:103
std::string print() const override
Returns set information as a string.
Definition Zono.cpp:68
Eigen::Vector< zono_float, -1 > get_center()
get center of zonotope
Definition Zono.cpp:301
bool do_is_empty(const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) const override
Definition Zono.cpp:80
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:14
Box do_bounding_box(const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Zono.cpp:97
~Zono() override=default
std::unique_ptr< Zono > reduce_order(int n_o)
Perform zonotope order reduction.
Definition Zono.cpp:128
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:19
zono_float get_volume()
Get volume of zonotope.
Definition Zono.cpp:261
Zono()
Default constructor for Zono class.
Definition Zono.hpp:39
void convert_form() override
Converts the set representation between -1-1 and 0-1 forms.
Definition Zono.cpp:47
void operator*=(Zono &other)
In-place Cartesian product (type-preserving: Zono or Point argument). Use operator* for ConZono/HybZo...
Definition Zono.cpp:373
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:368
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition ZonoOpt.hpp:45
std::unique_ptr< Zono > interval_2_zono(const Box &box)
Builds a zonotope from a Box object.
Definition Zono.cpp:346
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:310
Definition ZonoOpt.hpp:58
Abstract base for all solver settings.
Definition SolverDataStructures.hpp:35
Warm start parameters for optimization routines in ZonoOpt library.
Definition ADMM.hpp:49