ZonoOpt v1.0.0
Loading...
Searching...
No Matches
EmptySet.hpp
Go to the documentation of this file.
1#ifndef ZONOOPT_EMPTYSET_HPP_
2#define ZONOOPT_EMPTYSET_HPP_
3
15#include "ConZono.hpp"
16#include "Zono.hpp"
17
18namespace ZonoOpt {
19
25class EmptySet final : public ConZono
26{
27public:
28
33 EmptySet() = default;
34
40 explicit EmptySet(const int n)
41 {
42 this->n = n;
43
44 // hybzono parameters
45 this->c.resize(this->n);
46 this->c.setConstant(std::numeric_limits<zono_float>::quiet_NaN());
47 this->G.resize(this->n,0);
48 this->nG = 0;
49 this->nGc = this->nG;
50 this->nGb = 0;
51 this->nC = 0;
52 this->Gc = this->G;
53 this->Gb.resize(this->n, 0);
54 this->A.resize(0, this->nG);
55 this->Ac = this->A;
56 this->Ab.resize(0, 0);
57 this->b.resize(0);
58 this->zero_one_form = false;
59 }
60
61 HybZono* clone() const override
62 {
63 return new EmptySet(*this);
64 }
65
66 std::string print() const override
67 {
68 std::stringstream ss;
69 ss << "EmptySet: " << std::endl;
70 ss << " n: " << this->n;
71 return ss.str();
72 }
73
74 void constraint_reduction() override { /* do nothing */ }
75
76 std::unique_ptr<Zono> to_zono_approx() const override { throw std::runtime_error("to_zono_approx: EmptySet"); }
77
78protected:
79 Eigen::Vector<zono_float, -1> do_optimize_over(
80 const Eigen::SparseMatrix<zono_float>&, const Eigen::Vector<zono_float, -1>&, zono_float,
81 const OptSettings&, OptSolution* solution) const override
82 {
83 if (solution)
84 {
85 solution->infeasible = true;
86 }
87 return Eigen::Vector<zono_float, -1>::Constant(this->n, std::numeric_limits<zono_float>::quiet_NaN());
88 }
89
90 Eigen::Vector<zono_float, -1> do_project_point(const Eigen::Vector<zono_float, -1>&, const OptSettings&, OptSolution* solution) const override
91 {
92 if (solution)
93 {
94 solution->infeasible = true;
95 }
96 return Eigen::Vector<zono_float, -1>::Constant(this->n, std::numeric_limits<zono_float>::quiet_NaN());
97 }
98
99 zono_float do_support(const Eigen::Vector<zono_float, -1>&, const OptSettings&, OptSolution* solution) override
100 {
101 if (solution)
102 {
103 solution->infeasible = true;
104 }
105 return std::numeric_limits<zono_float>::quiet_NaN();
106 }
107
108 bool do_contains_point(const Eigen::Vector<zono_float, -1>&, const OptSettings&, OptSolution*) const override
109 {
110 return false;
111 }
112
114 {
115 const Eigen::Vector<zono_float, -1> x_l = Eigen::Vector<zono_float, -1>::Constant(this->n, std::numeric_limits<zono_float>::infinity());
116 const Eigen::Vector<zono_float, -1> x_u = -Eigen::Vector<zono_float, -1>::Constant(this->n, std::numeric_limits<zono_float>::infinity());
117 return {x_l, x_u};
118 }
119
120 bool do_is_empty(const OptSettings&, OptSolution*) const override
121 {
122 return true;
123 }
124
125 std::unique_ptr<HybZono> do_complement(zono_float delta_m, bool, const OptSettings&, OptSolution*, int, int) override
126 {
127 const zono_float m = delta_m + 1; // box width
128 const Eigen::Vector<zono_float, -1> x_l = -Eigen::Vector<zono_float, -1>::Constant(this->n, m);
129 const Eigen::Vector<zono_float, -1> x_u = Eigen::Vector<zono_float, -1>::Constant(this->n, m);
130 const Box box(x_l, x_u);
131 return interval_2_zono(box);
132 }
133};
134
135}
136
137#endif
Constrained zonotope class for ZonoOpt library.
Zonotope class for ZonoOpt library.
Box (i.e., interval vector) class.
Definition Intervals.hpp:718
Constrained zonotope class.
Definition ConZono.hpp:33
void set(const Eigen::SparseMatrix< zono_float > &G, const Eigen::Vector< zono_float, -1 > &c, const Eigen::SparseMatrix< zono_float > &A, const Eigen::Vector< zono_float, -1 > &b, bool zero_one_form=false)
Reset constrained zonotope object with the given parameters.
Definition ConZono.hpp:150
Empty Set class.
Definition EmptySet.hpp:26
bool do_is_empty(const OptSettings &, OptSolution *) const override
Definition EmptySet.hpp:120
std::unique_ptr< HybZono > do_complement(zono_float delta_m, bool, const OptSettings &, OptSolution *, int, int) override
Definition EmptySet.hpp:125
void constraint_reduction() override
Execute constraint reduction algorithm from Scott et. al. 2016.
Definition EmptySet.hpp:74
HybZono * clone() const override
Clone method for polymorphic behavior.
Definition EmptySet.hpp:61
zono_float do_support(const Eigen::Vector< zono_float, -1 > &, const OptSettings &, OptSolution *solution) override
Definition EmptySet.hpp:99
std::unique_ptr< Zono > to_zono_approx() const override
Compute outer approximation of constrained zonotope as zonotope using SVD.
Definition EmptySet.hpp:76
bool do_contains_point(const Eigen::Vector< zono_float, -1 > &, const OptSettings &, OptSolution *) const override
Definition EmptySet.hpp:108
Box do_bounding_box(const OptSettings &, OptSolution *) override
Definition EmptySet.hpp:113
Eigen::Vector< zono_float, -1 > do_optimize_over(const Eigen::SparseMatrix< zono_float > &, const Eigen::Vector< zono_float, -1 > &, zono_float, const OptSettings &, OptSolution *solution) const override
Definition EmptySet.hpp:79
EmptySet(const int n)
EmptySet constructor.
Definition EmptySet.hpp:40
Eigen::Vector< zono_float, -1 > do_project_point(const Eigen::Vector< zono_float, -1 > &, const OptSettings &, OptSolution *solution) const override
Definition EmptySet.hpp:90
std::string print() const override
Returns set information as a string.
Definition EmptySet.hpp:66
EmptySet()=default
Default constructor for EmptySet class.
Hybrid zonotope class.
Definition HybZono.hpp:44
int nC
number of constraints
Definition HybZono.hpp:482
int n
set dimension
Definition HybZono.hpp:470
bool zero_one_form
flag to indicate whether the set is in 0-1 or -1-1 form
Definition HybZono.hpp:485
Eigen::SparseMatrix< zono_float > Gc
continuous generator matrix
Definition HybZono.hpp:449
Eigen::SparseMatrix< zono_float > Gb
binary generator matrix
Definition HybZono.hpp:452
int nG
total number of factors. nG = nGc + nGb
Definition HybZono.hpp:473
Eigen::Vector< zono_float, -1 > c
center vector
Definition HybZono.hpp:464
int nGb
number of binary factors
Definition HybZono.hpp:479
Eigen::SparseMatrix< zono_float > A
constraint matrix A = [Ac, Ab]
Definition HybZono.hpp:455
Eigen::Vector< zono_float, -1 > b
constraint vector
Definition HybZono.hpp:467
Eigen::SparseMatrix< zono_float > Ab
binary constraint matrix
Definition HybZono.hpp:461
Eigen::SparseMatrix< zono_float > Ac
continuous constraint matrix
Definition HybZono.hpp:458
Eigen::SparseMatrix< zono_float > G
generator matrix G = [Gc, Gb]
Definition HybZono.hpp:446
int nGc
number of continuous factors
Definition HybZono.hpp:476
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition ZonoOpt.hpp:43
std::unique_ptr< Zono > interval_2_zono(const Box &box)
Builds a zonotope from a Box object.
Definition PolymorphicFunctions.hpp:1575
Definition ADMM.hpp:41
Settings for optimization routines in ZonoOpt library.
Definition SolverDataStructures.hpp:26
Solution data structure for optimization routines in ZonoOpt library.
Definition SolverDataStructures.hpp:153
bool infeasible
true if optimization problem is provably infeasible
Definition SolverDataStructures.hpp:175