ZonoOpt v1.0.0
Loading...
Searching...
No Matches
HybZono.hpp
Go to the documentation of this file.
1#ifndef ZONOOPT_HYBZONO_HPP_
2#define ZONOOPT_HYBZONO_HPP_
3
16#include "MI_Solver.hpp"
17#include "MI_DataStructures.hpp"
18#include "Inequality.hpp"
19#include "Intervals.hpp"
20
21#include <stdexcept>
22#include <limits>
23#include <set>
24
25namespace ZonoOpt
26{
27
28using namespace detail;
29
30// forward declarations
31class Zono;
32class ConZono;
33
44{
45 public:
46
47 // constructors
48
53 HybZono() = default;
54
67 HybZono(const Eigen::SparseMatrix<zono_float>& Gc, const Eigen::SparseMatrix<zono_float>& Gb, const Eigen::Vector<zono_float, -1>& c,
68 const Eigen::SparseMatrix<zono_float>& Ac, const Eigen::SparseMatrix<zono_float>& Ab, const Eigen::Vector<zono_float, -1>& b,
69 const bool zero_one_form=false, const bool sharp=false)
70 {
71 set(Gc, Gb, c, Ac, Ab, b, zero_one_form, sharp);
72 }
73
74 // virtual destructor
75 virtual ~HybZono() = default;
76
89 void set(const Eigen::SparseMatrix<zono_float>& Gc, const Eigen::SparseMatrix<zono_float>& Gb, const Eigen::Vector<zono_float, -1>& c,
90 const Eigen::SparseMatrix<zono_float>& Ac, const Eigen::SparseMatrix<zono_float>& Ab, const Eigen::Vector<zono_float, -1>& b,
91 bool zero_one_form=false, bool sharp=false);
92
96 virtual HybZono* clone() const
97 {
98 return new HybZono(*this);
99 }
100
101 // get methods
102
108 virtual int get_n() const { return this->n; }
109
115 virtual int get_nC() const { return this->nC; }
116
122 virtual int get_nG() const { return this->nG; }
123
129 virtual int get_nGc() const { return this->nGc; }
130
136 virtual int get_nGb() const { return this->nGb; }
137
143 virtual Eigen::SparseMatrix<zono_float> get_Gc() const { return this->Gc; }
144
150 virtual Eigen::SparseMatrix<zono_float> get_Gb() const { return this->Gb; }
151
157 virtual Eigen::SparseMatrix<zono_float> get_G() const { return this->G; }
158
164 virtual Eigen::SparseMatrix<zono_float> get_Ac() const { return this->Ac; }
165
171 virtual Eigen::SparseMatrix<zono_float> get_Ab() const { return this->Ab; }
172
178 virtual Eigen::SparseMatrix<zono_float> get_A() const { return this->A; }
179
185 virtual Eigen::Vector<zono_float, -1> get_c() const { return this->c; }
186
192 virtual Eigen::Vector<zono_float, -1> get_b() const { return this->b; }
193
199 virtual bool is_0_1_form() const { return this->zero_one_form; }
200
208 bool is_sharp() const { return this->sharp; }
209
217 virtual void convert_form();
218
229 virtual void remove_redundancy(int contractor_iter=100);
230
239 virtual std::unique_ptr<ConZono> convex_relaxation() const;
240
258 virtual std::unique_ptr<HybZono> complement(const zono_float delta_m = 100, const bool remove_redundancy=true, const OptSettings &settings=OptSettings(),
259 OptSolution* solution=nullptr, const int n_leaves = std::numeric_limits<int>::max(), const int contractor_iter=100)
260 {
261 return do_complement(delta_m, remove_redundancy, settings, solution, n_leaves, contractor_iter);
262 }
263
264 // type checking
269 bool is_point() const;
270
275 bool is_zono() const;
276
281 bool is_conzono() const;
282
287 bool is_hybzono() const;
288
292 bool is_empty_set() const;
293
294 // display methods
299 virtual std::string print() const;
300
307 friend std::ostream& operator<<(std::ostream& os, const HybZono& Z);
308
309 // optimization
322 Eigen::Vector<zono_float, -1> optimize_over(
323 const Eigen::SparseMatrix<zono_float> &P, const Eigen::Vector<zono_float, -1> &q, zono_float c=0,
324 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr) const
325 {
326 return do_optimize_over(P, q, c, settings, solution);
327 }
328
337 Eigen::Vector<zono_float, -1> project_point(const Eigen::Vector<zono_float, -1>& x,
338 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr) const
339 {
340 return do_project_point(x, settings, solution);
341 }
342
351 bool is_empty(const OptSettings &settings=OptSettings(),
352 OptSolution* solution=nullptr) const
353 {
354 return do_is_empty(settings, solution);
355 }
356
367 zono_float support(const Eigen::Vector<zono_float, -1>& d, const OptSettings &settings=OptSettings(),
368 OptSolution* solution=nullptr)
369 {
370 return do_support(d, settings, solution);
371 }
372
383 bool contains_point(const Eigen::Vector<zono_float, -1>& x, const OptSettings &settings=OptSettings(),
384 OptSolution* solution=nullptr) const
385 {
386 return do_contains_point(x, settings, solution);
387 }
388
398 Box bounding_box(const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr)
399 {
400 return do_bounding_box(settings, solution);
401 }
402
418 std::vector<ConZono> get_leaves(bool remove_redundancy=true, const OptSettings &settings=OptSettings(),
419 OptSolution* solution=nullptr, int n_leaves = std::numeric_limits<int>::max(), int contractor_iter=100) const;
420
421 // friend function declarations
422 friend std::unique_ptr<HybZono> affine_map(const HybZono& Z,
423 const Eigen::SparseMatrix<zono_float>& R, const Eigen::Vector<zono_float, -1>& s);
424 friend std::unique_ptr<HybZono> project_onto_dims(const HybZono& Z, const std::vector<int>& dims);
425 friend std::unique_ptr<HybZono> minkowski_sum(const HybZono& Z1, HybZono& Z2);
426 friend std::unique_ptr<HybZono> pontry_diff(HybZono& Z1, HybZono& Z2, bool exact);
427 friend std::unique_ptr<HybZono> intersection(const HybZono& Z1, HybZono& Z2,
428 const Eigen::SparseMatrix<zono_float>& R);
429 friend std::unique_ptr<HybZono> intersection_over_dims(const HybZono& Z1, HybZono& Z2,
430 const std::vector<int>& dims);
431 friend std::unique_ptr<HybZono> halfspace_intersection(HybZono& Z, const Eigen::SparseMatrix<zono_float>& H,
432 const Eigen::Vector<zono_float, -1>& f, const Eigen::SparseMatrix<zono_float>& R);
433 friend std::unique_ptr<HybZono> union_of_many(const std::vector<HybZono*>& Zs, bool preserve_sharpness, bool expose_indicators);
434 friend std::unique_ptr<HybZono> cartesian_product(const HybZono& Z1, HybZono& Z2);
435 friend std::unique_ptr<HybZono> constrain(HybZono& Z, const std::vector<Inequality> &ineqs, const Eigen::SparseMatrix<zono_float>& R);
436 friend std::unique_ptr<HybZono> set_diff(const HybZono& Z1, HybZono& Z2, zono_float delta_m, bool remove_redundancy,
437 const OptSettings &settings, OptSolution* solution, int n_leaves, int contractor_iter);
438 friend std::unique_ptr<HybZono> vrep_2_hybzono(const std::vector<Eigen::Matrix<zono_float, -1, -1>> &Vpolys, bool expose_indicators);
439 friend std::unique_ptr<HybZono> zono_union_2_hybzono(std::vector<Zono> &Zs, bool expose_indicators);
440
441 protected:
442
443 // fields
444
446 Eigen::SparseMatrix<zono_float> G = Eigen::SparseMatrix<zono_float>(0, 0);
447
449 Eigen::SparseMatrix<zono_float> Gc = Eigen::SparseMatrix<zono_float>(0, 0);
450
452 Eigen::SparseMatrix<zono_float> Gb = Eigen::SparseMatrix<zono_float>(0, 0);
453
455 Eigen::SparseMatrix<zono_float> A = Eigen::SparseMatrix<zono_float>(0, 0);
456
458 Eigen::SparseMatrix<zono_float> Ac = Eigen::SparseMatrix<zono_float>(0, 0);
459
461 Eigen::SparseMatrix<zono_float> Ab = Eigen::SparseMatrix<zono_float>(0, 0);
462
464 Eigen::Vector<zono_float, -1> c = Eigen::Vector<zono_float, -1>(0);
465
467 Eigen::Vector<zono_float, -1> b = Eigen::Vector<zono_float, -1>(0);
468
470 int n = 0;
471
473 int nG = 0;
474
476 int nGc = 0;
477
479 int nGb = 0;
480
482 int nC = 0;
483
485 bool zero_one_form = false;
486
488 bool sharp = false;
489
490 // methods
491 virtual Eigen::Vector<zono_float, -1> do_optimize_over(
492 const Eigen::SparseMatrix<zono_float> &P, const Eigen::Vector<zono_float, -1> &q, zono_float c,
493 const OptSettings &settings, OptSolution* solution) const;
494
495 virtual Eigen::Vector<zono_float, -1> do_project_point(const Eigen::Vector<zono_float, -1>& x,
496 const OptSettings &settings, OptSolution* solution) const;
497
498 virtual bool do_is_empty(const OptSettings &settings, OptSolution* solution) const;
499
500 virtual zono_float do_support(const Eigen::Vector<zono_float, -1>& d, const OptSettings &settings,
501 OptSolution* solution);
502
503 virtual bool do_contains_point(const Eigen::Vector<zono_float, -1>& x, const OptSettings &settings,
504 OptSolution* solution) const;
505
506 virtual Box do_bounding_box(const OptSettings &settings, OptSolution* solution);
507
508 virtual std::unique_ptr<HybZono> do_complement(zono_float, bool remove_redundancy, const OptSettings &settings,
509 OptSolution* solution, int n_leaves, int contractor_iter);
510
511
512 static void remove_generators(Eigen::SparseMatrix<zono_float>& G, Eigen::SparseMatrix<zono_float>& A, const std::set<int>& idx_to_remove);
513 static std::set<int> find_unused_generators(const Eigen::SparseMatrix<zono_float>& G, const Eigen::SparseMatrix<zono_float>& A);
514 OptSolution mi_opt(const Eigen::SparseMatrix<zono_float>& P, const Eigen::Vector<zono_float, -1>& q,
515 zono_float c, const Eigen::SparseMatrix<zono_float>& A, const Eigen::Vector<zono_float, -1>& b,
516 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr) const;
517 std::vector<OptSolution> mi_opt_multisol(const Eigen::SparseMatrix<zono_float>& P, const Eigen::Vector<zono_float, -1>& q,
518 zono_float c, const Eigen::SparseMatrix<zono_float>& A, const Eigen::Vector<zono_float, -1>& b, int n_sols,
519 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr) const;
520
521 private:
522
523 void make_G_A();
524 void set_Ac_Ab_from_A();
525 std::vector<Eigen::Vector<zono_float, -1>> get_bin_leaves(bool remove_redundancy=true,
526 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr,
527 int n_leaves = std::numeric_limits<int>::max()) const;
528};
529
530// forward delcarations
540std::unique_ptr<HybZono> affine_map(const HybZono& Z,
541 const Eigen::SparseMatrix<zono_float>& R, const Eigen::Vector<zono_float, -1>& s = Eigen::Vector<zono_float, -1>());
542
551std::unique_ptr<HybZono> project_onto_dims(const HybZono& Z, const std::vector<int>& dims);
552
561std::unique_ptr<HybZono> minkowski_sum(const HybZono& Z1, HybZono& Z2);
562
581std::unique_ptr<HybZono> pontry_diff(HybZono& Z1, HybZono& Z2, bool exact=false);
582
592std::unique_ptr<HybZono> intersection(const HybZono& Z1, HybZono& Z2,
593 const Eigen::SparseMatrix<zono_float>& R=Eigen::SparseMatrix<zono_float>());
594
604std::unique_ptr<HybZono> intersection_over_dims(const HybZono& Z1, HybZono& Z2,
605 const std::vector<int>& dims);
606
617std::unique_ptr<HybZono> halfspace_intersection(HybZono& Z, const Eigen::SparseMatrix<zono_float>& H,
618 const Eigen::Vector<zono_float, -1>& f, const Eigen::SparseMatrix<zono_float>& R=Eigen::SparseMatrix<zono_float>());
619
633std::unique_ptr<HybZono> union_of_many(const std::vector<HybZono*>& Zs, bool preserve_sharpness=false, bool expose_indicators=false);
634
643std::unique_ptr<HybZono> cartesian_product(const HybZono& Z1, HybZono& Z2);
644
659std::unique_ptr<HybZono> constrain(HybZono& Z, const std::vector<Inequality> &ineqs, const Eigen::SparseMatrix<zono_float>& R=Eigen::SparseMatrix<zono_float>());
660
675std::unique_ptr<HybZono> set_diff(const HybZono& Z1, HybZono& Z2, zono_float delta_m = 100, bool remove_redundancy=true,
676 const OptSettings &settings=OptSettings(), OptSolution* solution=nullptr, int n_leaves = std::numeric_limits<int>::max(), int contractor_iter = 100);
677
678
694std::unique_ptr<HybZono> vrep_2_hybzono(const std::vector<Eigen::Matrix<zono_float, -1, -1>> &Vpolys, bool expose_indicators=false);
695
696
710std::unique_ptr<HybZono> zono_union_2_hybzono(std::vector<Zono> &Zs, bool expose_indicators=false);
711
712
713// implementation
714inline void HybZono::set(const Eigen::SparseMatrix<zono_float>& Gc, const Eigen::SparseMatrix<zono_float>& Gb, const Eigen::Vector<zono_float, -1>& c,
715 const Eigen::SparseMatrix<zono_float>& Ac, const Eigen::SparseMatrix<zono_float>& Ab, const Eigen::Vector<zono_float, -1>& b,
716 const bool zero_one_form, const bool sharp)
717{
718 // check dimensions
719 if (Gc.rows() != c.size() || Gb.rows() != c.size() || Gc.cols() != Ac.cols()
720 || Gb.cols() != Ab.cols() || Ac.rows() != b.size() || Ab.rows() != b.size())
721 {
722 throw std::invalid_argument("HybZono: inconsistent dimensions.");
723 }
724
725 this->Gc = Gc;
726 this->Gb = Gb;
727 this->Ac = Ac;
728 this->Ab = Ab;
729 this->c = c;
730 this->b = b;
731 this->nGc = static_cast<int>(Gc.cols());
732 this->nGb = static_cast<int>(Gb.cols());
733 this->nC = static_cast<int>(Ac.rows());
734 this->n = static_cast<int>(Gc.rows());
735 this->zero_one_form = zero_one_form;
736
737 make_G_A();
738
739 this->sharp = sharp;
740}
741
743{
744 Eigen::Vector<zono_float, -1> c, b;
745 Eigen::SparseMatrix<zono_float> Gb, Ab, Ac, Gc;
746
747 if (!this->zero_one_form) // convert to [0,1] generators
748 {
749 c = this->c - this->G*Eigen::Vector<zono_float, -1>::Ones(this->nG);
750 b = this->b + this->A*Eigen::Vector<zono_float, -1>::Ones(this->nG);
751 Gb = 2.0*this->Gb;
752 Ab = 2.0*this->Ab;
753 Gc = 2.0*this->Gc;
754 Ac = 2.0*this->Ac;
755
756 set(Gc, Gb, c, Ac, Ab, b, true);
757 }
758 else // convert to [-1,1] generators
759 {
760 c = this->c + 0.5*this->G*Eigen::Vector<zono_float, -1>::Ones(this->nG);
761 b = this->b - 0.5*this->A*Eigen::Vector<zono_float, -1>::Ones(this->nG);
762 Gb = 0.5*this->Gb;
763 Ab = 0.5*this->Ab;
764 Gc = 0.5*this->Gc;
765 Ac = 0.5*this->Ac;
766
767 set(Gc, Gb, c, Ac, Ab, b, false);
768 }
769}
770
771inline void HybZono::remove_redundancy(const int contractor_iter)
772{
773 // declare vars
774 std::set<int> idx_c_to_remove, idx_b_to_remove;
775
776 // lambda to remove generators
777 auto remove_all_generators = [this](const std::set<int>& idx_c, const std::set<int>& idx_b) -> void
778 {
779 // remove generators
780 if (!idx_c.empty()) {
781 remove_generators(this->Gc, this->Ac, idx_c);
782 }
783 if (!idx_b.empty()) {
784 remove_generators(this->Gb, this->Ab, idx_b);
785 }
786
787 // update number of generators (needs to happen before call to make_G_A())
788 this->nG = static_cast<int>(this->G.cols());
789 this->nGc = static_cast<int>(this->Gc.cols());
790 this->nGb = static_cast<int>(this->Gb.cols());
791
792 // update equivalent matrices
793 make_G_A();
794 };
795
796 // apply interval contractor
797 Eigen::Vector<zono_float, -1> x_l (this->nG);
798 Eigen::Vector<zono_float, -1> x_u (this->nG);
799 if (this->zero_one_form)
800 {
801 x_l.setZero();
802 }
803 else
804 {
805 x_l.setConstant(-1);
806 }
807 x_u.setOnes();
808 Box box (x_l, x_u);
809 box.contract(this->A, this->b, contractor_iter);
810
811 // find any variables whose values are fixed
812 std::vector<std::pair<int, zono_float>> fixed_vars;
813 for (int i=0; i<this->nG; ++i)
814 {
815 if (box[i].is_single_valued())
816 {
817 fixed_vars.emplace_back(i, box[i].get_y_max());
818 if (i < this->nGc)
819 {
820 idx_c_to_remove.insert(i);
821 }
822 else
823 {
824 idx_b_to_remove.insert(i-this->nGc);
825 }
826 }
827 }
828
829 // get updates to c and b
830 Eigen::Vector<zono_float, -1> dc (this->n);
831 Eigen::Vector<zono_float, -1> db (this->nC);
832 Eigen::Vector<zono_float, -1> dc_k (this->n);
833 Eigen::Vector<zono_float, -1> db_k (this->nC);
834 dc.setZero();
835 db.setZero();
836 for (auto& [k, val] : fixed_vars)
837 {
838 dc_k.setZero();
839 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(this->G, k); it; ++it)
840 {
841 dc_k(it.row()) = it.value()*val;
842 }
843 dc += dc_k;
844
845 db_k.setZero();
846 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(this->A, k); it; ++it)
847 {
848 db_k(it.row()) = it.value()*val;
849 }
850 db -= db_k;
851 }
852
853 // set center and constraint vector
854 this->c += dc;
855 this->b += db;
856
857 // remove generators
859
860 // remove redundant constraints
862 this->nC = static_cast<int>(this->A.rows());
863
864 // update Ac, Ab
865 set_Ac_Ab_from_A();
866
867 // identify any unused generators
868 idx_c_to_remove = find_unused_generators(this->Gc, this->Ac);
869 idx_b_to_remove = find_unused_generators(this->Gb, this->Ab);
870
871 // remove
873}
874
875inline std::string HybZono::print() const
876{
877 std::stringstream ss;
878 ss << "HybZono: " << std::endl;
879 ss << "n: " << this->n << std::endl;
880 ss << "nGc: " << this->nGc << std::endl;
881 ss << "nGb: " << this->nGb << std::endl;
882 ss << "nC: " << this->nC << std::endl;
883 ss << "Gc: " << Eigen::Matrix<zono_float, -1, -1>(this->Gc) << std::endl;
884 ss << "Gb: " << Eigen::Matrix<zono_float, -1, -1>(this->Gb) << std::endl;
885 ss << "c: " << this->c << std::endl;
886 ss << "Ac: " << Eigen::Matrix<zono_float, -1, -1>(this->Ac) << std::endl;
887 ss << "Ab: " << Eigen::Matrix<zono_float, -1, -1>(this->Ab) << std::endl;
888 ss << "b: " << this->b << std::endl;
889 ss << "zero_one_form: " << this->zero_one_form << std::endl;
890 ss << "sharp: " << this->sharp;
891 return ss.str();
892}
893
894inline std::ostream& operator<<(std::ostream& os, const HybZono& Z)
895{
896 os << Z.print();
897 return os;
898}
899
900inline Eigen::Vector<zono_float, -1> HybZono::do_optimize_over(
901 const Eigen::SparseMatrix<zono_float> &P, const Eigen::Vector<zono_float, -1> &q, const zono_float c,
902 const OptSettings &settings, OptSolution* solution) const
903{
904 // check dimensions
905 if (P.rows() != this->n || P.cols() != this->n || q.size() != this->n)
906 {
907 throw std::invalid_argument("Optimize over: inconsistent dimensions.");
908 }
909
910 // cost
911 Eigen::SparseMatrix<zono_float> P_fact = this->G.transpose()*P*this->G;
912 Eigen::Vector<zono_float, -1> q_fact = this->G.transpose()*(P*this->c + q);
913 zono_float delta_c = (0.5*this->c.transpose()*P*this->c + q.transpose()*this->c)(0);
914
915 // solve MIQP
916 OptSolution sol = this->mi_opt(P_fact, q_fact, c+delta_c, this->A, this->b, settings, solution);
917 if (sol.infeasible)
918 return Eigen::Vector<zono_float, -1>(this->nG);
919 else
920 return this->G*sol.z + this->c;
921}
922
923inline Eigen::Vector<zono_float, -1> HybZono::do_project_point(const Eigen::Vector<zono_float, -1>& x,
924 const OptSettings &settings, OptSolution* solution) const
925{
926 // check dimensions
927 if (this->n != x.size())
928 {
929 throw std::invalid_argument("Point projection: inconsistent dimensions.");
930 }
931
932 // cost
933 Eigen::SparseMatrix<zono_float> P = this->G.transpose()*this->G;
934 Eigen::Vector<zono_float, -1> q = this->G.transpose()*(this->c-x);
935
936 // solve MIQP
937 const OptSolution sol = this->mi_opt(P, q, 0, this->A, this->b, settings, solution);
938 if (sol.infeasible)
939 throw std::runtime_error("Point projection: infeasible");
940
941 return this->G*sol.z + this->c;
942}
943
944inline bool HybZono::do_is_empty(const OptSettings &settings, OptSolution* solution) const
945{
946 // trivial case
947 if (this->n == 0)
948 return true;
949
950 // optimize over P=I, q=0
951 Eigen::SparseMatrix<zono_float> P (this->nG, this->nG);
952 P.setIdentity();
953 Eigen::Vector<zono_float, -1> q = Eigen::Vector<zono_float, -1>::Zero(this->nG);
954
955 // solve
956 const std::vector<OptSolution> sol_vec = this->mi_opt_multisol(P, q, 0, this->A, this->b, 1, settings, solution);
957 if (sol_vec.size() > 0)
958 return sol_vec[0].infeasible;
959 else
960 return true;
961}
962
963inline bool HybZono::do_contains_point(const Eigen::Vector<zono_float, -1>& x, const OptSettings &settings,
964 OptSolution* solution) const
965{
966 // check dimensions
967 if (this->n != x.size())
968 {
969 throw std::invalid_argument("Contains point: inconsistent dimensions.");
970 }
971
972 // cost and constraints
973 Eigen::SparseMatrix<zono_float> P (this->nG, this->nG);
974 P.setIdentity();
975 Eigen::Vector<zono_float, -1> q (this->nG);
976 q.setZero(); // zeros
977 Eigen::SparseMatrix<zono_float> A = vcat<zono_float>(this->A, this->G);
978 Eigen::Vector<zono_float, -1> b (this->nC + this->n);
979 b.segment(0, this->nC) = this->b;
980 b.segment(this->nC, this->n) = x-this->c;
981
982 // solve MIQP
983 const OptSolution sol = this->mi_opt(P, q, 0, A, b, settings, solution);
984 return !(sol.infeasible);
985}
986
987
988inline OptSolution HybZono::mi_opt(const Eigen::SparseMatrix<zono_float>& P, const Eigen::Vector<zono_float, -1>& q,
989 const zono_float c, const Eigen::SparseMatrix<zono_float>& A, const Eigen::Vector<zono_float, -1>& b,
990 const OptSettings &settings, OptSolution* solution) const
991{
992 // QP data
993 Eigen::Vector<zono_float, -1> xi_lb (this->nG);
994 if (this->zero_one_form)
995 xi_lb.setZero();
996 else
997 xi_lb.setConstant(-1);
998 const Eigen::Vector<zono_float, -1> xi_ub = Eigen::Vector<zono_float, -1>::Ones(this->nG);
999
1000 const auto admm_data = std::make_shared<ADMM_data>(P, q, A, b, xi_lb, xi_ub, c, settings);
1001
1002 // mixed integer data
1003 MI_data mi_data;
1004 mi_data.admm_data = admm_data;
1005 mi_data.idx_b = std::make_pair(this->nGc, this->nGb);
1006 mi_data.zero_one_form = this->zero_one_form;
1007
1008 // build MI_ADMM_solver object
1009 MI_solver mi_solver(mi_data);
1010
1011 // solve optimization problem
1012 OptSolution sol = mi_solver.solve();
1013
1014 if (solution != nullptr)
1015 *solution = sol;
1016 return sol;
1017}
1018
1019inline std::vector<OptSolution> HybZono::mi_opt_multisol(const Eigen::SparseMatrix<zono_float>& P, const Eigen::Vector<zono_float, -1>& q,
1020 const zono_float c, const Eigen::SparseMatrix<zono_float>& A, const Eigen::Vector<zono_float, -1>& b, int n_sols,
1021 const OptSettings &settings, OptSolution* solution) const
1022{
1023 // ADMM data
1024 Eigen::Vector<zono_float, -1> xi_lb (this->nG);
1025 if (this->zero_one_form)
1026 xi_lb.setZero();
1027 else
1028 xi_lb.setConstant(-1);
1029 const Eigen::Vector<zono_float, -1> xi_ub = Eigen::Vector<zono_float, -1>::Ones(this->nG);
1030
1031 const auto admm_data = std::make_shared<ADMM_data>(P, q, A, b, xi_lb, xi_ub, c, settings);
1032
1033 // mixed integer data
1034 MI_data mi_data;
1035 mi_data.admm_data = admm_data;
1036 mi_data.idx_b = std::make_pair(this->nGc, this->nGb);
1037 mi_data.zero_one_form = this->zero_one_form;
1038
1039 // build MI_ADMM_solver object
1040 MI_solver mi_solver(mi_data);
1041
1042 // solve optimization problem
1043 auto [fst, snd] = mi_solver.multi_solve(n_sols);
1044 if (solution != nullptr)
1045 *solution = snd;
1046 return fst;
1047}
1048
1049
1050inline void HybZono::remove_generators(Eigen::SparseMatrix<zono_float>& G, Eigen::SparseMatrix<zono_float>& A, const std::set<int>& idx_to_remove)
1051{
1052 // declare triplets
1053 std::vector<Eigen::Triplet<zono_float>> triplets;
1054
1055 // update G
1056 int delta_ind = 0;
1057 for (int k=0; k<G.outerSize(); k++)
1058 {
1059 if (idx_to_remove.count(k))
1060 {
1061 ++delta_ind;
1062 }
1063 else
1064 {
1065 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(G, k); it; ++it)
1066 {
1067 triplets.emplace_back(it.row(), k-delta_ind, it.value());
1068 }
1069 }
1070 }
1071 G.resize(G.rows(), G.cols() - delta_ind);
1072 G.setFromTriplets(triplets.begin(), triplets.end());
1073
1074 // update A
1075 triplets.clear();
1076 delta_ind = 0;
1077 for (int k=0; k<A.outerSize(); k++)
1078 {
1079 if (idx_to_remove.count(k))
1080 {
1081 ++delta_ind;
1082 }
1083 else
1084 {
1085 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(A, k); it; ++it)
1086 {
1087 triplets.emplace_back(it.row(), k-delta_ind, it.value());
1088 }
1089 }
1090 }
1091 A.resize(A.rows(), A.cols() - delta_ind);
1092 A.setFromTriplets(triplets.begin(), triplets.end());
1093}
1094
1095inline std::set<int> HybZono::find_unused_generators(const Eigen::SparseMatrix<zono_float>& G, const Eigen::SparseMatrix<zono_float>& A)
1096{
1097 std::set<int> idx_no_cons;
1098 for (int k=0; k<A.outerSize(); k++)
1099 {
1100 bool is_unused = true;
1101 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(A, k); it; ++it)
1102 {
1103 if (it.value() != 0)
1104 {
1105 is_unused = false;
1106 break;
1107 }
1108 }
1109
1110 if (is_unused)
1111 {
1112 idx_no_cons.insert(k);
1113 }
1114 }
1115
1116 // check if any of idx_no_cons multiply only zeros
1117 std::set<int> idx_to_remove;
1118 for (int idx_no_con : idx_no_cons)
1119 {
1120 bool is_zero = true;
1121 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(G, idx_no_con); it; ++it)
1122 {
1123 if (it.value() != 0)
1124 {
1125 is_zero = false;
1126 break;
1127 }
1128 }
1129
1130 if (is_zero)
1131 {
1132 idx_to_remove.insert(idx_no_con);
1133 }
1134 }
1135
1136 return idx_to_remove;
1137}
1138
1139inline void HybZono::make_G_A()
1140{
1141 std::vector<Eigen::Triplet<zono_float>> tripvec;
1143 get_triplets_offset<zono_float>(this->Gb, tripvec, 0, this->nGc);
1144 this->G.resize(this->n, this->nGc + this->nGb);
1145 this->G.setFromTriplets(tripvec.begin(), tripvec.end());
1146
1147 tripvec.clear();
1149 get_triplets_offset<zono_float>(this->Ab, tripvec, 0, this->nGc);
1150 this->A.resize(this->nC, this->nGc + this->nGb);
1151 this->A.setFromTriplets(tripvec.begin(), tripvec.end());
1152
1153 this->nG = this->nGc + this->nGb;
1154}
1155
1156inline void HybZono::set_Ac_Ab_from_A()
1157{
1158 std::vector<Eigen::Triplet<zono_float>> triplets_Ac, triplets_Ab;
1159
1160 // iterate over A
1161 for (int k=0; k<this->A.outerSize(); ++k)
1162 {
1163 for (Eigen::SparseMatrix<zono_float>::InnerIterator it(this->A, k); it; ++it)
1164 {
1165 if (it.col() < this->nGc)
1166 {
1167 triplets_Ac.emplace_back(it.row(), it.col(), it.value());
1168 }
1169 else
1170 {
1171 triplets_Ab.emplace_back(it.row(), it.col()-this->nGc, it.value());
1172 }
1173 }
1174 }
1175
1176 // set Ac, Ab
1177 this->Ac.resize(this->nC, this->nGc);
1178 this->Ac.setFromTriplets(triplets_Ac.begin(), triplets_Ac.end());
1179 this->Ab.resize(this->nC, this->nGb);
1180 this->Ab.setFromTriplets(triplets_Ab.begin(), triplets_Ab.end());
1181}
1182
1183inline std::vector<Eigen::Vector<zono_float, -1>> HybZono::get_bin_leaves(bool remove_redundancy,
1184 const OptSettings &settings, OptSolution* solution, const int n_leaves) const
1185{
1186 // optimize over P=I, q=0
1187 Eigen::SparseMatrix<zono_float> P (this->nG, this->nG);
1188 P.setIdentity();
1189 const Eigen::Vector<zono_float, -1> q = Eigen::Vector<zono_float, -1>::Zero(this->nG);
1190
1191 // solve
1192 std::vector<OptSolution> sol_vec = this->mi_opt_multisol(P, q, 0, this->A, this->b, n_leaves, settings, solution);
1193
1194 // get leaves as conzonos
1195 std::vector<Eigen::Vector<zono_float, -1>> bin_leaves;
1196 for (auto &sol : sol_vec)
1197 {
1198 bin_leaves.emplace_back(sol.z.segment(this->nGc, this->nGb));
1199 }
1200
1201 return bin_leaves;
1202}
1203
1204} // end namespace ZonoOpt
1205
1206#endif
Class definitions for zero-one inequalities.
Interval and box classes.
Data structures for mixed-integer optimization in ZonoOpt library.
Internal mixed-integer optimization routines for ZonoOpt library.
Utilities for sparse matrix operations in ZonoOpt library.
Box (i.e., interval vector) class.
Definition Intervals.hpp:720
Hybrid zonotope class.
Definition HybZono.hpp:44
friend std::unique_ptr< HybZono > affine_map(const HybZono &Z, const Eigen::SparseMatrix< zono_float > &R, const Eigen::Vector< zono_float, -1 > &s)
Returns affine map R*Z + s of set Z.
Definition PolymorphicFunctions.hpp:61
virtual bool is_0_1_form() const
Returns true if factors are in range [0,1], false if they are in range [-1,1].
Definition HybZono.hpp:199
int nC
number of constraints
Definition HybZono.hpp:482
virtual int get_n() const
Returns dimension of set.
Definition HybZono.hpp:108
bool is_empty(const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Returns true if the set is provably empty, false otherwise.
Definition HybZono.hpp:351
std::vector< OptSolution > mi_opt_multisol(const Eigen::SparseMatrix< zono_float > &P, const Eigen::Vector< zono_float, -1 > &q, zono_float c, const Eigen::SparseMatrix< zono_float > &A, const Eigen::Vector< zono_float, -1 > &b, int n_sols, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Definition HybZono.hpp:1019
bool is_sharp() const
Returns true if set is known to be sharp.
Definition HybZono.hpp:208
friend std::unique_ptr< HybZono > cartesian_product(const HybZono &Z1, HybZono &Z2)
Computes the Cartesian product of two sets Z1 and Z2.
Definition PolymorphicFunctions.hpp:798
int n
set dimension
Definition HybZono.hpp:470
virtual bool do_is_empty(const OptSettings &settings, OptSolution *solution) const
Definition HybZono.hpp:944
virtual Eigen::SparseMatrix< zono_float > get_Gc() const
Returns continuous generator matrix.
Definition HybZono.hpp:143
friend std::unique_ptr< HybZono > minkowski_sum(const HybZono &Z1, HybZono &Z2)
Computes Minkowski sum of two sets Z1 and Z2.
Definition PolymorphicFunctions.hpp:133
friend std::unique_ptr< HybZono > intersection_over_dims(const HybZono &Z1, HybZono &Z2, const std::vector< int > &dims)
Computes the generalized intersection of sets Z1 and Z2 over the specified dimensions.
Definition PolymorphicFunctions.hpp:263
OptSolution mi_opt(const Eigen::SparseMatrix< zono_float > &P, const Eigen::Vector< zono_float, -1 > &q, zono_float c, const Eigen::SparseMatrix< zono_float > &A, const Eigen::Vector< zono_float, -1 > &b, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Definition HybZono.hpp:988
Eigen::Vector< zono_float, -1 > project_point(const Eigen::Vector< zono_float, -1 > &x, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Returns the projection of the point x onto the set object.
Definition HybZono.hpp:337
bool is_hybzono() const
Polymorphic type checking: true if set is a hybrid zonotope.
Definition PolymorphicFunctions.hpp:49
virtual int get_nC() const
Returns number of constraints in set definition.
Definition HybZono.hpp:115
friend std::unique_ptr< HybZono > vrep_2_hybzono(const std::vector< Eigen::Matrix< zono_float, -1, -1 > > &Vpolys, bool expose_indicators)
Computes a hybrid zonotope from a union of vertex representation polytopes.
Definition PolymorphicFunctions.hpp:1402
virtual Eigen::Vector< zono_float, -1 > do_project_point(const Eigen::Vector< zono_float, -1 > &x, const OptSettings &settings, OptSolution *solution) const
Definition HybZono.hpp:923
virtual int get_nGb() const
Returns number of binary generators in set definition.
Definition HybZono.hpp:136
virtual Eigen::Vector< zono_float, -1 > do_optimize_over(const Eigen::SparseMatrix< zono_float > &P, const Eigen::Vector< zono_float, -1 > &q, zono_float c, const OptSettings &settings, OptSolution *solution) const
Definition HybZono.hpp:900
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
zono_float support(const Eigen::Vector< zono_float, -1 > &d, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr)
Computes support function of the set in the direction d.
Definition HybZono.hpp:367
virtual void convert_form()
Converts the set representation between -1-1 and 0-1 forms.
Definition HybZono.hpp:742
bool contains_point(const Eigen::Vector< zono_float, -1 > &x, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Checks whether the point x is contained in the set object.
Definition HybZono.hpp:383
virtual std::string print() const
Returns set information as a string.
Definition HybZono.hpp:875
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
bool is_conzono() const
Polymorphic type checking: true if set is a constrained zonotope.
Definition PolymorphicFunctions.hpp:44
virtual Box do_bounding_box(const OptSettings &settings, OptSolution *solution)
Definition PolymorphicFunctions.hpp:1624
virtual zono_float do_support(const Eigen::Vector< zono_float, -1 > &d, const OptSettings &settings, OptSolution *solution)
Definition PolymorphicFunctions.hpp:1691
friend std::unique_ptr< HybZono > halfspace_intersection(HybZono &Z, const Eigen::SparseMatrix< zono_float > &H, const Eigen::Vector< zono_float, -1 > &f, const Eigen::SparseMatrix< zono_float > &R)
Computes the intersection generalized intersection of set Z with halfspace H*x <= f over matrix R.
Definition PolymorphicFunctions.hpp:294
virtual Eigen::Vector< zono_float, -1 > get_c() const
Returns center vector.
Definition HybZono.hpp:185
bool is_point() const
Polymorphic type checking: true if set is a point.
Definition PolymorphicFunctions.hpp:34
virtual HybZono * clone() const
Clone method for polymorphic behavior.
Definition HybZono.hpp:96
virtual ~HybZono()=default
virtual int get_nGc() const
Returns number of continuous generators in set definition.
Definition HybZono.hpp:129
HybZono(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, const bool zero_one_form=false, const bool sharp=false)
HybZono constructor.
Definition HybZono.hpp:67
friend std::unique_ptr< HybZono > zono_union_2_hybzono(std::vector< Zono > &Zs, bool expose_indicators)
Computes a hybrid zonotope from a union of zonotopes.
Definition PolymorphicFunctions.hpp:1255
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.hpp:714
virtual Eigen::SparseMatrix< zono_float > get_Ab() const
Returns binary constraint matrix.
Definition HybZono.hpp:171
virtual std::unique_ptr< ConZono > convex_relaxation() const
Returns convex relaxation of the hybrid zonotope.
Definition PolymorphicFunctions.hpp:1621
virtual Eigen::SparseMatrix< zono_float > get_A() const
Returns constraint matrix.
Definition HybZono.hpp:178
Eigen::Vector< zono_float, -1 > optimize_over(const Eigen::SparseMatrix< zono_float > &P, const Eigen::Vector< zono_float, -1 > &q, zono_float c=0, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr) const
Solves optimization problem with quadratic objective over the current set.
Definition HybZono.hpp:322
bool sharp
flag to indicate whether the set is known to be sharp (i.e., convex relaxation = convex hull)
Definition HybZono.hpp:488
virtual void remove_redundancy(int contractor_iter=100)
Removes redundant constraints and any unused generators.
Definition HybZono.hpp:771
Eigen::Vector< zono_float, -1 > c
center vector
Definition HybZono.hpp:464
int nGb
number of binary factors
Definition HybZono.hpp:479
static void remove_generators(Eigen::SparseMatrix< zono_float > &G, Eigen::SparseMatrix< zono_float > &A, const std::set< int > &idx_to_remove)
Definition HybZono.hpp:1050
HybZono()=default
Default constructor for HybZono class.
bool is_zono() const
Polymorphic type checking: true if set is a zonotope.
Definition PolymorphicFunctions.hpp:39
virtual Eigen::Vector< zono_float, -1 > get_b() const
Returns constraint vector.
Definition HybZono.hpp:192
Box bounding_box(const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr)
Computes a bounding box of the set object as a Box object.
Definition HybZono.hpp:398
static std::set< int > find_unused_generators(const Eigen::SparseMatrix< zono_float > &G, const Eigen::SparseMatrix< zono_float > &A)
Definition HybZono.hpp:1095
virtual int get_nG() const
Returns number of generators in set definition.
Definition HybZono.hpp:122
virtual bool do_contains_point(const Eigen::Vector< zono_float, -1 > &x, const OptSettings &settings, OptSolution *solution) const
Definition HybZono.hpp:963
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
virtual std::unique_ptr< HybZono > do_complement(zono_float, bool remove_redundancy, const OptSettings &settings, OptSolution *solution, int n_leaves, int contractor_iter)
Definition PolymorphicFunctions.hpp:979
friend std::unique_ptr< HybZono > constrain(HybZono &Z, const std::vector< Inequality > &ineqs, const Eigen::SparseMatrix< zono_float > &R)
Applies inequalities to set.
Definition PolymorphicFunctions.hpp:857
friend std::ostream & operator<<(std::ostream &os, const HybZono &Z)
Displays set information to the given output stream.
Definition HybZono.hpp:894
friend std::unique_ptr< HybZono > project_onto_dims(const HybZono &Z, const std::vector< int > &dims)
Projects set Z onto the dimensions specified in dims.
Definition PolymorphicFunctions.hpp:104
friend std::unique_ptr< HybZono > intersection(const HybZono &Z1, HybZono &Z2, const Eigen::SparseMatrix< zono_float > &R)
Computes the generalized intersection of sets Z1 and Z2 over the matrix R.
Definition PolymorphicFunctions.hpp:188
friend std::unique_ptr< HybZono > union_of_many(const std::vector< HybZono * > &Zs, bool preserve_sharpness, bool expose_indicators)
Computes union of several sets.
Definition PolymorphicFunctions.hpp:506
bool is_empty_set() const
Polymorphic type checking: true if set is empty set object.
Definition PolymorphicFunctions.hpp:55
std::vector< ConZono > get_leaves(bool remove_redundancy=true, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr, int n_leaves=std::numeric_limits< int >::max(), int contractor_iter=100) const
Computes individual constrained zonotopes whose union is the hybrid zonotope object.
Definition PolymorphicFunctions.hpp:1721
Eigen::SparseMatrix< zono_float > Ab
binary constraint matrix
Definition HybZono.hpp:461
virtual Eigen::SparseMatrix< zono_float > get_G() const
Returns generator matrix.
Definition HybZono.hpp:157
Eigen::SparseMatrix< zono_float > Ac
continuous constraint matrix
Definition HybZono.hpp:458
virtual Eigen::SparseMatrix< zono_float > get_Gb() const
Returns binary generator matrix.
Definition HybZono.hpp:150
Eigen::SparseMatrix< zono_float > G
generator matrix G = [Gc, Gb]
Definition HybZono.hpp:446
friend std::unique_ptr< HybZono > pontry_diff(HybZono &Z1, HybZono &Z2, bool exact)
Computes the Pontryagin difference Z1 - Z2.
Definition PolymorphicFunctions.hpp:324
int nGc
number of continuous factors
Definition HybZono.hpp:476
virtual Eigen::SparseMatrix< zono_float > get_Ac() const
Returns continuous constraint matrix.
Definition HybZono.hpp:164
virtual std::unique_ptr< HybZono > complement(const zono_float delta_m=100, const bool remove_redundancy=true, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr, const int n_leaves=std::numeric_limits< int >::max(), const int contractor_iter=100)
Computes the complement of the set Z.
Definition HybZono.hpp:258
friend std::unique_ptr< HybZono > set_diff(const HybZono &Z1, HybZono &Z2, zono_float delta_m, bool remove_redundancy, const OptSettings &settings, OptSolution *solution, int n_leaves, int contractor_iter)
Set difference Z1 \ Z2.
Definition PolymorphicFunctions.hpp:1239
#define zono_float
Defines the floating-point type used in ZonoOpt.
Definition ZonoOpt.hpp:43
std::unique_ptr< HybZono > cartesian_product(const HybZono &Z1, HybZono &Z2)
Computes the Cartesian product of two sets Z1 and Z2.
Definition PolymorphicFunctions.hpp:798
std::unique_ptr< HybZono > set_diff(const HybZono &Z1, HybZono &Z2, zono_float delta_m=100, bool remove_redundancy=true, const OptSettings &settings=OptSettings(), OptSolution *solution=nullptr, int n_leaves=std::numeric_limits< int >::max(), int contractor_iter=100)
Set difference Z1 \ Z2.
Definition PolymorphicFunctions.hpp:1239
std::unique_ptr< HybZono > union_of_many(const std::vector< HybZono * > &Zs, bool preserve_sharpness=false, bool expose_indicators=false)
Computes union of several sets.
Definition PolymorphicFunctions.hpp:506
std::unique_ptr< HybZono > minkowski_sum(const HybZono &Z1, HybZono &Z2)
Computes Minkowski sum of two sets Z1 and Z2.
Definition PolymorphicFunctions.hpp:133
std::unique_ptr< HybZono > project_onto_dims(const HybZono &Z, const std::vector< int > &dims)
Projects set Z onto the dimensions specified in dims.
Definition PolymorphicFunctions.hpp:104
std::unique_ptr< HybZono > affine_map(const HybZono &Z, const Eigen::SparseMatrix< zono_float > &R, const Eigen::Vector< zono_float, -1 > &s=Eigen::Vector< zono_float, -1 >())
Returns affine map R*Z + s of set Z.
Definition PolymorphicFunctions.hpp:61
std::unique_ptr< HybZono > intersection(const HybZono &Z1, HybZono &Z2, const Eigen::SparseMatrix< zono_float > &R=Eigen::SparseMatrix< zono_float >())
Computes the generalized intersection of sets Z1 and Z2 over the matrix R.
Definition PolymorphicFunctions.hpp:188
std::unique_ptr< HybZono > halfspace_intersection(HybZono &Z, const Eigen::SparseMatrix< zono_float > &H, const Eigen::Vector< zono_float, -1 > &f, const Eigen::SparseMatrix< zono_float > &R=Eigen::SparseMatrix< zono_float >())
Computes the intersection generalized intersection of set Z with halfspace H*x <= f over matrix R.
Definition PolymorphicFunctions.hpp:294
std::unique_ptr< HybZono > intersection_over_dims(const HybZono &Z1, HybZono &Z2, const std::vector< int > &dims)
Computes the generalized intersection of sets Z1 and Z2 over the specified dimensions.
Definition PolymorphicFunctions.hpp:263
std::unique_ptr< HybZono > pontry_diff(HybZono &Z1, HybZono &Z2, bool exact=false)
Computes the Pontryagin difference Z1 - Z2.
Definition PolymorphicFunctions.hpp:324
std::unique_ptr< HybZono > constrain(HybZono &Z, const std::vector< Inequality > &ineqs, const Eigen::SparseMatrix< zono_float > &R=Eigen::SparseMatrix< zono_float >())
Applies inequalities to set.
Definition PolymorphicFunctions.hpp:857
std::unique_ptr< HybZono > vrep_2_hybzono(const std::vector< Eigen::Matrix< zono_float, -1, -1 > > &Vpolys, bool expose_indicators=false)
Computes a hybrid zonotope from a union of vertex representation polytopes.
Definition PolymorphicFunctions.hpp:1402
std::unique_ptr< HybZono > zono_union_2_hybzono(std::vector< Zono > &Zs, bool expose_indicators=false)
Computes a hybrid zonotope from a union of zonotopes.
Definition PolymorphicFunctions.hpp:1255
Definition ADMM.hpp:41
std::ostream & operator<<(std::ostream &os, const HybZono &Z)
Definition HybZono.hpp:894
Settings for optimization routines in ZonoOpt library.
Definition SolverDataStructures.hpp:26
Solution data structure for optimization routines in ZonoOpt library.
Definition SolverDataStructures.hpp:153