ZonoOpt 2.5.0
Loading...
Searching...
No Matches
Point.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 "Zono.hpp"
21
22namespace ZonoOpt
23{
24 using namespace detail;
25
31 class Point final : public Zono
32 {
33 public:
34 // constructor
39 Point() { sharp = true; }
40
46 explicit Point(const Eigen::Vector<zono_float, -1>& c);
47
48 // set method
54 void set(const Eigen::Vector<zono_float, -1>& c);
55
56 HybZono* clone() const override;
57
58 // display methods
59 std::string print() const override;
60
61 // in-place operators (type-preserving overrides)
62 using HybZono::operator+=; // restore vector overload hidden by declarations below
63 using HybZono::operator-=; // restore vector overload hidden by declarations below
64 using HybZono::operator*=; // restore scalar overload hidden by declarations below
65
70 void operator+=(Point& other);
71
73 void operator+=(HybZono& other) = delete;
74
76 void operator+=(const Box& box) = delete;
77
79 void operator-=(Zono& other) = delete;
80
82 void operator-=(const Box& box) = delete;
83
88 void operator*=(Point& other);
89
91 void operator*=(HybZono& other) = delete;
92
94 void operator*=(const Box& box) = delete;
95
96 // do nothing methods
97 std::unique_ptr<HybZono> remove_redundancy(int) const override { return std::unique_ptr<HybZono>(this->clone()); }
98
99 void convert_form() override
100 {
101 /* do nothing */
102 }
103
104 std::unique_ptr<ConZono> constraint_reduction() const override
105 {
106 return std::make_unique<Point>(*this);
107 }
108
109 protected:
110 Eigen::Vector<zono_float, -1> do_optimize_over(
111 const Eigen::SparseMatrix<zono_float>&, const Eigen::Vector<zono_float, -1>&, zono_float,
112 const SolverSettings&, std::shared_ptr<OptSolution>* sol,
113 const WarmStartParams&) const override;
114
115 Eigen::Vector<zono_float, -1> do_project_point(const Eigen::Vector<zono_float, -1>& x,
116 const SolverSettings&, std::shared_ptr<OptSolution>* sol,
117 const WarmStartParams&) const override;
118
119 zono_float do_support(const Eigen::Vector<zono_float, -1>& d, const SolverSettings&,
120 std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
121
122 bool do_contains_point(const Eigen::Vector<zono_float, -1>& x, const SolverSettings&,
123 std::shared_ptr<OptSolution>* sol, const WarmStartParams&) const override;
124
125 Box do_bounding_box(const SolverSettings&, std::shared_ptr<OptSolution>* sol, const WarmStartParams&) override;
126
127 private:
128 void make_default_solution(std::shared_ptr<OptSolution>* sol) const;
129
130 };
131} // namespace ZonoOpt
Zonotope class for ZonoOpt library.
Box (i.e., interval vector) class.
Definition Box.hpp:46
Hybrid zonotope class.
Definition HybZono.hpp:44
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
Point class.
Definition Point.hpp:32
void operator+=(Point &other)
In-place Minkowski sum with another Point (translation). Use operator+ for Zono/ConZono/HybZono/Box a...
Definition Point.cpp:122
zono_float do_support(const Eigen::Vector< zono_float, -1 > &d, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Point.cpp:76
void operator*=(Point &other)
In-place Cartesian product with another Point. Use operator* for Zono/ConZono/HybZono/Box arguments,...
Definition Point.cpp:127
void operator+=(const Box &box)=delete
Deleted: use operator+ instead — result type would be Zono.
std::unique_ptr< HybZono > remove_redundancy(int) const override
Removes redundant constraints and any unused generators.
Definition Point.hpp:97
void convert_form() override
Converts the set representation between -1-1 and 0-1 forms.
Definition Point.hpp:99
Eigen::Vector< zono_float, -1 > do_project_point(const Eigen::Vector< zono_float, -1 > &x, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) const override
Definition Point.cpp:61
std::unique_ptr< ConZono > constraint_reduction() const override
Execute constraint reduction algorithm from Scott et. al. 2016.
Definition Point.hpp:104
void operator*=(HybZono &other)=delete
Deleted: use operator* instead — result type would be Zono or wider.
void operator-=(const Box &box)=delete
Deleted: use operator- instead — Point ⊖ Box does not yield a Point.
void operator+=(HybZono &other)=delete
Deleted: use operator+ instead — result type would be Zono or wider.
void operator-=(Zono &other)=delete
Deleted: use operator- instead — Point ⊖ Zono does not yield a Point.
void set(const Eigen::Vector< zono_float, -1 > &c)
Reset point object with the given parameters.
Definition Point.cpp:26
Eigen::Vector< zono_float, -1 > do_optimize_over(const Eigen::SparseMatrix< zono_float > &, const Eigen::Vector< zono_float, -1 > &, zono_float, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) const override
Definition Point.cpp:52
bool do_contains_point(const Eigen::Vector< zono_float, -1 > &x, const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) const override
Definition Point.cpp:90
Box do_bounding_box(const SolverSettings &, std::shared_ptr< OptSolution > *sol, const WarmStartParams &) override
Definition Point.cpp:103
std::string print() const override
Returns set information as a string.
Definition Point.cpp:43
Point()
Default constructor for Point class.
Definition Point.hpp:39
void operator*=(const Box &box)=delete
Deleted: use operator* instead — result type would be Zono.
HybZono * clone() const override
Clone method for polymorphic behavior.
Definition Point.cpp:21
Zonotope class.
Definition Zono.hpp:38
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition Defines.hpp:22
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