A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (2024)

\LetLtxMacro\orgvdots

\LetLtxMacro\orgddots

Justin Koeln1, Trevor J. Bird2, Jacob Siefert3, Justin Ruths1, Herschel C. Pangborn3, and Neera Jain2*This material is based upon work supported by the National Science Foundation Graduate Research Fellowship under Grant No. DGE-1333468.1Justin Koeln and Justin Ruths are with the Department of Mechanical Engineering,University of Texas at Dallas, Richardson, TX, USAjustin.koeln@utdallas.edu, jruths@utdallas.edu2Trevor J. Bird and Neera Jain are with the School of Mechanical Engineering,Purdue University, West Lafayette, IN, USAbird6@purdue.edu,neerajain@purdue.edu3Jacob Siefert and Herschel C. Pangborn are with the Department of Mechanical Engineering,The Pennsylvania State University, University Park, PA, USAjas7031@psu.edu, hcpangborn@psu.edu

Abstract

This paper introduces zonoLAB, a MATLAB-based toolbox for set-based control system analysis using the hybrid zonotope set representation. Hybrid zonotopes have proven to be an expressive set representation that can exactly represent the reachable sets of mixed-logical dynamical systems and tightly approximate the reachable sets of nonlinear dynamic systems. Moreover, hybrid zonotopes can exactly represent the continuous piecewise linear control laws associated with model predictive control and the input-output mappings of neural networks with piecewise linear activation functions. The hybrid zonotope set representation is also highly exploitable, where efficient methods developed for mixed-integer linear programming can be directly used for set operation and analysis. The zonoLAB toolbox is designed to make these capabilities accessible to the dynamic systems and controls community, with functionality spanning fundamental operations with hybrid zonotope, constrained zonotope, and zonotope set representations, powerful set analysis tools, and general-purpose algorithms for reachability analysis of open- and closed-loop systems.

I Introduction

Set-based methods are increasingly used for the analysis and control of dynamic systems. These methods are supported by a well-established and rigorous theoretical foundation [1, 2, 3] and are becoming more practical in application due to expressive and efficient set representations [4, 5, 6, 7, 8], improved algorithms [9, 10, 11], and the availability of open-source software packages [12, 13, 14, 15, 16, 17, 18, 19]. Within the field of set-based methods, a subset of techniques are based on set propagation and reachability analysis, as reviewed in [20]. Whether used for safety verification, state estimation, dynamic system analysis, or control design, set propagation techniques generally focus on iterative procedures to determine the set of states reachable by a dynamic system, given a bounded set of initial conditions and bounded sets of controllable inputs, exogenous disturbances, and/or model uncertainty. Open-source software toolboxes are available for a variety of set-based methods [12, 13, 14, 15, 16, 17, 18, 19].While a complete review of available toolboxes falls outside the scope of this brief paper, each toolbox is tailored to balance performance and computational cost when applying select analysis techniques to particular classes of systems through the choice of appropriate set representations and algorithms that exploit the structure of these representations.

The objective of this paper is to introduce zonoLAB111Available for download at https://github.com/ESCL-at-UTD/zonoLAB under the GNU General Public License., a MATLAB toolbox that strategically exploits the structures of zonotopic set representations, including zonotopes, constrained zonotopes, and hybrid zonotopes, for a wide range of set operations and applications. A unique feature of zonoLAB is the use of hybrid zonotopes, a set representation using nbsubscript𝑛𝑏n_{b}italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT binary factors to define the union of up to 2nbsuperscript2subscript𝑛𝑏2^{n_{b}}2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT constrained zonotopes (i.e., convex polytopes).In addition to basic set operations, such as linear mappings, Minkowski sums, and intersections, zonoLAB provides user-friendly implementations of recent results exploiting the hybrid zonotope set representation, such as reachability analysis of Mixed Logical Dynamical (MLD) and Piecewise Affine (PWA) systems [5], set-based representations of Model Predictive Control (MPC) feedback policies and closed-loop reachability [21], exact set-based representations of neural networks with ReLU activations functions [22], and set-based approximations of nonlinear system dynamics for analysis and control design [23].

The remainder of this paper is organized as follows. Section II provides background information on zonotopic set representations and operations. The structure and main functionality of zonoLAB are presented in Section III. Section IV demonstrates how zonoLAB can be used to compute reachable sets for MLD and PWA systems, MPC-controlled systems, neural networks, and systems with nonlinear dynamics. Section V concludes the paper.

Notation:Sets are denoted by uppercase calligraphic letters, e.g., 𝒵n𝒵superscript𝑛\mathcal{Z}\subset\mathbb{R}^{n}caligraphic_Z ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT. Commas in subscripts are used to distinguish between properties that are defined for multiple sets; e.g., ng,zsubscript𝑛𝑔𝑧n_{g,z}italic_n start_POSTSUBSCRIPT italic_g , italic_z end_POSTSUBSCRIPT describes the complexity of the set 𝒵𝒵\mathcal{Z}caligraphic_Z. The n𝑛nitalic_n-dimensional unit hypercube is denoted by n={xn|x1}superscriptsubscript𝑛conditional-set𝑥superscript𝑛subscriptnorm𝑥1\mathcal{B}_{\infty}^{n}=\left\{x\in\mathbb{R}^{n}~{}|~{}\|x\|_{\infty}\leq 1\right\}caligraphic_B start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT = { italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT | ∥ italic_x ∥ start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT ≤ 1 } while the constrained unit hypercube is ng(A,b)={xn|x1,Ax=b}superscriptsubscriptsubscript𝑛𝑔𝐴𝑏conditional-set𝑥superscript𝑛formulae-sequencesubscriptnorm𝑥1𝐴𝑥𝑏\mathcal{B}_{\infty}^{n_{g}}(A,b)=\left\{x\in\mathbb{R}^{n}~{}|~{}\|x\|_{%\infty}\leq 1,Ax=b\right\}caligraphic_B start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT ( italic_A , italic_b ) = { italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT | ∥ italic_x ∥ start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT ≤ 1 , italic_A italic_x = italic_b }. The set of all n𝑛nitalic_n-dimensional binary vectors is denoted by {1,1}nsuperscript11𝑛\{-1,1\}^{n}{ - 1 , 1 } start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT.The cardinality of the discrete set 𝒯𝒯\mathcal{T}caligraphic_T is denoted by |𝒯|𝒯|\mathcal{T}|| caligraphic_T |.The concatenation of two column vectors to a single column vector is denoted by (ξ1ξ2)=[ξ1ξ2]subscript𝜉1subscript𝜉2superscriptdelimited-[]superscriptsubscript𝜉1topsuperscriptsubscript𝜉2toptop(\xi_{1}~{}\xi_{2})=[\xi_{1}^{\top}~{}\xi_{2}^{\top}]^{\top}( italic_ξ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT italic_ξ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) = [ italic_ξ start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT italic_ξ start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT. The bold numbers 𝟏1\mathbf{1}bold_1 and 𝟎0\mathbf{0}bold_0 denote matrices of all 1111 and 00 elements, respectively, and 𝐈𝐈\mathbf{I}bold_I denotes the identity matrix with dimensions indicated by subscripts when not easily deduced from context.

II Set Representations and Basic Operations

II-A Zonotopic Set Representations

The zonoLAB toolbox is primarily built on three main zonotopic representations: the zonotope, the constrained zonotope, and the hybrid zonotope.

Definition 1

(Zonotope) [24]A set 𝒵n𝒵superscript𝑛\mathcal{Z}\subset\mathbb{R}^{n}caligraphic_Z ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT is a zonotope in Generator-representation (G-rep) if there exists generator matrix Gn×ng𝐺superscript𝑛subscript𝑛𝑔G\in\mathbb{R}^{n\times n_{g}}italic_G ∈ blackboard_R start_POSTSUPERSCRIPT italic_n × italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and center cn𝑐superscript𝑛c\in\mathbb{R}^{n}italic_c ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT such that

𝒵={Gξ+c|ξ1},𝒵conditional-set𝐺𝜉𝑐subscriptnorm𝜉1\mathcal{Z}=\{G\xi+c\;|\;\|\xi\|_{\infty}\leq 1\},caligraphic_Z = { italic_G italic_ξ + italic_c | ∥ italic_ξ ∥ start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT ≤ 1 } ,(1)

and is denoted by 𝒵=G,c𝒵𝐺𝑐\mathcal{Z}=\langle G,c\ranglecaligraphic_Z = ⟨ italic_G , italic_c ⟩.

Definition 2

(Constrained Zonotope) [4]A set 𝒵cnsubscript𝒵𝑐superscript𝑛\mathcal{Z}_{c}\subset\mathbb{R}^{n}caligraphic_Z start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT is a constrained zonotope in Constrained Generator-representation (CG-rep) if there exists a generator matrix Gn×ng𝐺superscript𝑛subscript𝑛𝑔G\in\mathbb{R}^{n\times n_{g}}italic_G ∈ blackboard_R start_POSTSUPERSCRIPT italic_n × italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, center cn𝑐superscript𝑛c\in\mathbb{R}^{n}italic_c ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT, constraint matrix Anc×ng𝐴superscriptsubscript𝑛𝑐subscript𝑛𝑔A\in\mathbb{R}^{n_{c}\times n_{g}}italic_A ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, and constraint vector bnc𝑏superscriptsubscript𝑛𝑐b\in\mathbb{R}^{n_{c}}italic_b ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT such that

𝒵c={Gξ+c|ξ1,Aξ=b},subscript𝒵𝑐conditional-set𝐺𝜉𝑐formulae-sequencesubscriptnorm𝜉1𝐴𝜉𝑏\mathcal{Z}_{c}=\{G\xi+c\;|\;\|\xi\|_{\infty}\leq 1,A\xi=b\},caligraphic_Z start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = { italic_G italic_ξ + italic_c | ∥ italic_ξ ∥ start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT ≤ 1 , italic_A italic_ξ = italic_b } ,(2)

and is denoted by 𝒵c=G,c,A,bsubscript𝒵𝑐𝐺𝑐𝐴𝑏\mathcal{Z}_{c}=\langle G,c,A,b\ranglecaligraphic_Z start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = ⟨ italic_G , italic_c , italic_A , italic_b ⟩.

Definition 3

(Hybrid Zonotope) [5]A set 𝒵hnsubscript𝒵superscript𝑛\mathcal{Z}_{h}\subset\mathbb{R}^{n}caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT is a hybrid zonotope in Hybrid Constrained Generator-representation (HCG-rep) if there exists a continuous generator matrix Gcn×ngsuperscript𝐺𝑐superscript𝑛subscript𝑛𝑔G^{c}\in\mathbb{R}^{n\times n_{g}}italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n × italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, binary generator matrix Gbn×nbsuperscript𝐺𝑏superscript𝑛subscript𝑛𝑏G^{b}\in\mathbb{R}^{n\times n_{b}}italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n × italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, center cn𝑐superscript𝑛c\in\mathbb{R}^{n}italic_c ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT, continuous constraint matrix Acnc×ngsuperscript𝐴𝑐superscriptsubscript𝑛𝑐subscript𝑛𝑔A^{c}\in\mathbb{R}^{n_{c}\times n_{g}}italic_A start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, binary constraint matrix Abnc×nbsuperscript𝐴𝑏superscriptsubscript𝑛𝑐subscript𝑛𝑏A^{b}\in\mathbb{R}^{n_{c}\times n_{b}}italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, and constraint vector bnc𝑏superscriptsubscript𝑛𝑐b\in\mathbb{R}^{n_{c}}italic_b ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT such that

𝒵h={[GcGb][ξcξb]+c|[ξcξb]ng×{1,1}nb,[AcAb][ξcξb]=b},subscript𝒵conditional-setdelimited-[]superscript𝐺𝑐superscript𝐺𝑏delimited-[]superscript𝜉𝑐superscript𝜉𝑏𝑐matrixdelimited-[]superscript𝜉𝑐superscript𝜉𝑏superscriptsubscriptsubscript𝑛𝑔superscript11subscript𝑛𝑏delimited-[]superscript𝐴𝑐superscript𝐴𝑏delimited-[]superscript𝜉𝑐superscript𝜉𝑏𝑏\mathcal{Z}_{h}=\left\{\left[G^{c}\>G^{b}\right]\left[\begin{smallmatrix}\xi^{%c}\\\xi^{b}\end{smallmatrix}\right]+c\>\middle|\begin{matrix}\left[\begin{%smallmatrix}\xi^{c}\\\xi^{b}\end{smallmatrix}\right]\in\mathcal{B}_{\infty}^{n_{g}}\times\{-1,1\}^{%n_{b}},\\\left[A^{c}\>A^{b}\right]\left[\begin{smallmatrix}\xi^{c}\\\xi^{b}\end{smallmatrix}\right]=b\end{matrix}\right\},caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT = { [ italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ] [ start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT end_CELL end_ROW ] + italic_c | start_ARG start_ROW start_CELL [ start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT end_CELL end_ROW ] ∈ caligraphic_B start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × { - 1 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT , end_CELL end_ROW start_ROW start_CELL [ italic_A start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ] [ start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT end_CELL end_ROW start_ROW start_CELL italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT end_CELL end_ROW ] = italic_b end_CELL end_ROW end_ARG } ,(3)

and is denoted by 𝒵h=Gc,Gb,c,Ac,Ab,bsubscript𝒵superscript𝐺𝑐superscript𝐺𝑏𝑐superscript𝐴𝑐superscript𝐴𝑏𝑏\mathcal{Z}_{h}=\langle G^{c},G^{b},c,A^{c},A^{b},b\ranglecaligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT = ⟨ italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT , italic_c , italic_A start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT , italic_b ⟩.

For zonotopes and constrained zonotopes, the columns of G𝐺Gitalic_G are called the generators and the elements of ξng𝜉superscriptsubscript𝑛𝑔\xi\in\mathbb{R}^{n_{g}}italic_ξ ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are called factors. For hybrid zonotopes, the columns of Gcsuperscript𝐺𝑐G^{c}italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT (Gbsuperscript𝐺𝑏G^{b}italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT) are called the continuous generators (binary generators) and the elements of ξcngsuperscript𝜉𝑐superscriptsubscript𝑛𝑔\xi^{c}\in\mathbb{R}^{n_{g}}italic_ξ start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT (ξbnbsuperscript𝜉𝑏superscriptsubscript𝑛𝑏\xi^{b}\in\mathbb{R}^{n_{b}}italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT) are called continuous factors (binary factors).

As shown in Fig. 1, a zonotope is an affine image of the unit hypercube ngsuperscriptsubscriptsubscript𝑛𝑔\mathcal{B}_{\infty}^{n_{g}}caligraphic_B start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, while a constrained zonotope is an affine image of the constrained unit hypercube ng(A,b)superscriptsubscriptsubscript𝑛𝑔𝐴𝑏\mathcal{B}_{\infty}^{n_{g}}(A,b)caligraphic_B start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT ( italic_A , italic_b ). By introducing nbsubscript𝑛𝑏n_{b}italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT binary factors, a hybrid zonotope is equivalent to the union of |𝒯|2nb𝒯superscript2subscript𝑛𝑏|\mathcal{T}|\leq 2^{n_{b}}| caligraphic_T | ≤ 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT constrained zonotopes as

𝒵h=ξib𝒯𝒵c,i,subscript𝒵subscriptsubscriptsuperscript𝜉𝑏𝑖𝒯subscript𝒵𝑐𝑖\displaystyle\mathcal{Z}_{h}=\bigcup_{\xi^{b}_{i}\in\mathcal{T}}\mathcal{Z}_{c%,i}\>,caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT = ⋃ start_POSTSUBSCRIPT italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ caligraphic_T end_POSTSUBSCRIPT caligraphic_Z start_POSTSUBSCRIPT italic_c , italic_i end_POSTSUBSCRIPT ,(4a)
𝒵c,i=Gc,c+Gbξib,Ac,bAbξib,subscript𝒵𝑐𝑖superscript𝐺𝑐𝑐superscript𝐺𝑏subscriptsuperscript𝜉𝑏𝑖superscript𝐴𝑐𝑏superscript𝐴𝑏subscriptsuperscript𝜉𝑏𝑖\displaystyle\mathcal{Z}_{c,i}=\left\langle G^{c},c+G^{b}\xi^{b}_{i},A^{c},b-A%^{b}\xi^{b}_{i}\right\rangle\>,caligraphic_Z start_POSTSUBSCRIPT italic_c , italic_i end_POSTSUBSCRIPT = ⟨ italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_c + italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_A start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_b - italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT italic_ξ start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ⟩ ,(4b)

where the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT constrained zonotope (4b) has its center and constraint vector shifted by the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT value of the discrete set 𝒯={ξib{1,1}nb|𝒵c,i}𝒯conditional-setsuperscriptsubscript𝜉𝑖𝑏superscript11subscript𝑛𝑏subscript𝒵𝑐𝑖\mathcal{T}=\{\xi_{i}^{b}\in\{-1,1\}^{n_{b}}~{}|~{}\mathcal{Z}_{c,i}\not=\emptyset\}caligraphic_T = { italic_ξ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT ∈ { - 1 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT end_POSTSUPERSCRIPT | caligraphic_Z start_POSTSUBSCRIPT italic_c , italic_i end_POSTSUBSCRIPT ≠ ∅ } mapped by Gbsuperscript𝐺𝑏G^{b}italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT and Absuperscript𝐴𝑏A^{b}italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT, respectively. Therefore, while a constrained zonotope is the affine image of the intersection of a hypercube and hyperplanes, a hybrid zonotope is the affine image of multiple intersections of a hypercube and shifted hyperplanes, as shown in Fig. 1.

Note that zonotopes are a subset of convex polytopes that are centrally symmetric, constrained zonotopes can represent any convex polytope [4], and hybrid zonotopes can represent the union of any collection of convex polytopes [5]. Moreover, zonotopes are a subset of constrained zonotopes, which are a subset of hybrid zonotopes, and a hybrid zonotope degenerates to a constrained zonotope when nb=0subscript𝑛𝑏0n_{b}=0italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT = 0, which degenerates to a zonotope when nc=0subscript𝑛𝑐0n_{c}=0italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 0.

A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (1)
OperationMathematicallyMethodScalability
Generalized intersection𝒵R𝒴subscript𝑅𝒵𝒴\mathcal{Z}\cap_{R}\mathcal{Y}caligraphic_Z ∩ start_POSTSUBSCRIPT italic_R end_POSTSUBSCRIPT caligraphic_Y or &𝒪(mnng)𝒪𝑚𝑛subscript𝑛𝑔\mathcal{O}(mnn_{g})caligraphic_O ( italic_m italic_n italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Cartesian product𝒵×𝒴𝒵𝒴\mathcal{Z}\times\mathcal{Y}caligraphic_Z × caligraphic_YtProd𝒪(1)𝒪1\mathcal{O}(1)caligraphic_O ( 1 )
Convex hullaCH(𝒵𝒴)CH𝒵𝒴\text{CH}(\mathcal{Z}\cup\mathcal{Y})CH ( caligraphic_Z ∪ caligraphic_Y )vexHull𝒪(ng)𝒪subscript𝑛𝑔\mathcal{O}(n_{g})caligraphic_O ( italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Intersection with halfspace(s)𝒵R{xHxf}subscript𝑅𝒵conditional-set𝑥𝐻𝑥𝑓\mathcal{Z}\cap_{R}\{x\mid Hx\leq f\}caligraphic_Z ∩ start_POSTSUBSCRIPT italic_R end_POSTSUBSCRIPT { italic_x ∣ italic_H italic_x ≤ italic_f }fspaceIntersection𝒪(nHmnng)𝒪subscript𝑛𝐻𝑚𝑛subscript𝑛𝑔\mathcal{O}(n_{H}mnn_{g})caligraphic_O ( italic_n start_POSTSUBSCRIPT italic_H end_POSTSUBSCRIPT italic_m italic_n italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Linear mappingR𝒵𝑅𝒵R\mathcal{Z}italic_R caligraphic_Zmes or *𝒪(mnng)𝒪𝑚𝑛subscript𝑛𝑔\mathcal{O}(mnn_{g})caligraphic_O ( italic_m italic_n italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Minkowski sum𝒵𝒴direct-sum𝒵𝒴\mathcal{Z}\oplus\mathcal{Y}caligraphic_Z ⊕ caligraphic_Ys or +𝒪(n)𝒪𝑛\mathcal{O}(n)caligraphic_O ( italic_n )
Pontryagin differenceb𝒵𝒴symmetric-difference𝒵𝒴\mathcal{Z}\ominus\mathcal{Y}caligraphic_Z ⊖ caligraphic_YtryDiff𝒪(2ngn2ng)𝒪superscript2subscript𝑛𝑔superscript𝑛2subscript𝑛𝑔\mathcal{O}(2^{n_{g}}n^{2}n_{g})caligraphic_O ( 2 start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_POSTSUPERSCRIPT italic_n start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Projection onto subset of dimensionsΠd𝒵subscriptΠ𝑑𝒵\Pi_{d}\mathcal{Z}roman_Π start_POSTSUBSCRIPT italic_d end_POSTSUBSCRIPT caligraphic_Zjection𝒪(1)𝒪1\mathcal{O}(1)caligraphic_O ( 1 )
One-step reach set for MLD systemkk+1subscript𝑘subscript𝑘1\mathcal{R}_{k}\rightarrow\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT → caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPTpMLD𝒪(ng3)𝒪subscriptsuperscript𝑛3𝑔\mathcal{O}(n^{3}_{g})caligraphic_O ( italic_n start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
Union𝒵𝒴𝒵𝒴\mathcal{Z}\cup\mathcal{Y}caligraphic_Z ∪ caligraphic_Yon𝒪(ng)𝒪subscript𝑛𝑔\mathcal{O}(n_{g})caligraphic_O ( italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT )
a For o and Zono objects only. b Set 𝒴𝒴\mathcal{Y}caligraphic_Y must be a o object.

II-B Zonotopic Set Operations

Historically, the computational benefits of using a zonotope set representation come from the relative ease, numerical accuracy, and scalability of computing linear mappings and Minkowski sums, where given matrix Rm×n𝑅superscript𝑚𝑛R\in\mathbb{R}^{m\times n}italic_R ∈ blackboard_R start_POSTSUPERSCRIPT italic_m × italic_n end_POSTSUPERSCRIPT and zonotopes 𝒵,𝒲n𝒵𝒲superscript𝑛\mathcal{Z},\mathcal{W}\subset\mathbb{R}^{n}caligraphic_Z , caligraphic_W ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT,

R𝒵=𝑅𝒵absent\displaystyle R\mathcal{Z}=italic_R caligraphic_Z =RGz,Rcz,𝑅subscript𝐺𝑧𝑅subscript𝑐𝑧\displaystyle\langle RG_{z},Rc_{z}\rangle\>,⟨ italic_R italic_G start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT , italic_R italic_c start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT ⟩ ,(5a)
𝒵𝒲=direct-sum𝒵𝒲absent\displaystyle\mathcal{Z}\oplus\mathcal{W}=caligraphic_Z ⊕ caligraphic_W =[GzGw],cz+cw.delimited-[]subscript𝐺𝑧subscript𝐺𝑤subscript𝑐𝑧subscript𝑐𝑤\displaystyle\langle[G_{z}G_{w}],c_{z}+c_{w}\rangle\>.⟨ [ italic_G start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT italic_G start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT ] , italic_c start_POSTSUBSCRIPT italic_z end_POSTSUBSCRIPT + italic_c start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT ⟩ .(5b)

Such practical benefits were extended to the general class of convex polytopes with the invention of constrained zonotopes [4]. While linear mappings and Minkowski sums are useful for reachability analysis, additional operations are also made computationally efficient through the use of zonotopic set operations. For example, while it has been shown that the zonotope containment problem is co-NP-complete [25], the necessary, but not sufficient, condition for 𝒵𝒲𝒵𝒲\mathcal{Z}\subseteq\mathcal{W}caligraphic_Z ⊆ caligraphic_W if 𝒵𝒵\mathcal{Z}caligraphic_Z and 𝒲𝒲\mathcal{W}caligraphic_W are zonotopes is formulated as a feasibility check for a system of linear equations. This enabled set containment conditions to be directly embedded in robust MPC formulations [26]. The zonoLAB toolbox aims to provide a unified framework that implements recent developments in zonotope, constrained zonotope, and hybrid zonotope set operations [10, 5, 21, 27, 28, 29, 23, 22] to make the practical benefits of these set representations more accessible to the dynamic systems and controls community.

III The zonoLAB Toolbox

III-A Toolbox Structure

Using Object-Oriented Programming (OOP) in MATLAB, zonoLAB consists of three main classes—o, Zono, and Zono—used to represent zonotopes, constrained zonotopes, and hybrid zonotopes, respectively. An abstract class, tractZono, is used as a superclass for these three classes. As an abstract class, tractZono cannot be instantiated but is used to define common functionality for the o, Zono, and Zono classes.

Methods provided by the zonoLAB toolbox are organized into five categories: properties, arithmetic, visualization, complexity, and auxiliary. For brevity, Table 3 provides a list of only the arithmetic methods currently available using the three zonotopic set representations, along with the computational complexity of each operation. These methods are defined for the tractZono superclass to be used with any of the three main classes.

III-B Set Definitions and Conversions

The hybrid zonotope 𝒵h=Gc,Gb,c,Ac,Ab,bsubscript𝒵superscript𝐺𝑐superscript𝐺𝑏𝑐superscript𝐴𝑐superscript𝐴𝑏𝑏\mathcal{Z}_{h}=\langle G^{c},G^{b},c,A^{c},A^{b},b\ranglecaligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT = ⟨ italic_G start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_G start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT , italic_c , italic_A start_POSTSUPERSCRIPT italic_c end_POSTSUPERSCRIPT , italic_A start_POSTSUPERSCRIPT italic_b end_POSTSUPERSCRIPT , italic_b ⟩ is defined using zonoLAB as

assuming the variables Gb,c,Ac,Ab,b are predefined. Zonotopes and constrained zontopes are defined similarly. Sets can also be recast to a more expressive representation. For example, a constrained zonotope, Zc, can be recast as a hybrid zonotope using

= hybZono(Zc)

which automatically sets Gb and Ab to matrices of all zeros of the appropriate dimension.

A convex polytopic set defined in H-rep as ={xn|Hxf}conditional-set𝑥superscript𝑛𝐻𝑥𝑓\mathcal{H}=\{x\in\mathbb{R}^{n}|Hx\leq f\}caligraphic_H = { italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT | italic_H italic_x ≤ italic_f }, where Hnh×n𝐻superscriptsubscript𝑛𝑛H\in\mathbb{R}^{n_{h}\times n}italic_H ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT × italic_n end_POSTSUPERSCRIPT, fnh𝑓superscriptsubscript𝑛f\in\mathbb{R}^{n_{h}}italic_f ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, and nhsubscript𝑛n_{h}italic_n start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT is the number of halfspaces, can be represented as a constrained zonotope using

G = conZono([H f])

The union of N𝑁Nitalic_N sets in H-rep can be represented as a hybrid zonotope using

CG = hybZono(H_collection)

where ollection is a N×1𝑁1N\times 1italic_N × 1 cell array where the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT cell is [Hifi]delimited-[]subscript𝐻𝑖subscript𝑓𝑖[H_{i}\;f_{i}][ italic_H start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] corresponding to the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT set i={xn|Hixfi}subscript𝑖conditional-set𝑥superscript𝑛subscript𝐻𝑖𝑥subscript𝑓𝑖\mathcal{H}_{i}=\{x\in\mathbb{R}^{n}|H_{i}x\leq f_{i}\}caligraphic_H start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = { italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT | italic_H start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x ≤ italic_f start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT }. Note that the N𝑁Nitalic_N sets do not need to have the same number of halfspaces.

For a collection of nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT vertices {v1,,vnv}subscript𝑣1subscript𝑣subscript𝑛𝑣\{v_{1},\dots,v_{n_{v}}\}{ italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT }, where vinsubscript𝑣𝑖superscript𝑛v_{i}\in\mathbb{R}^{n}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT, a set 𝒱𝒱\mathcal{V}caligraphic_V defined in V-rep is conventionally considered as the convex hull of the vertices, 𝒱=conv({v1,,vnv})𝒱convsubscript𝑣1subscript𝑣subscript𝑛𝑣\mathcal{V}=\text{conv}(\{v_{1},\dots,v_{n_{v}}\})caligraphic_V = conv ( { italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT } ). However, zonoLAB provides the flexibility to use this collection of vertices to define a set as the union of the vertices, as the union of line segments between vertices, as the conventional convex hull of these vertices, or some combination of these three [23]. Thus, in addition to providing the vertex matrix V=[v1,,vnv]n×nv𝑉subscript𝑣1subscript𝑣subscript𝑛𝑣superscript𝑛subscript𝑛𝑣V=[v_{1},\dots,v_{n_{v}}]\in\mathbb{R}^{n\times n_{v}}italic_V = [ italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT ] ∈ blackboard_R start_POSTSUPERSCRIPT italic_n × italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, an incidence matrix Mnv×N𝑀superscriptsubscript𝑛𝑣𝑁M\in\mathbb{R}^{n_{v}\times N}italic_M ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT × italic_N end_POSTSUPERSCRIPT must also be provided, where the rows correspond to the nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT vertices and the columns correspond to the desired N𝑁Nitalic_N convex sets. Elements Mi,j=1subscript𝑀𝑖𝑗1M_{i,j}=1italic_M start_POSTSUBSCRIPT italic_i , italic_j end_POSTSUBSCRIPT = 1 if the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT vertex is a member of the jthsuperscript𝑗𝑡j^{th}italic_j start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT set. All other entries are zero. For example, if M=𝐈nv𝑀subscript𝐈subscript𝑛𝑣M=\mathbf{I}_{n_{v}}italic_M = bold_I start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT, the result is a hybrid zonotope representing the union of the nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT vertices. If M𝑀Mitalic_M is defined such that M1,1=M1,N=1subscript𝑀11subscript𝑀1𝑁1M_{1,1}=M_{1,N}=1italic_M start_POSTSUBSCRIPT 1 , 1 end_POSTSUBSCRIPT = italic_M start_POSTSUBSCRIPT 1 , italic_N end_POSTSUBSCRIPT = 1 and Mi,i1=Mi,i=1,i{2,,nv}formulae-sequencesubscript𝑀𝑖𝑖1subscript𝑀𝑖𝑖1for-all𝑖2subscript𝑛𝑣M_{i,i-1}=M_{i,i}=1,\forall i\in\{2,\dots,n_{v}\}italic_M start_POSTSUBSCRIPT italic_i , italic_i - 1 end_POSTSUBSCRIPT = italic_M start_POSTSUBSCRIPT italic_i , italic_i end_POSTSUBSCRIPT = 1 , ∀ italic_i ∈ { 2 , … , italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT }, then the result is a hybrid zonotope representing the line segments between each consecutive vertex in the vertex matrix, including a line segment between the first and last vertices. Finally, if M=𝟏nv×1𝑀subscript1subscript𝑛𝑣1M=\mathbf{1}_{n_{v}\times 1}italic_M = bold_1 start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT × 1 end_POSTSUBSCRIPT, then the result is a constrained zonotope representing the convex hull of the vertices. In general, with matrices V and M defined, the desired set is created using

CG = hybZono({V,M})

where M} is a 1×2121\times 21 × 2 cell array.

III-C Plotting

In zonoLAB, plotting a zonotopic set is achieved by identifying all vertices of the set, and the corresponding collection of faces composed of subsets of these vertices, to use MATLAB’s ch function for visualizing 2D and 3D polygons. As a method of the tractZono class, f] = plot(Z,optPlot) is used to determine the nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT vertices and nfsubscript𝑛𝑓n_{f}italic_n start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT faces of the n𝑛nitalic_n-dimensional set Z stored in the nv×nsubscript𝑛𝑣𝑛n_{v}\times nitalic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT × italic_n matrix v and the nf×nmaxsubscript𝑛𝑓subscript𝑛𝑚𝑎𝑥n_{f}\times n_{max}italic_n start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT matrix f, where nmaxsubscript𝑛𝑚𝑎𝑥n_{max}italic_n start_POSTSUBSCRIPT italic_m italic_a italic_x end_POSTSUBSCRIPT is the largest number of vertices on a single face. The second argument Plot is an object of the tOptions class used to tailor display properties for the set. Since plotting Zono and Zono objects requires solving linear programs, a verOptions class is also included in zonoLAB for users to specify their preferred solver for each type of optimization problem. The t method calls set-specific methods for the o, Zono, and Zono classes. For brevity, only the main ideas of the 3D plotting algorithms provided in zonoLAB are presented here, assuming that the set is full-dimensional.

For o objects, zonoLAB exploits the fact that, in 3D, the faces of a zonotope are parallelograms formed by two of the generators from the zonotope centered at a linear combination of the remaining ng2subscript𝑛𝑔2n_{g}-2italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT - 2 generators [30]. As a result, the number of vertices of a 3D zonotope is bounded such that nv2i=02(ng1i)subscript𝑛𝑣2superscriptsubscript𝑖02binomialsubscript𝑛𝑔1𝑖n_{v}\leq 2\sum_{i=0}^{2}\binom{n_{g}-1}{i}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT ≤ 2 ∑ start_POSTSUBSCRIPT italic_i = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT ( FRACOP start_ARG italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT - 1 end_ARG start_ARG italic_i end_ARG ) and the number of faces is bounded such that nf2(ng2)subscript𝑛𝑓2binomialsubscript𝑛𝑔2n_{f}\leq 2\binom{n_{g}}{2}italic_n start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT ≤ 2 ( FRACOP start_ARG italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT end_ARG start_ARG 2 end_ARG ) [3]. However, note that the number of rows of v will likely exceed this bound on nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT since no effort is made to identify and remove repeated vertices. Since plotting o objects does not require solving linear programs, plotting sets is relatively fast even when ngsubscript𝑛𝑔n_{g}italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT is large (e.g., a random zonotope 𝒵3𝒵superscript3\mathcal{Z}\in\mathbb{R}^{3}caligraphic_Z ∈ blackboard_R start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT with ng=200subscript𝑛𝑔200n_{g}=200italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT = 200 produces nv=159,200subscript𝑛𝑣159200n_{v}=159,200italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT = 159 , 200 vertices and nf=39,800subscript𝑛𝑓39800n_{f}=39,800italic_n start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT = 39 , 800 faces and is plotted in approximately 1 second on a standard desktop computer).

Plotting Zono and Zono objects is considerably more time intensive. The zonoLAB toolbox uses a vertex-centric approach, where linear programming is used to identify each vertex and the number of optimization problems to be solved scales linearly with the number of vertices in the set. Currently, zonoLAB plots Zono objects by plotting each constrained zonotope from (4b) and using the Leaves method to determine the discrete set 𝒯𝒯\mathcal{T}caligraphic_T containing the combinations of binary factors that result in non-empty constrained zonotopes. Therefore, plotting a Zono object is the same as plotting |𝒯|𝒯|\mathcal{T}|| caligraphic_T | Zono objects.

The zonoLAB toolbox plots Zono objects in 3D using a modified version of the expanding polytope algorithm from [31]. With the goal of finding all vertices of a convex polytope, linear programming is used to determine the furthest point in a particular direction while remaining within the set. After identifying an initial 3-simplex with 4 vertices, normal vectors for each face are used as these search directions. If a vertex is identified that is further in this direction than the existing face, the vertex is added to the list of vertices, the existing face is removed from the list of faces, and new faces are defined that include this new vertex. This process is repeated until all face normals have been used as search directions and no new vertices are found. While slower than o plotting, this approach remains practical for medium-complexity sets (e.g., a random constrained zonotope 𝒵c3subscript𝒵𝑐superscript3\mathcal{Z}_{c}\in\mathbb{R}^{3}caligraphic_Z start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT 3 end_POSTSUPERSCRIPT with ng=50subscript𝑛𝑔50n_{g}=50italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT = 50 and nc=26subscript𝑛𝑐26n_{c}=26italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 26, produces nv=7,668subscript𝑛𝑣7668n_{v}=7,668italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT = 7 , 668 vertices and nf=7,762subscript𝑛𝑓7762n_{f}=7,762italic_n start_POSTSUBSCRIPT italic_f end_POSTSUBSCRIPT = 7 , 762 faces and is plotted in approximately 60 seconds on a standard desktop computer, where GUROBI [32] is called to solve a linear program 15,432 times).

III-D Set-based Mappings

The zonoLAB toolbox also leverages the notion of a set-based mapping, where dimensions of a set are categorized as either input or output dimensions and the set provides the mapping between inputs and outputs over a bounded input domain. This notation is similar to the graph of a function, where if f:𝒳𝒴:𝑓𝒳𝒴f:\mathcal{X}\rightarrow\mathcal{Y}italic_f : caligraphic_X → caligraphic_Y then the graph is G(f)={(x,f(x))|x𝒳}𝒳×𝒴𝐺𝑓conditional-set𝑥𝑓𝑥𝑥𝒳𝒳𝒴G(f)=\{(x,f(x))\,|\,x\in\mathcal{X}\}\subseteq\mathcal{X}\times\mathcal{Y}italic_G ( italic_f ) = { ( italic_x , italic_f ( italic_x ) ) | italic_x ∈ caligraphic_X } ⊆ caligraphic_X × caligraphic_Y. The idea of set-based mapping is demonstrated using the following linear system example but is generalizable (and more valuable) when representing piecewise linear and nonlinear mappings.

Consider a linear, discrete-time, time-invariant system xk+1=Axk+Buksubscript𝑥𝑘1𝐴subscript𝑥𝑘𝐵subscript𝑢𝑘x_{k+1}=Ax_{k}+Bu_{k}italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_A italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_B italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, where xkknsubscript𝑥𝑘subscript𝑘superscript𝑛x_{k}\in\mathcal{R}_{k}\subset\mathbb{R}^{n}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT, uk𝒰msubscript𝑢𝑘𝒰superscript𝑚u_{k}\in\mathcal{U}\subset\mathbb{R}^{m}italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_U ⊂ blackboard_R start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT, and A,B,k𝐴𝐵subscript𝑘A,B,\mathcal{R}_{k}italic_A , italic_B , caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT, and 𝒰𝒰\mathcal{U}caligraphic_U are known. The one-step reachable set k+1subscript𝑘1\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT is computed as

k+1=AkB𝒰.subscript𝑘1direct-sum𝐴subscript𝑘𝐵𝒰\mathcal{R}_{k+1}=A\mathcal{R}_{k}\oplus B\mathcal{U}\>.caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_A caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ⊕ italic_B caligraphic_U .(6)

Using zonoLAB, with A, B, Rk, and U predefined, the reachable set lus can be computed using methods mes and s of the tractZono class as

The one-step reachable set k+1subscript𝑘1\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT is also known as the successor set, Suc(k,𝒰)Sucsubscript𝑘𝒰\text{Suc}(\mathcal{R}_{k},\mathcal{U})Suc ( caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , caligraphic_U ), which can be defined for the more general nonlinear dynamics xk+1=f(xk,uk)subscript𝑥𝑘1𝑓subscript𝑥𝑘subscript𝑢𝑘x_{k+1}=f(x_{k},u_{k})italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_f ( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) as

Suc(k,𝒰)={f(xk,uk)|xkk,uk𝒰}.Sucsubscript𝑘𝒰conditional-set𝑓subscript𝑥𝑘subscript𝑢𝑘formulae-sequencesubscript𝑥𝑘subscript𝑘subscript𝑢𝑘𝒰\text{Suc}(\mathcal{R}_{k},\mathcal{U})=\{f(x_{k},u_{k})\;|\;x_{k}\in\mathcal{%R}_{k},u_{k}\in\mathcal{U}\}\>.Suc ( caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , caligraphic_U ) = { italic_f ( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) | italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_U } .(7)

The notion of an open-loop state-update set was presented in [23], where a set is used to bound all possible state transitions given by f(,)𝑓f(\cdot,\cdot)italic_f ( ⋅ , ⋅ ) over a predefined bounded domain of states and inputs. These state-update sets are an example of a set-based mapping. When a state-update set capturing open-loop dynamics is coupled to a similar set-based map of a given control law, the resulting closed-loop state-update set bounds the evolution of the closed-loop system and can be used for closed-loop reachability analysis and verification.

Mathematically, the open-loop state-update set Ψ2n+mΨsuperscript2𝑛𝑚\Psi\subset\mathbb{R}^{2n+m}roman_Ψ ⊂ blackboard_R start_POSTSUPERSCRIPT 2 italic_n + italic_m end_POSTSUPERSCRIPT is defined as

Ψ={[xkukxk+1]|xk+1Suc({xk},{uk}),(xk,uk)D(Ψ)},\Psi=\Bigg{\{}\begin{bmatrix}x_{k}\\u_{k}\\x_{k+1}\end{bmatrix}\ \bigg{|}\ \begin{array}[]{c}x_{k+1}\in\text{Suc}(\{x_{k}%\},\{u_{k}\}),\\(x_{k},u_{k})\in\text{D}(\Psi)\end{array}\Bigg{\}}\>,roman_Ψ = { [ start_ARG start_ROW start_CELL italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT end_CELL end_ROW end_ARG ] | start_ARRAY start_ROW start_CELL italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT ∈ Suc ( { italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT } , { italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT } ) , end_CELL end_ROW start_ROW start_CELL ( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) ∈ D ( roman_Ψ ) end_CELL end_ROW end_ARRAY } ,(8)

where D(Ψ)n+mDΨsuperscript𝑛𝑚\text{D}(\Psi)\subset\mathbb{R}^{n+m}D ( roman_Ψ ) ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n + italic_m end_POSTSUPERSCRIPT is the domain set of ΨΨ\Psiroman_Ψ, which is chosen as a region of interest for analysis, as in [29].

Using the open-loop state-update set ΨΨ\Psiroman_Ψ, with domain set defined such that k×𝒰D(Ψ)subscript𝑘𝒰DΨ\mathcal{R}_{k}\times\mathcal{U}\subseteq\text{D}(\Psi)caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT × caligraphic_U ⊆ D ( roman_Ψ ), the successor set can be computed using projection and generalized intersection operations as

Suc(k,𝒰)=[𝟎n×n+mIn](Ψ[In+m0n](k×𝒰)).Sucsubscript𝑘𝒰matrixsubscript0𝑛𝑛𝑚subscriptI𝑛subscriptdelimited-[]subscriptI𝑛𝑚subscript0𝑛Ψsubscript𝑘𝒰\text{Suc}(\mathcal{R}_{k},\mathcal{U})=\begin{bmatrix}\mathbf{0}_{n\times n+m%}&\textbf{I}_{n}\end{bmatrix}\big{(}\Psi\cap_{[\textbf{I}_{n+m}~{}\textbf{0}_{%n}]}(\mathcal{R}_{k}\times\mathcal{U})\big{)}\>.Suc ( caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , caligraphic_U ) = [ start_ARG start_ROW start_CELL bold_0 start_POSTSUBSCRIPT italic_n × italic_n + italic_m end_POSTSUBSCRIPT end_CELL start_CELL I start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL end_ROW end_ARG ] ( roman_Ψ ∩ start_POSTSUBSCRIPT [ I start_POSTSUBSCRIPT italic_n + italic_m end_POSTSUBSCRIPT 0 start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ] end_POSTSUBSCRIPT ( caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT × caligraphic_U ) ) .(9)

While (6) provides a method for computing the one-step reachable set, a state-update set ΨΨ\Psiroman_Ψ can also be used to compute k+1subscript𝑘1\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT. Assuming the domain set D(Ψ)n+mDΨsuperscript𝑛𝑚\text{D}(\Psi)\in\mathbb{R}^{n+m}D ( roman_Ψ ) ∈ blackboard_R start_POSTSUPERSCRIPT italic_n + italic_m end_POSTSUPERSCRIPT is known such that k×𝒰D(Ψ)subscript𝑘𝒰DΨ\mathcal{R}_{k}\times\mathcal{U}\subseteq\text{D}(\Psi)caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT × caligraphic_U ⊆ D ( roman_Ψ ), then

Ψ=[𝐈n𝟎n×m𝟎m×n𝐈mAB]D(Ψ).Ψmatrixsubscript𝐈𝑛subscript0𝑛𝑚subscript0𝑚𝑛subscript𝐈𝑚𝐴𝐵DΨ\Psi=\begin{bmatrix}\mathbf{I}_{n}&\mathbf{0}_{n\times m}\\\mathbf{0}_{m\times n}&\mathbf{I}_{m}\\A&B\end{bmatrix}\text{D}(\Psi)\>.roman_Ψ = [ start_ARG start_ROW start_CELL bold_I start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL start_CELL bold_0 start_POSTSUBSCRIPT italic_n × italic_m end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL bold_0 start_POSTSUBSCRIPT italic_m × italic_n end_POSTSUBSCRIPT end_CELL start_CELL bold_I start_POSTSUBSCRIPT italic_m end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL italic_A end_CELL start_CELL italic_B end_CELL end_ROW end_ARG ] D ( roman_Ψ ) .(10)

This state-update set and the successor set operation from (9) can be used to compute k+1subscript𝑘1\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT using zonoLAB as

zono(G_d, c_d)

Psi = [eye(n+m); A B]*D

Rkplus = [zeros(n) eye(n)]* and(Psi,cartProd(Rk,U),[eye(n+m) zeros(n)])

When comparing the use of (9) and (10) with the use of (6), it may appear that there are considerable disadvantages with the state-update set approach, namely k+1subscript𝑘1\mathcal{R}_{k+1}caligraphic_R start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT is only computed accurately if k×𝒰D(Ψ)subscript𝑘𝒰DΨ\mathcal{R}_{k}\times\mathcal{U}\subseteq\text{D}(\Psi)caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT × caligraphic_U ⊆ D ( roman_Ψ ) and the resulting set is a Zono (due to the use of generalized intersection in (9)) instead of the o object obtained when using (6) (assuming ksubscript𝑘\mathcal{R}_{k}caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and 𝒰𝒰\mathcal{U}caligraphic_U are o objects). However, the use of state-update sets (and set-based mappings in general) allows reachability analysis based on (9) to be easily extended to hybrid systems (including MLD and PWA systems) and nonlinear systems. Additionally, as discussed in [29], state-update sets can also be used to compute precursor sets for backward reachability analysis. The following sections demonstrate how set-based mappings (including state-update sets) provide a unifying framework for several different applications of reachability analysis.

IV Reachability Analysis Examples

The purpose of this section is to demonstrate how zonoLAB can be used to conduct reachability analysis of several different types of systems using the unique capabilities of the hybrid zonotope representation.

IV-A MLD and PWA System Analysis

Based on the work from [5], zonoLAB can compute the reachable sets of MLD systems, a modeling framework combining continuous and binary variables with logical relations in mixed-integer inequalities to express complex dynamic systems [33]. A linear discrete-time MLD system is expressed as

xk+1=Asubscript𝑥𝑘1𝐴\displaystyle x_{k+1}=Aitalic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_Axk+Buuk+Bwwk+Baff,subscript𝑥𝑘subscript𝐵𝑢subscript𝑢𝑘subscript𝐵𝑤subscript𝑤𝑘subscript𝐵𝑎𝑓𝑓\displaystyle x_{k}+B_{u}u_{k}+B_{w}w_{k}+B_{aff}\>,italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_B start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_B start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT italic_w start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_B start_POSTSUBSCRIPT italic_a italic_f italic_f end_POSTSUBSCRIPT ,(11a)
s.t.Exs.t.subscript𝐸𝑥\displaystyle\text{s.t.}\>\>\>E_{x}s.t. italic_E start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPTxk+Euuk+EwwkEaff,subscript𝑥𝑘subscript𝐸𝑢subscript𝑢𝑘subscript𝐸𝑤subscript𝑤𝑘subscript𝐸𝑎𝑓𝑓\displaystyle x_{k}+E_{u}u_{k}+E_{w}w_{k}\leq E_{aff}\>,italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_E start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_E start_POSTSUBSCRIPT italic_w end_POSTSUBSCRIPT italic_w start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ≤ italic_E start_POSTSUBSCRIPT italic_a italic_f italic_f end_POSTSUBSCRIPT ,(11b)

where xnxc×{0,1}nxl𝑥superscriptsubscript𝑛𝑥𝑐superscript01subscript𝑛𝑥𝑙x\in\mathbb{R}^{n_{xc}}\times\{0,1\}^{n_{xl}}italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × { 0 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x italic_l end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are the system states, unuc×{0,1}nul𝑢superscriptsubscript𝑛𝑢𝑐superscript01subscript𝑛𝑢𝑙u\in\mathbb{R}^{n_{uc}}\times\{0,1\}^{n_{ul}}italic_u ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_u italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × { 0 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_u italic_l end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are the control inputs, and wnrc×{0,1}nrl𝑤superscriptsubscript𝑛𝑟𝑐superscript01subscript𝑛𝑟𝑙w\in\mathbb{R}^{n_{rc}}\times\{0,1\}^{n_{rl}}italic_w ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_r italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × { 0 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_r italic_l end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are auxiliary variables. The number of inequality constraints is denoted by nesubscript𝑛𝑒n_{e}italic_n start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT such that Eaffnesubscript𝐸𝑎𝑓𝑓superscriptsubscript𝑛𝑒E_{aff}\in\mathbb{R}^{n_{e}}italic_E start_POSTSUBSCRIPT italic_a italic_f italic_f end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_e end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. Assuming knowledge of A, , , ff, , , , and ff along with the sets Rk and U (such that xkksubscript𝑥𝑘subscript𝑘x_{k}\in\mathcal{R}_{k}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT and uk𝒰subscript𝑢𝑘𝒰u_{k}\in\mathcal{U}italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_U), the compact set W (such that wk𝒲nrc×{0,1}nrlsubscript𝑤𝑘𝒲superscriptsubscript𝑛𝑟𝑐superscript01subscript𝑛𝑟𝑙w_{k}\in\mathcal{W}\subset{\mathbb{R}^{n_{rc}}}\times\{0,1\}^{n_{rl}}italic_w start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_W ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_r italic_c end_POSTSUBSCRIPT end_POSTSUPERSCRIPT × { 0 , 1 } start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_r italic_l end_POSTSUBSCRIPT end_POSTSUPERSCRIPT must also be provided.444The set W can be generated automatically using the modeling tool Hybrid System DEscription Language (HYSDEL) [34]. Using zonoLAB, the successor set for the MLD system is computed as

lus = stepMLD(Rk,U,W,A,B_u,B_w,B_aff, E_x,E_u,E_w,E_aff)

using affine mappings (*), Minkowski sums (+), and generalized halfspace intersections (fspaceIntersection) following the procedure from [5] as

= size(E_aff,1)

V = [B_u; E_u]*U + [B_w; E_w]*W + [B_aff;zeros(nE,1)]

Y = [A; E_x]*Rk + V

H = eye(nE)

f = E_aff

M = [zeros(nE,Rk.n) eye(nE)]

Rkplus = [eye(Rk.n) zeros(Rk.n,nE)]* halfspaceIntersection(Y,H,f,M)

While MLD and PWA systems are equivalent [35], it may be more computationally-efficient to compute the reachable set of a PWA system directly. Using zonoLAB, state update sets ΨisubscriptΨ𝑖\Psi_{i}roman_Ψ start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT can be defined as in (10) using the linear dynamics over a domain Disubscript𝐷𝑖D_{i}italic_D start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT, where Disubscript𝐷𝑖D_{i}italic_D start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT corresponds to the ithsuperscript𝑖𝑡i^{th}italic_i start_POSTSUPERSCRIPT italic_t italic_h end_POSTSUPERSCRIPT convex polytope of the PWA system. For a two-state autonomous system with two regions of linear dynamics, the one-set reachable set can be computed using

1 = [eye(2);Ad1]*D1 + [zeros(2,1);Bd1]

Psi2 = [eye(2);Ad2]*D2 + [zeros(2,1);Bd2]

Psi = union(Psi1,Psi2)

Rkplus = [zeros(2) eye(2)]*and(Psi,Rk,[eye(2) zeros(2)])

Fig. 2 shows the reachable sets for the two-equilibrium example system from [5]. Represented as either an MLD system, generated using HYSDEL [34], or as a PWA system, the resulting reachable sets computed using the mpleTwoEqilibrium.m file provided with zonoLAB are the same. The reachable sets computed using the PWA representation have slightly more continuous generators and constraints but do not require the definition and bounding of auxiliary variables as in the MLD representation.

A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (2)

IV-B Closed-loop MPC Analysis

Based on the work from [21], hybrid zonotopes can exactly represent the piecewise linear feedback control law associated with linear MPC formulations of the form

minu,xxNQN2+k=0N1xkQ2+ukR2,subscript𝑢𝑥subscriptsuperscriptnormsubscript𝑥𝑁2subscript𝑄𝑁superscriptsubscript𝑘0𝑁1superscriptsubscriptnormsubscript𝑥𝑘𝑄2subscriptsuperscriptnormsubscript𝑢𝑘2𝑅\min_{u,x}\|x_{N}\|^{2}_{Q_{N}}+\sum_{k=0}^{N-1}\|x_{k}\|_{Q}^{2}+\|u_{k}\|^{2%}_{R},\hskip 30.0ptroman_min start_POSTSUBSCRIPT italic_u , italic_x end_POSTSUBSCRIPT ∥ italic_x start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_Q start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT end_POSTSUBSCRIPT + ∑ start_POSTSUBSCRIPT italic_k = 0 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT italic_N - 1 end_POSTSUPERSCRIPT ∥ italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∥ start_POSTSUBSCRIPT italic_Q end_POSTSUBSCRIPT start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT + ∥ italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∥ start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_R end_POSTSUBSCRIPT ,(12)
s.t.xk+1=Axk+Buk,uk𝒰k{0,,N1},xk𝒳k{1,,N1},xN𝒳N,\begin{split}&\\&\>\>\text{s.t. }x_{k+1}=Ax_{k}+Bu_{k}\>,\>u_{k}\in\mathcal{U}\>\forall\>k\in%\{0,\dots,N-1\}\>,\\&\quad\quad x_{k}\in\mathcal{X}\>\forall\>k\in\{1,\dots,N-1\}\>,\>x_{N}\in%\mathcal{X}_{N}\>,\end{split}start_ROW start_CELL end_CELL start_CELL end_CELL end_ROW start_ROW start_CELL end_CELL start_CELL s.t. italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_A italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT + italic_B italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_U ∀ italic_k ∈ { 0 , … , italic_N - 1 } , end_CELL end_ROW start_ROW start_CELL end_CELL start_CELL italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ caligraphic_X ∀ italic_k ∈ { 1 , … , italic_N - 1 } , italic_x start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT ∈ caligraphic_X start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT , end_CELL end_ROW

where xknxsubscript𝑥𝑘superscriptsubscript𝑛𝑥x_{k}\in\mathbb{R}^{n_{x}}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT end_POSTSUPERSCRIPT is the state vector and uknusubscript𝑢𝑘superscriptsubscript𝑛𝑢u_{k}\in\mathbb{R}^{n_{u}}italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT end_POSTSUPERSCRIPT is the input vector, related by linear dynamics with Anx×nx𝐴superscriptsubscript𝑛𝑥subscript𝑛𝑥A\in\mathbb{R}^{{n_{x}}\times{n_{x}}}italic_A ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and Bnx×nu𝐵superscriptsubscript𝑛𝑥subscript𝑛𝑢B\in\mathbb{R}^{{n_{x}}\times{n_{u}}}italic_B ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT end_POSTSUPERSCRIPT. The sampled state of the system is x0subscript𝑥0x_{0}italic_x start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT. The inputs, predicted states, and predicted terminal state are constrained to the convex polytopic sets 𝒰nu𝒰superscriptsubscript𝑛𝑢\mathcal{U}\subset\mathbb{R}^{n_{u}}caligraphic_U ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_u end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, 𝒳nx𝒳superscriptsubscript𝑛𝑥\mathcal{X}\subseteq\mathbb{R}^{n_{x}}caligraphic_X ⊆ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT end_POSTSUPERSCRIPT, and 𝒳N𝒳subscript𝒳𝑁𝒳\mathcal{X}_{N}\subseteq\mathcal{X}caligraphic_X start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT ⊆ caligraphic_X and are penalized in the quadratic cost function with weight matrices R0succeeds𝑅0R\succ 0italic_R ≻ 0, Q0succeeds-or-equals𝑄0Q\succeq 0italic_Q ⪰ 0, and QN0succeeds-or-equalssubscript𝑄𝑁0Q_{N}\succeq 0italic_Q start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT ⪰ 0, respectively. To demonstrate this capability, the mpleDoubleIntegrator.m file provided with zonoLAB computes and plots the MPC control law as a hybrid zonotope for the double integrator example from [21].

To perform closed-loop reachability analysis of MPC, the open-loop state-update set ΨΨ\Psiroman_Ψ from (8) can be combined with the hybrid zonotope representation of the feedback control law (referred to as the state-input map in [23]). It is assumed that the hybrid zonotope Θn+mΘsuperscript𝑛𝑚\Theta\subset\mathbb{R}^{n+m}roman_Θ ⊂ blackboard_R start_POSTSUPERSCRIPT italic_n + italic_m end_POSTSUPERSCRIPT maps the measured state xksubscript𝑥𝑘x_{k}italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT to the applied control input uksubscript𝑢𝑘u_{k}italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT such that (xk,uk)Θsubscript𝑥𝑘subscript𝑢𝑘Θ(x_{k},u_{k})\in\Theta( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ) ∈ roman_Θ and is defined over a domain D(Θ)𝐷ΘD(\Theta)italic_D ( roman_Θ ) such that kD(Θ)subscript𝑘𝐷Θ\mathcal{R}_{k}\subseteq D(\Theta)caligraphic_R start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ⊆ italic_D ( roman_Θ ) for all k𝑘kitalic_k. Then, the closed-loop state-update set Φ2nΦsuperscript2𝑛\Phi\subset\mathbb{R}^{2n}roman_Φ ⊂ blackboard_R start_POSTSUPERSCRIPT 2 italic_n end_POSTSUPERSCRIPT such that (xk,xk+1)Φsubscript𝑥𝑘subscript𝑥𝑘1Φ(x_{k},x_{k+1})\in\Phi( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT ) ∈ roman_Φ is computed as

Φ=[𝐈n0n×m𝟎n𝟎n0n×m𝐈n](Ψ[In+m0n]Θ).Φmatrixsubscript𝐈𝑛subscript0𝑛𝑚subscript0𝑛subscript0𝑛subscript0𝑛𝑚subscript𝐈𝑛subscriptdelimited-[]subscriptI𝑛𝑚subscript0𝑛ΨΘ\Phi=\begin{bmatrix}\mathbf{I}_{n}&\textbf{0}_{n\times m}&\mathbf{0}_{n}\\\mathbf{0}_{n}&\textbf{0}_{n\times m}&\mathbf{I}_{n}\end{bmatrix}\big{(}\Psi%\cap_{[\textbf{I}_{n+m}~{}\textbf{0}_{n}]}\Theta\big{)}\>.roman_Φ = [ start_ARG start_ROW start_CELL bold_I start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL start_CELL 0 start_POSTSUBSCRIPT italic_n × italic_m end_POSTSUBSCRIPT end_CELL start_CELL bold_0 start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL end_ROW start_ROW start_CELL bold_0 start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL start_CELL 0 start_POSTSUBSCRIPT italic_n × italic_m end_POSTSUBSCRIPT end_CELL start_CELL bold_I start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT end_CELL end_ROW end_ARG ] ( roman_Ψ ∩ start_POSTSUBSCRIPT [ I start_POSTSUBSCRIPT italic_n + italic_m end_POSTSUBSCRIPT 0 start_POSTSUBSCRIPT italic_n end_POSTSUBSCRIPT ] end_POSTSUBSCRIPT roman_Θ ) .(13)

In addition to forward reachability analysis, this closed-loop state-update set can also be used for backward reachability analysis. For example, in [29], backward reachable sets were used to compute the maximal positive invariant set of a closed-loop system under an MPC control law.

To represent MPC formulations beyond the form of (12), neural networks can be used to approximate the MPC control policies [23, 36], where representing neural networks as hybrid zonotopes is presented in the following section.

IV-C Neural Network Representation

Based on the work from [22], zonoLAB can exactly represent the input-output mapping of an L𝐿Litalic_L-layered, ReLU-based, feed-forward, fully-connected neural network f:nm:𝑓superscript𝑛superscript𝑚f:\mathbb{R}^{n}\rightarrow\mathbb{R}^{m}italic_f : blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT → blackboard_R start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT mapping inputs xn𝑥superscript𝑛x\in\mathbb{R}^{n}italic_x ∈ blackboard_R start_POSTSUPERSCRIPT italic_n end_POSTSUPERSCRIPT to outputs y=f(x)m𝑦𝑓𝑥superscript𝑚y=f(x)\in\mathbb{R}^{m}italic_y = italic_f ( italic_x ) ∈ blackboard_R start_POSTSUPERSCRIPT italic_m end_POSTSUPERSCRIPT such that

x0=x,x+1=ϕ(Wx+b),{0,,L1},y=f(x)=WLxL+bL,\displaystyle\begin{split}x^{0}&=x\>,\\x^{\ell+1}&=\phi(W^{\ell}x^{\ell}+b^{\ell})\>,\quad{\ell}\in\{0,\dots,L-1\}\>,%\\y=f(x)&=W^{L}x^{L}+b^{L}\>,\end{split}start_ROW start_CELL italic_x start_POSTSUPERSCRIPT 0 end_POSTSUPERSCRIPT end_CELL start_CELL = italic_x , end_CELL end_ROW start_ROW start_CELL italic_x start_POSTSUPERSCRIPT roman_ℓ + 1 end_POSTSUPERSCRIPT end_CELL start_CELL = italic_ϕ ( italic_W start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT italic_x start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT + italic_b start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ) , roman_ℓ ∈ { 0 , … , italic_L - 1 } , end_CELL end_ROW start_ROW start_CELL italic_y = italic_f ( italic_x ) end_CELL start_CELL = italic_W start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT italic_x start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT + italic_b start_POSTSUPERSCRIPT italic_L end_POSTSUPERSCRIPT , end_CELL end_ROW(14)

where Wn+1×nsuperscript𝑊superscriptsubscript𝑛1subscript𝑛W^{\ell}\in\mathbb{R}^{n_{\ell+1}\times n_{\ell}}italic_W start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT roman_ℓ + 1 end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_POSTSUPERSCRIPT and bn+1superscript𝑏superscriptsubscript𝑛1b^{\ell}\in\mathbb{R}^{n_{\ell+1}}italic_b start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT roman_ℓ + 1 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT are the weight matrix and bias vector, respectively, between layers \ellroman_ℓ and +11\ell+1roman_ℓ + 1, with n0=nsubscript𝑛0𝑛n_{0}=nitalic_n start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT = italic_n and nL+1=msubscript𝑛𝐿1𝑚n_{L+1}=mitalic_n start_POSTSUBSCRIPT italic_L + 1 end_POSTSUBSCRIPT = italic_m. All activation functions ϕitalic-ϕ\phiitalic_ϕ are ReLU functions that operate element-wise, i.e., for the pre-activation vector v+1=Wx+bn+1superscript𝑣1superscript𝑊superscript𝑥superscript𝑏superscriptsubscript𝑛1v^{\ell+1}=W^{\ell}x^{\ell}+b^{\ell}\in\mathbb{R}^{n_{\ell+1}}italic_v start_POSTSUPERSCRIPT roman_ℓ + 1 end_POSTSUPERSCRIPT = italic_W start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT italic_x start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT + italic_b start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT roman_ℓ + 1 end_POSTSUBSCRIPT end_POSTSUPERSCRIPT,

ϕ(v)=[φ(v1)φ(vn)],italic-ϕsuperscript𝑣superscriptdelimited-[]𝜑superscriptsubscript𝑣1𝜑subscriptsuperscript𝑣subscript𝑛top\phi(v^{\ell})=[\varphi(v_{1}^{\ell})\;\cdots\;\varphi(v^{\ell}_{n_{\ell}})]^{%\top}\>,italic_ϕ ( italic_v start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ) = [ italic_φ ( italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT ) ⋯ italic_φ ( italic_v start_POSTSUPERSCRIPT roman_ℓ end_POSTSUPERSCRIPT start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT roman_ℓ end_POSTSUBSCRIPT end_POSTSUBSCRIPT ) ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT ,(15)

where the ReLU function is defined as φ(vi)=max{0,vi}𝜑subscript𝑣𝑖0subscript𝑣𝑖\varphi(v_{i})=\max\{0,v_{i}\}italic_φ ( italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) = roman_max { 0 , italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT }. The key insight from [22] is that a single ReLU activation function xi=φ(vi)subscript𝑥𝑖𝜑subscript𝑣𝑖x_{i}=\varphi(v_{i})italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = italic_φ ( italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) can be represented as a hybrid zonotope Φ2Φsuperscript2\Phi\subset\mathbb{R}^{2}roman_Φ ⊂ blackboard_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT containing points [vixi]superscriptdelimited-[]subscript𝑣𝑖subscript𝑥𝑖top[v_{i}\;x_{i}]^{\top}[ italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT over a predetermined domain vi[a,a]subscript𝑣𝑖𝑎𝑎v_{i}\in[-a,a]italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ∈ [ - italic_a , italic_a ]. The user-defined parameter a>0𝑎0a>0italic_a > 0 is chosen large enough so that |vi|asubscript𝑣𝑖𝑎|v_{i}|\leq a| italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT | ≤ italic_a for all anticipated values of visubscript𝑣𝑖v_{i}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT. Specifically, a single ReLU activation function is represented as a hybrid zonotope with ng=4subscript𝑛𝑔4n_{g}=4italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT = 4 continuous generators, nb=1subscript𝑛𝑏1n_{b}=1italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT = 1 binary generator, and nc=2subscript𝑛𝑐2n_{c}=2italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 2 constraints. Over the domain 𝒳𝒳\mathcal{X}caligraphic_X such that x𝒳𝑥𝒳x\in\mathcal{X}italic_x ∈ caligraphic_X, the entire feed-forward ReLU neural network with nNsubscript𝑛𝑁n_{N}italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT ReLU activation functions is exactly represented as a hybrid zonotope \mathcal{F}caligraphic_F with ng=nx+4nNsubscript𝑛𝑔subscript𝑛𝑥4subscript𝑛𝑁n_{g}=n_{x}+4n_{N}italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT = italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT + 4 italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT continuous generators, nb=nNsubscript𝑛𝑏subscript𝑛𝑁n_{b}=n_{N}italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT = italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT binary generators, and nc=3nNsubscript𝑛𝑐3subscript𝑛𝑁n_{c}=3n_{N}italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT = 3 italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT constraints, assuming 𝒳𝒳\mathcal{X}caligraphic_X is a zonotope with nxsubscript𝑛𝑥n_{x}italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT generators.

Using zonoLAB, the hybrid zonotope representation of a neural network is computed as

,Y] = reluNN(X,Ws,bs,a)

where X is a o object with nxsubscript𝑛𝑥n_{x}italic_n start_POSTSUBSCRIPT italic_x end_POSTSUBSCRIPT generators defining the domain 𝒳𝒳\mathcal{X}caligraphic_X,Ws is a 1×L1𝐿1\times L1 × italic_L cell array containing the weight matrices, bs is a 1×L1𝐿1\times L1 × italic_L cell array containing the bias vectors, and a defines the domain for each reLU activation function. The output NN is the hybrid zonotope \mathcal{F}caligraphic_F such that (x,y)𝑥𝑦(x,y)\in\mathcal{F}( italic_x , italic_y ) ∈ caligraphic_F and the output Y is the set of outputs from the neural network produced by inputs in the set X.

Fig. 3 shows the nonlinear function f(x1,x2)=cos(x1)+sin(x2)𝑓subscript𝑥1subscript𝑥2subscript𝑥1subscript𝑥2f(x_{1},x_{2})=\cos(x_{1})+\sin(x_{2})italic_f ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ) = roman_cos ( italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT ) + roman_sin ( italic_x start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT ), the approximation of this function using a L=3𝐿3L=3italic_L = 3 level neural network with nN=40subscript𝑛𝑁40n_{N}=40italic_n start_POSTSUBSCRIPT italic_N end_POSTSUBSCRIPT = 40 total activation functions, the corresponding approximation error, and the exact representation of this neural network as a hybrid zonotope over the domain 𝒳={x2|x5}𝒳conditional-set𝑥superscript2subscriptnorm𝑥5\mathcal{X}=\{x\in\mathbb{R}^{2}\,|\,\|x\|_{\infty}\leq 5\}caligraphic_X = { italic_x ∈ blackboard_R start_POSTSUPERSCRIPT 2 end_POSTSUPERSCRIPT | ∥ italic_x ∥ start_POSTSUBSCRIPT ∞ end_POSTSUBSCRIPT ≤ 5 }, which corresponds to one of the examples from [22].

A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (3)
A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (4)
A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (5)
A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (6)

IV-D Nonlinear System Analysis

Based on the work from [28, 23], zonoLAB can bound nonlinear functions using hybrid zonotopes, which enables reachability analysis of systems with nonlinear dynamics. Considering a unary function y=f(x)𝑦𝑓𝑥y=f(x)italic_y = italic_f ( italic_x ) over the domain x[x¯,x¯]𝑥¯𝑥¯𝑥x\in[\underline{x},\overline{x}]\subset\mathbb{R}italic_x ∈ [ under¯ start_ARG italic_x end_ARG , over¯ start_ARG italic_x end_ARG ] ⊂ blackboard_R, the goal is to find a hybrid zonotope 𝒵hsubscript𝒵\mathcal{Z}_{h}caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT such that {(x,f(x))|x[x¯,x¯]}𝒵hconditional-set𝑥𝑓𝑥𝑥¯𝑥¯𝑥subscript𝒵\{(x,f(x))\,|\,x\in[\underline{x},\overline{x}]\}\subseteq\mathcal{Z}_{h}{ ( italic_x , italic_f ( italic_x ) ) | italic_x ∈ [ under¯ start_ARG italic_x end_ARG , over¯ start_ARG italic_x end_ARG ] } ⊆ caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT. The process used in [28, 23] starts by determining a set of nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT pairs (xi,f(xi)),i{1,,nv}subscript𝑥𝑖𝑓subscript𝑥𝑖𝑖1subscript𝑛𝑣(x_{i},f(x_{i})),\,i\in\{1,\dots,n_{v}\}( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT , italic_f ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ) , italic_i ∈ { 1 , … , italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT }, such that x1=x¯subscript𝑥1¯𝑥x_{1}=\underline{x}italic_x start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT = under¯ start_ARG italic_x end_ARG, xnv=x¯subscript𝑥subscript𝑛𝑣¯𝑥x_{n_{v}}=\overline{x}italic_x start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT = over¯ start_ARG italic_x end_ARG, and xi<xj,i<jformulae-sequencesubscript𝑥𝑖subscript𝑥𝑗for-all𝑖𝑗x_{i}<x_{j},\,\forall\,i<jitalic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT < italic_x start_POSTSUBSCRIPT italic_j end_POSTSUBSCRIPT , ∀ italic_i < italic_j. As described in Section III-B, these pairs can be stored in the vertex matrix V=[v1,,vnv]2×nv𝑉subscript𝑣1subscript𝑣subscript𝑛𝑣superscript2subscript𝑛𝑣V=[v_{1},\dots,v_{n_{v}}]\in\mathbb{R}^{2\times n_{v}}italic_V = [ italic_v start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT , … , italic_v start_POSTSUBSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUBSCRIPT ] ∈ blackboard_R start_POSTSUPERSCRIPT 2 × italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT end_POSTSUPERSCRIPT where vi=[xif(xi)]subscript𝑣𝑖superscriptdelimited-[]subscript𝑥𝑖𝑓subscript𝑥𝑖topv_{i}=[x_{i}\,f(x_{i})]^{\top}italic_v start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT = [ italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT italic_f ( italic_x start_POSTSUBSCRIPT italic_i end_POSTSUBSCRIPT ) ] start_POSTSUPERSCRIPT ⊤ end_POSTSUPERSCRIPT. The associated incidence matrix Mnv×nv1𝑀superscriptsubscript𝑛𝑣subscript𝑛𝑣1M\in\mathbb{R}^{n_{v}\times n_{v}-1}italic_M ∈ blackboard_R start_POSTSUPERSCRIPT italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT × italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT - 1 end_POSTSUPERSCRIPT can be defined to create a hybrid zonotope 𝒵vsubscript𝒵𝑣\mathcal{Z}_{v}caligraphic_Z start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT representing the union of the nv1subscript𝑛𝑣1n_{v}-1italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT - 1 line segments connecting neighboring vertices. While 𝒵vsubscript𝒵𝑣\mathcal{Z}_{v}caligraphic_Z start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT approximates the nonlinear function, to determine 𝒵hsubscript𝒵\mathcal{Z}_{h}caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT such that {(x,f(x))|x[x¯,x¯]}𝒵hconditional-set𝑥𝑓𝑥𝑥¯𝑥¯𝑥subscript𝒵\{(x,f(x))\,|\,x\in[\underline{x},\overline{x}]\}\subseteq\mathcal{Z}_{h}{ ( italic_x , italic_f ( italic_x ) ) | italic_x ∈ [ under¯ start_ARG italic_x end_ARG , over¯ start_ARG italic_x end_ARG ] } ⊆ caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT, a set \mathcal{E}caligraphic_E bounding the difference between this piecewise-linear approximation and the nonlinear function must identified to compute 𝒵h=𝒵vsubscript𝒵direct-sumsubscript𝒵𝑣\mathcal{Z}_{h}=\mathcal{Z}_{v}\oplus\mathcal{E}caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT = caligraphic_Z start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT ⊕ caligraphic_E. Processes for automating the choice of nvsubscript𝑛𝑣n_{v}italic_n start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT points, computing the error set \mathcal{E}caligraphic_E, and using functional decomposition to bound multi-input functions are currently under development [37] and will be included in future releases of zonoLAB. While applicable to nonlinear functions in general, this approach can also be used to determine hybrid zonotopes that bound 1) the open-loop state update set ΨΨ\Psiroman_Ψ from Section III-D for a system with nonlinear dynamics xk+1=f(xk,uk)subscript𝑥𝑘1𝑓subscript𝑥𝑘subscript𝑢𝑘x_{k+1}=f(x_{k},u_{k})italic_x start_POSTSUBSCRIPT italic_k + 1 end_POSTSUBSCRIPT = italic_f ( italic_x start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT , italic_u start_POSTSUBSCRIPT italic_k end_POSTSUBSCRIPT ), 2) nonlinear feedback control laws, and 3) input-output mappings for neural networks with nonlinear activation functions.

ngsubscript𝑛𝑔n_{g}italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPTnbsubscript𝑛𝑏n_{b}italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPTncsubscript𝑛𝑐n_{c}italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT|𝒯|𝒯|\mathcal{T}|| caligraphic_T |tplotsubscript𝑡𝑝𝑙𝑜𝑡t_{plot}italic_t start_POSTSUBSCRIPT italic_p italic_l italic_o italic_t end_POSTSUBSCRIPT (s)
0subscript0\mathcal{R}_{0}caligraphic_R start_POSTSUBSCRIPT 0 end_POSTSUBSCRIPT20000.2
1subscript1\mathcal{R}_{1}caligraphic_R start_POSTSUBSCRIPT 1 end_POSTSUBSCRIPT1034459381.1
2subscript2\mathcal{R}_{2}caligraphic_R start_POSTSUBSCRIPT 2 end_POSTSUBSCRIPT204881181083.6
3subscript3\mathcal{R}_{3}caligraphic_R start_POSTSUBSCRIPT 3 end_POSTSUBSCRIPT3051321771626.8
4subscript4\mathcal{R}_{4}caligraphic_R start_POSTSUBSCRIPT 4 end_POSTSUBSCRIPT40617623622612.4
5subscript5\mathcal{R}_{5}caligraphic_R start_POSTSUBSCRIPT 5 end_POSTSUBSCRIPT50722029530020.1
6subscript6\mathcal{R}_{6}caligraphic_R start_POSTSUBSCRIPT 6 end_POSTSUBSCRIPT60826435438429.2
7subscript7\mathcal{R}_{7}caligraphic_R start_POSTSUBSCRIPT 7 end_POSTSUBSCRIPT70930841351844.9
8subscript8\mathcal{R}_{8}caligraphic_R start_POSTSUBSCRIPT 8 end_POSTSUBSCRIPT81035247267262.9
9subscript9\mathcal{R}_{9}caligraphic_R start_POSTSUBSCRIPT 9 end_POSTSUBSCRIPT91139653198495.0
10subscript10\mathcal{R}_{10}caligraphic_R start_POSTSUBSCRIPT 10 end_POSTSUBSCRIPT10124405901568186.2
11subscript11\mathcal{R}_{11}caligraphic_R start_POSTSUBSCRIPT 11 end_POSTSUBSCRIPT11134846492666292.3
12subscript12\mathcal{R}_{12}caligraphic_R start_POSTSUBSCRIPT 12 end_POSTSUBSCRIPT12145287084732482.3

To demonstrate the ability to bound nonlinear functions and conduct closed-loop reachability analysis of nonlinear dynamic systems, Fig. 4 shows numerical results based on the example from [28], which is provided with zonoLAB in the mpleNonlinear.m file. This examples considers a two-state, one-input, discrete-time nonlinear system (where the dynamics include sin(x)𝑥\sin(x)roman_sin ( italic_x )) under feedback control based on a saturated Linear Quadratic Regulator (LQR). Fig. 4(a) shows the ability to approximate the sin(x)𝑥\sin(x)roman_sin ( italic_x ) function using 𝒵vsubscript𝒵𝑣\mathcal{Z}_{v}caligraphic_Z start_POSTSUBSCRIPT italic_v end_POSTSUBSCRIPT and bound the function using 𝒵hsubscript𝒵\mathcal{Z}_{h}caligraphic_Z start_POSTSUBSCRIPT italic_h end_POSTSUBSCRIPT, which is then used to produce the open-loop state update set ΨΨ\Psiroman_Ψ. Fig. 4(b) shows the saturated LQR control law represented as a hybrid zonotope, which is combined with ΨΨ\Psiroman_Ψ to create the closed-loop state update set ΦΦ\Phiroman_Φ. Fig. 4(c) shows the forward reachable sets of the closed-loop system for twelve time steps. Finally, for each reachable set, Table II shows ngsubscript𝑛𝑔n_{g}italic_n start_POSTSUBSCRIPT italic_g end_POSTSUBSCRIPT, nbsubscript𝑛𝑏n_{b}italic_n start_POSTSUBSCRIPT italic_b end_POSTSUBSCRIPT, ncsubscript𝑛𝑐n_{c}italic_n start_POSTSUBSCRIPT italic_c end_POSTSUBSCRIPT, |𝒯|𝒯|\mathcal{T}|| caligraphic_T |, and the computation time (on a standard desktop computer) to determine 𝒯𝒯\mathcal{T}caligraphic_T and plot the resulting constrained zonotopes, using the process described in Section III-C. Despite the large number of binary factors, it is relatively quick to identify the number of non-empty sets using GUROBI and to plot each set using linear programming to find each vertex and face. However, these results motivate the need for set representation complexity reduction based on methods from [38], which will be provided in future releases of zonoLAB.

V Conclusions

This paper introduced zonoLAB as a MATLAB toolbox using zonotopic set representations, including zonotopes, constrained zonotopes, and hybrid zonotopes, for the analysis of dynamic systems and their controllers. The zonoLAB toolbox provides a suite of computationally-efficient set-based operations that exploit the specific structures of these zonotopic set representations and user-friendly methods that package complex analysis into simple function calls. The use of hybrid zonotopes in particular provides a scalable approach to applications where sets of interest correspond to the union of convex polytopes. The zonoLAB toolbox currently includes the basic functionality for defining zonotopic sets and computing fundamental set operations along with several illustrative examples. Ongoing efforts aim to expand the capability of zonoLAB in areas such as representing neural networks with a variety of activation functions, functional decomposition methods for bounding nonlinear functions with hybrid zonotopes, and complexity reduction techniques for zonotopic sets.

References

  • [1]F.Blanchini and S.Miani, Set-Theoretic Methods in Control,2nded.Springer, 2015.
  • [2]F.Borrelli, A.Bemporad, and M.Morari, Predictive Control for linearand hybrid systems.Cambridge:Cambridge University Press, 2011.
  • [3]K.f*ckuda, “Lecture notes: Polyhedral Computation, Spring 2016,” 2016.
  • [4]J.K. Scott, D.M. Raimondo, G.R. Marseglia, and R.D. Braatz, “Constrainedzonotopes: A new tool for set-based estimation and fault detection,”Automatica, vol.69, pp. 126–136, 2016.
  • [5]T.J. Bird, H.C. Pangborn, N.Jain, and J.P. Koeln, “Hybrid zonotopes: anew set representation for reachability analysis of mixed logical dynamicalsystems,” Automatica, vol. 154, p. 111107, 2023.
  • [6]N.Kochdumper and M.Althoff, “Sparse Polynomial Zonotopes: A Novel SetRepresentation for Reachability Analysis,” IEEE Transactions onAutomatic Control, vol.66, no.9, pp. 4043–4058, 2021.
  • [7]S.Kousik, A.Dai, and G.X. Gao, “Ellipsotopes: Uniting Ellipsoids andZonotopes for Reachability Analysis and Fault Detection,” IEEETransactions on Automatic Control, vol.68, no.6, pp. 3440–3452, 2023.
  • [8]D.Silvestre, “Constrained Convex Generators: A Tool Suitable for Set-BasedEstimation with Range and Bearing Measurements,” IEEE Control SystemsLetters, vol.6, pp. 1610–1615, 2022.
  • [9]S.Sadraddini and R.Tedrake, “Linear Encodings for Polytope ContainmentProblems,” IEEE Conference on Decision and Control, pp. 4367–4372,2019.
  • [10]V.Raghuraman and J.P. Koeln, “Set operations and order reductions forconstrained zonotopes,” Automatica, vol. 139, 2022.
  • [11]X.Yang and J.K. Scott, “A comparison of zonotope order reductiontechniques,” Automatica, vol.95, pp. 378–384, 2018.
  • [12]M.Althoff, N.Kochdumper, and M.Wetzlinger, “CORA 2020 Manual,” pp.1–162, 2020.
  • [13]M.Kvasnica, J.Holaza, B.Takacs, and D.Ingole, “Design and verification oflow-complexity explicit MPC controllers in MPT3,” European ControlConference, pp. 2595–2600, 2015.
  • [14]S.Bak and P.S. Duggirala, “HyLAA: A Tool for ComputingSimulation-Equivalent Reachability for Linear Systems,” Proceedingsof the 20th International Conference on Hybrid Systems: Computation andControl, pp. 173–178, 2017.
  • [15]G.Frehse, C.LeGuernic, A.Donzé, S.Cotton, R.Ray, O.Lebeltel,R.Ripado, A.Girard, T.Dang, and O.Maler, “SpaceEx: Scalableverification of hybrid systems,” Lecture Notes in Computer Science(including subseries Lecture Notes in Artificial Intelligence and LectureNotes in Bioinformatics), vol. 6806 LNCS, pp. 379–395, 2011.
  • [16]P.J. Meyer, A.Devonport, and M.Arcak, “TIRA: Toolbox for intervalreachability analysis,” Proceedings of the 22nd ACM InternationalConference on Hybrid Systems: Computation and Control, pp. 224–229, 2019.
  • [17]S.Bogomolov, M.Forets, G.Frehse, K.Potomkin, and C.Schilling,“JuliaReach: A toolbox for set-based reachability,” Hybrid Systems:Computation and Control, 2019.
  • [18]M.Forets and C.Schilling, “LazySets.jl: Scalable Symbolic-Numeric SetComputations,” JuliaCon Proceedings, vol.1, no.1, 2021.
  • [19]A.P. Vinod, J.D. Gleason, and M.M.K. Oishi, “SReachTools: A MATLABStochastic Reachability Toolbox,” 22nd ACM International Conferenceon Hybrid Systems: Computation and Control, pp. 33–38, 2019.
  • [20]M.Althoff, G.Frehse, and A.Girard, “Set Propagation Techniques forReachability Analysis,” Annual Review of Control, Robotics, andAutonomous Systems, vol.4, no.1, pp. 1–27, 2021.
  • [21]T.J. Bird, N.Jain, H.C. Pangborn, and J.P. Koeln, “Set-Based Reachabilityand the Explicit Solution of Linear MPC using Hybrid Zonotopes,”American Control Conference, 2022.
  • [22]J.Ortiz, A.Vellucci, J.Koeln, and J.Ruths, “Hybrid Zonotopes ExactlyRepresent ReLU Neural Networks,” IEEE Conference on Decision andControl, 2023.
  • [23]J.A. Siefert, T.J. Bird, J.P. Koeln, N.Jain, and H.C. Pangborn,“Reachability Analysis of Nonlinear Systems Using Hybrid Zonotopes andFunctional Decomposition,” arXiv:2304.06827, 2023.
  • [24]P.Mcmullen, “On Zonotopes,” Transactions of the AmericanMathematical Society, vol. 159, pp. 91–109, 1971.
  • [25]A.Kulmburg and M.Althoff, “On the co-NP-completeness of the zonotopecontainment problem,” European Journal of Control, vol.62, pp.84–91, 2021.
  • [26]V.Raghuraman and J.P. Koeln, “Tube-based robust MPC with adjustableuncertainty sets using zonotopes,” American Control Conference,2021.
  • [27]T.J. Bird and N.Jain, “Unions and Complements of Hybrid Zonotopes,”IEEE Control Systems Letters, vol.6, pp. 1778–1783, 2022.
  • [28]J.A. Siefert, T.J. Bird, J.P. Koeln, N.Jain, and H.C. Pangborn,“Successor Sets of Discrete-time Nonlinear Systems Using HybridZonotopes,” American Control Conference, 2023.
  • [29]——, “Robust Successor and Precursor Sets of Hybrid Systems using HybridZonotopes,” IEEE Control Systems Letters, vol.7, pp. 355–360,2022.
  • [30]L.J. Guibas, A.Nguyen, and L.Zhang, “Zonotopes as bounding volumes,”Proceedings of the 14th annual ACM-SIAM symposium on discretealgorithms, 2003.
  • [31]G.vanden Bergen, “Proximity queries and penetration depth computation on 3dgame objects,” Game Developers Conference, 2001.
  • [32]L.L.C. GurobiOptimization, “Gurobi Optimizer Reference Manual,” 2016.
  • [33]A.Bemporad and M.Morari, “Control of systems integrating logic, dynamics,and constraints,” Automatica, vol.35, pp. 407–427, 1999.
  • [34]F.D. Torrisi and A.Bemporad, “HYSDEL - A tool for generating computationalhybrid models for analysis and synthesis problems,” IEEE Transactionson Control Systems Technology, vol.12, no.2, pp. 235–249, 2004.
  • [35]W.P. Heemels, B.DeSchutter, and A.Bemporad, “Equivalence of hybriddynamical models,” Automatica, vol.37, no.7, pp. 1085–1091, 2001.
  • [36]B.Karg and S.Lucia, “Efficient Representation and Approximation of ModelPredictive Control Laws via Deep Learning,” IEEE Transactions onCybernetics, vol.50, no.9, pp. 3866–3878, 2020.
  • [37]J.J. Glunt, J.A. Siefert, A.F. Thompson, and H.C. Pangborn, “Error Boundsfor Compositions of Piecewise Affine Approximations,”arXiv:2402.15601, 2024.
  • [38]T.J. Bird, “Hybrid Zonotopes: A Mixed-integer Set Representation for theAnalysis of Hybrid Systems,” Ph.D. Dissertation, School Mech. Eng.,Purdue University, West Lafayette, IN, 2022.
A MATLAB Toolbox for Set-based Control Systems Analysis Using Hybrid Zonotopes (2024)

References

Top Articles
Latest Posts
Article information

Author: Jeremiah Abshire

Last Updated:

Views: 6424

Rating: 4.3 / 5 (54 voted)

Reviews: 93% of readers found this page helpful

Author information

Name: Jeremiah Abshire

Birthday: 1993-09-14

Address: Apt. 425 92748 Jannie Centers, Port Nikitaville, VT 82110

Phone: +8096210939894

Job: Lead Healthcare Manager

Hobby: Watching movies, Watching movies, Knapping, LARPing, Coffee roasting, Lacemaking, Gaming

Introduction: My name is Jeremiah Abshire, I am a outstanding, kind, clever, hilarious, curious, hilarious, outstanding person who loves writing and wants to share my knowledge and understanding with you.