MC++
Ellipsoidal Arithmetic for Factorable Functions
Author:
Mario E. Villanueva, Jai Rajyaguru, Boris Houska, Benoît Chachuat

The image of an \(n_x\)-dimensional ellipsoid \(\mathcal{E}_{x}:=\{ q_{x}+Q^{1/2}_{x}v \,\mid\, v\in\mathbb{R}^{n_x}, v^{\rm T}v\leq 1\}\) under the vector-valued function \( f:\mathbb{R}^{n_x}\to\mathbb{R}^{n_f} \) is defined as \( f(\mathcal{E}_{x}) := \{f(x) \,\mid\, x\in \mathcal{E}_{x} \} \). In general, such a set can not be computed exactly and thus we are interested on computing an ellipsoidal \( \mathcal{E}_{f}:= \{ q_{f} + Q^{1/2}_{f} \,\mid\, v\in\mathbb{R}^{n_x}, v^{\rm T}v\leq 1 \} \) enclosure such that \(\mathcal{E}_{f} \supseteq f(\mathcal{E}_{x}) \).

The classes mc::EllImg and mc::EllVar provide an implementation that is able to compute such an enclosure. We note that this is not a verified implementation in the sense that rounding errors are not accounted for.

The implementation of mc::EllImg and mc::EllVar relies on the operator/function overloading mechanism of C++. This makes the computation of the ellipsoidal enclosure for the image of an ellipsoid under a factorable function both simple and intuitive, similar to computing function values in real arithmetic or bounds based on interval, Taylor or Chebyshev model arithmetics (see Non-Verified Interval Arithmetic for Factorable Functions, Taylor Model Arithmetic for Factorable Functions, Chebyshev Model Arithmetic for Factorable Functions). mc::EllImg stores a column vector CPPL::dcovector and a sparse symmetric matrix CPPL::dssmatrix provided by the LAPACK wrapper CPPLAPACK. The column vector stores the center and the sparse symmetric matrix the shape of a lifted ellipsoid, which is the result of adding extra dimension for each operation participating in the factorable function.

The classes mc::EllImg and mc::EllVar are templated in the interval type used to bound the nonlinearity of the function, By default, mc::EllImg and mc::EllVar can be used with the non-verified interval type mc::Interval of MC++. For reliability, however, it is strongly recommended to use verified interval arithmetic such as PROFIL (header file mcprofil.hpp) or FILIB++ (header file mcfilib.hpp).

How do I compute an ellipsoidal enclosure for the image set of an ellipsoid under a factorable function?

Suppose that we want to compute an ellipsoidal enclosure for the image set of function:

\[ f(x) = \left(\begin{array}{c} \log(x_{1})+x^{2}_{2} \\ \sin(x_{1})-\cos(x_{2}) \\ \end{array} \right) \qquad \text{with} \qquad x \in \left\{ \left(\begin{array}{c} 3 \\ 4 \\ \end{array} \right)+ \left(\begin{array}{cc} 5 & 4 \\ 4 & 5 \\ \end{array} \right)^{1/2}v : v^{\rm T}v\leq 1 \right\} \]

.

For simplicity bounds are computed using the default interval type mc::Interval, the required header files are:

#include "ellimage.hpp"
#include "ellipsoid_cpplapack.hpp"
#include "interval.hpp"

typedef mc::Interval I     ;
typedef mc::EllImg<I> EI   ;
typedef mc::EllVar<I> EV   ;
typedef mc::Ellipsoid E    ;
typedef CPPL::dcovector dcv   ;
typedef CPPL::dsymatrix dsm   ;

First, the host ellipsoid for the independent variables ( \(x_{1}\) and \(x_{2}\)) is specified as:

dcv q0(2)   ;     dsm Q0(2)      ;
q0(0) = 3.  ;     Q0(0,0) = 5.   ;
q0(1) = 4.  ;     Q0(1,0) = 4.   ;  Q0(1,1) = 5.   ;

E Ex( Q0, q0 ) ;

Next the ellipsoidal enclosure \(\mathcal E_{f}\) and the independent variables \(x_{1}\) and \(x_{2}\) are defined by mc::EllImg and mc::EllVar objects respectively:

EI Eflift   ;
EV X[2]     ;

The next step is to initialize the ellipsoidal image using the ellipsoidal host set:

Eflift.set( E0 )  ;

An alternative way of initializing the ellipsoidal image is by passing the shape and centre directly.

Notice that the independent variables is given as an array. This array has to be introduced to the ellipsoidal enclosure as:

for( long i = 0 ; i < 2 ; ++i ) X[i].set(&Eflift , i  )  ; 

If independent interval bounds are known for each variable they can be passed as an optional third argument to the set function. The dependent f_{1}(x) and f_{2}(x) are defined as:

EV* F[2] = { log(X[0]) + mc::sqr(X[1]) , sin(X[0]) - cos(X[1]) }  ;

The lifted ellipsoid can be displayed to the standard output as:

std::cout << "lifted ellipsoidal image of f: " << Eflift << std::endl;
lifted ellipsoidal image of f:  

center: 
 3
 4
 18.5
 0.913697
 19.4137
 -0.0590929
 0.012758
 0.0718509

Shape: 
 9.46133 {7.56906}{60.5525}{4.07224}{64.6247}{2.82094}{-4.61268}{-7.43362}
 7.56906  9.46133 {75.6906}{3.25779}{78.9484}{3.52618}{-3.69015}{-7.21632}
 60.5525  75.6906  752.099 {26.0623}{778.161}{28.2094}{-29.5212}{-57.7306}
 4.07224  3.25779  26.0623  2.52547 {28.5878}{1.21416}{-1.98534}{-3.1995}
 64.6247  78.9484  778.161  28.5878  806.749 {29.4236}{-31.5065}{-60.9301}
 2.82094  3.52618  28.2094  1.21416  29.4236  4.40317 {-1.37529}{-5.77847}
 -4.61268  -3.69015  -29.5212  -1.98534  -31.5065  -1.37529  4.34584 {5.72113}
 -7.43362  -7.21632  -57.7306  -3.1995  -60.9301  -5.77847  5.72113  11.4996 

Finally, the ellipsoidal enclosure is obtained by projecting the dependent variables in the lifted ellipsoidal image, and is given as an mc::Ellipsoid object :

E Ef = Eflift.project( F , 2 );
std::cout << " Ellipsoidal enclosure Ef = " << Ef << std::endl;
Ellipsoidal enclosure Ef =

center:
 1.94137e+01
 7.18509e-02
shape:
 8.06749e+02 {-6.09301e+01}
 -6.09301e+01  1.14996e+01 

After this, the ellipsoid can be manipulated according to the rules of ellipsoidal calculus (see Ellipsoidal Calculus). A comparison between the exact image and the ellipsoidal enclosure is presented in the following figure, in orange the exact image and in blue the boundary of the ellipsoidal enclosure.

ELIMG1.png

How are the options set for the computation of an Ellipsoidal enclosure?

The class mc::EllImg has a public member called mc::EllImg::options that can be used to set/modify a number of options; e.g.,

   EIm.options.PREALLOCATE   = 5 ; 
   EIm.options.CHEBYSHEV_USE = false  ;

The available options are the following:

Options in mc::EllImg::Options: name, type and description
Name TypeDefault Description
PREALLOCATE unsigned long 0 Number of rows to preallocate in the shape matrix and center vector
CHEBYSHEV_USE bool false Whether to use Chebyshev expansion to compute a linear approximation and bound the nonlinear dependencies of univariate terms
CHEBYSHEV_ORDER unsigned int 5 Order of the Chebyshev expansion (only of CHEBYSHEV_USE = true)

Errors What errors can I encounter during computation of a Chebyshev model?

Errors are managed based on the exception handling mechanism of the C++ language. Each time an error is encountered, a class object of type mc::EllImg::Exceptions is thrown, which contains the type of error. It is the user's responsibility to test whether an exception was thrown during the computation of the lifted ellipsoid, and then make the appropriate changes. Should an exception be thrown and not caught by the calling program, the execution will abort.

Possible errors encountered during the computation of a Chebyshev model are:

Errors during the Computation of a Chebyshev Model
Number Description
1 Division by zero
2 Inverse operation with zero in domain
3 Log operation with non-positive numbers in domain
4 Square-root operation with negative numbers in domain
5 Tangent operation with zero in domain of cosine, tan(x) = sin(x)/cos(x)
6 Sine/Cosine inverse operation with domain outside [-1,1]
-1 Failed to construct Ellipsoidal variable
-3 Operation between Chebyshev variables linked to different Chebyshev models
-33 Feature not yet implemented in mc::EllImg

Moreover, exceptions may be thrown by the template parameter class itself.