lucid  0.0.1
Lifting-based Uncertain Control Invariant Dynamics
Loading...
Searching...
No Matches
lucid::FourierBarrierCertificate Class Referencefinal

Barrier certificate using a Fourier basis as a template for the function. More...

#include <FourierBarrierCertificate.h>

Inheritance diagram for lucid::FourierBarrierCertificate:
lucid::BarrierCertificate

Public Member Functions

bool synthesize (int lattice_resolution, const Estimator &estimator, const TruncatedFourierFeatureMap &feature_map, const RectSet &X_bounds, const Set &X_init, const Set &X_unsafe, const FourierBarrierCertificateParameters &parameters={})
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
bool synthesize (const Optimiser &optimiser, int lattice_resolution, const Estimator &estimator, const TruncatedFourierFeatureMap &feature_map, const RectSet &X_bounds, const Set &X_init, const Set &X_unsafe, const FourierBarrierCertificateParameters &parameters={})
 Synthesize the barrier certificate.
 
const Vector & coefficients () const
 Get read-only access to the coefficients of the basis of the Fourier barrier certificate.
 
std::unique_ptr< BarrierCertificateclone () const override
 Clone the barrier certificate.
 
std::string to_string () const override
 Obtain the string representation of this object.
 
 BarrierCertificate (int T, double gamma, double eta=0, double c=0)
 Construct a new BarrierCertificate object.
 
- Public Member Functions inherited from lucid::BarrierCertificate
 BarrierCertificate (int T, double gamma, double eta=0, double c=0)
 Construct a new BarrierCertificate object.
 
double operator() (ConstVectorRef x) const
 Evaluate the barrier certificate at the given point.
 
bool is_synthesized () const
 Check whether the barrier certificate is synthesized.
 
double norm () const
 Get read-only access to the norm describing the complexity of the barrier of the barrier certificate.
 
double gamma () const
 Get read-only access to the \( \) \( \) \( \gamma \) \( \) \( \) value in the CBC definition of the barrier certificate.
 
double eta () const
 Get read-only access to the \( \) \( \) \( \eta \) \( \) \( \) value in the CBC definition of the barrier certificate.
 
double c () const
 Get read-only access to the \( c \) value in the CBC definition of the barrier certificate.
 
double safety () const
 Get read-only access to the safety probability of the system of the barrier certificate.
 
int T () const
 Get read-only access to the time horizon of the barrier certificate.
 

Private Member Functions

double apply_impl (ConstVectorRef x) const override
 Concrete implementation of operator()().
 
void optimiser_callback (bool success, double obj_val, const Vector &coefficients, double eta, double c, double norm, double b_norm)
 Utility function called by the optimiser when the synthesis is done.
 

Private Attributes

Vector coefficients_
 Coefficients of the Fourier basis.
 

Additional Inherited Members

- Protected Attributes inherited from lucid::BarrierCertificate
int T_
 Time horizon.
 
double gamma_
 \( \gamma \) value in the CBC definition
 
double eta_
 \( \eta \) value in the CBC definition
 
double c_
 \( c \) value in the CBC definition
 
double norm_
 Norm describing the complexity of the barrier. It is 0 if the barrier has not been synthesized.
 
double safety_
 Safety probability of the system. It is 0 if the barrier has not been synthesized.
 

Detailed Description

Barrier certificate using a Fourier basis as a template for the function.

The function is defined as follows:

\[B(x) = \phi_M(x)^T b = \alpha_0 + \sum_{j=1}^{M} \alpha_i \cos{\omega_i^T P(x)} + \beta_i \sin{\omega_i^T P(x)} \]

with

\[b = \begin{bmatrix} \frac{\alpha_0}{\sigma_f^2} & \frac{\alpha_1}{2 \sigma_f^2 \omega_1^2} & \frac{\beta_1}{2 \sigma_f^2 \omega_1^2} & \cdots & \frac{\alpha_M}{2 \sigma_f^2 \omega_M^2} & \frac{\beta_M}{2 \sigma_f^2 \omega_M^2} \end{bmatrix}^T \]

Todo
Add more details to the formulation, as there are some undefined symbols used.

Member Function Documentation

◆ apply_impl()

double lucid::FourierBarrierCertificate::apply_impl ( ConstVectorRef x) const
nodiscardoverrideprivatevirtual

Concrete implementation of operator()().

Parameters
xinput vector
Returns
value of the barrier certificate at the given point

Implements lucid::BarrierCertificate.

◆ BarrierCertificate()

lucid::BarrierCertificate::BarrierCertificate ( int T,
double gamma,
double eta = 0,
double c = 0 )
explicit

Construct a new BarrierCertificate object.

Precondition
T must be greater than 0.
gamma must be greater than or equal to 0.
eta must be greater than or equal to 0.
c must be greater than or equal to 0.
Parameters
Ttime horizon
gamma\( \gamma \) value in the CBC definition
eta\( \eta \) value in the CBC definition
c\( c \) value in the CBC definition

◆ clone()

std::unique_ptr< BarrierCertificate > lucid::FourierBarrierCertificate::clone ( ) const
nodiscardoverridevirtual

Clone the barrier certificate.

Create a new instance of the barrier certificate with the same parameters. If the barrier was synthesized, the new instance will have the same synthesis results.

Returns
new instance of the barrier certificate

Implements lucid::BarrierCertificate.

◆ coefficients()

const Vector & lucid::FourierBarrierCertificate::coefficients ( ) const
inlinenodiscard

Get read-only access to the coefficients of the basis of the Fourier barrier certificate.

Returns
coefficients of the basis of the Fourier barrier certificate

◆ optimiser_callback()

void lucid::FourierBarrierCertificate::optimiser_callback ( bool success,
double obj_val,
const Vector & coefficients,
double eta,
double c,
double norm,
double b_norm )
private

Utility function called by the optimiser when the synthesis is done.

Used to store the results of the synthesis into the barrier certificate object. If the synthesis was unsuccessful, the barrier is left unchanged.

Parameters
successtrue if the synthesis was successful
obj_valobjective value
coefficientscoefficients of the basis
eta\( \eta \) value
c\( c \) value
normactual norm of the barrier function
b_normtarget norm for the coefficients of the basis

◆ synthesize()

bool lucid::FourierBarrierCertificate::synthesize ( const Optimiser & optimiser,
int lattice_resolution,
const Estimator & estimator,
const TruncatedFourierFeatureMap & feature_map,
const RectSet & X_bounds,
const Set & X_init,
const Set & X_unsafe,
const FourierBarrierCertificateParameters & parameters = {} )

Synthesize the barrier certificate.

This is done in multiple steps.

Finding the bounds

First, we find some upper and lower bounds on the value the barrier certificate can assume over \( \texttip{\mathcal{X}}{Initial set}_0 \) and \( \texttip{\mathcal{X}}{Usafe set}_u \). For simplicity, we only explain the process for finding the upper bound over \( \texttip{\mathcal{X}}{Initial set}_0 \), but the same applies to the lower bound over \( \texttip{\mathcal{X}}{Initial set}_0 \) and bounds over \( \texttip{\mathcal{X}}{Usafe set}_u \). We can obtain the lower bound on \( \texttip{\mathcal{X}}{Initial set}_0 \) by using the following inequality:

\[B(x) \le \hat{B}^{\mathcal{X}_0}_{\tilde{N}}C_{\tilde{N}} + R^{\mathcal{\tilde{X}}\setminus\mathcal{X}_0}_{\tilde{N}}\underbrace{\frac{1}{\tilde{N}} \sum_{\bar{x} \in \Theta_{\tilde{N}}\setminus\mathcal{X}_0} D^n_{f_{\max}-\tilde{Q}-f_{\max}}(x - \bar{x})} _{A^{\mathcal{\tilde{X}\setminus\mathcal{X}_0}}_\tilde{N}} \quad \forall x \in \mathcal{X}_0 , \]

where \( R^{\mathcal{\tilde{X}}\setminus\mathcal{X}_0}_{\tilde{N}} = \max_{x \in \Theta_\tilde{N} \setminus \mathcal{X}_0}\{\phi_M(x)^Tb\} - \hat{B}_\tilde{N}^{\mathcal{X}_0} \) is the residual outside \( \texttip{\mathcal{X}}{Initial set}_0 \), and \( C_{\tilde{N}} = \left( 1 - \frac{2 f_{\max}}{\tilde{Q}} \right)^{-\frac{n}{2}} \). Note that we can find the upper bound \( A^{\mathcal{\tilde{X}\setminus\mathcal{X}_0}}_\tilde{N} \) by solving an optimisation problem before starting the synthesis, using, e.g., particle swarm optimisation (PSO).

Parameters
optimiserLP optimiser to use for the synthesis
lattice_resolutionnumber of lattice points on periodic domain per dimension
estimatorestimator model to compute the value of the feature map on @xp
feature_mapfeature map to apply to the lattice points
X_boundsbounds of the set \( \texttip{\mathcal{X}}{Polish sample vector space} \)
X_initinitial set \( \texttip{\mathcal{X}}{Initial set}_0 \)
X_unsafeunsafe set \( \texttip{\mathcal{X}}{Usafe set}_u \)
parametersparameters for barrier synthesis
Returns
true if the synthesis was successful
false if no solution was found

◆ to_string()

std::string lucid::FourierBarrierCertificate::to_string ( ) const
nodiscardoverridevirtual

Obtain the string representation of this object.

Returns
string representation of this object

Reimplemented from lucid::BarrierCertificate.


The documentation for this class was generated from the following files: