# siconos.kernel.RelayNSL (Python class)¶

class siconos.kernel.RelayNSL(size: unsigned int, lb: double = -1.0, ub: double = 1.0)[source]

Bases: siconos.kernel.NonSmoothLaw

Relay NonSmoothLaw.

This class formalizes the Relay nonsmooth law i.e.

\begin{array}{l} -y \in \mathcal{N}_{[lb,ub]}(\lambda), \end{array}

where $$lb$$ is the lower bound and $$ub$$ is the upper bound of the Relay law.

In this default case, the lower bound is set to $$lb=-1$$ and the upper bound ub is set to $$ub=1$$. We get the well-known form of the RelayNSL as the multivalued sign function, i.e.

\begin{array}{l} y \in -\mathcal{N}_{[-1,1]}(\lambda)\quad \Longleftrightarrow \quad\lambda \in -\mbox{sgn} (y) \end{array} where the multi-valued sign function is defined as
\mbox{sgn} (y) = \left\{ \begin{array}{lcl} 1 &\quad& y >0 \\ \,[-1,1] &\quad& y =0 \\ -1 &\quad& y <0 \\ \end{array}\right.

Generated class (swig), based on C++ header Program listing for file kernel/src/modelingTools/RelayNSL.hpp.

Constructors

RelayNSL(int size, double lb=-1.0, double ub=1.0)

constructor with the value of the RelayNSL attributes

Parameters: size – size of the NonSmoothLaw lb – lower endpoint of the interval, default value is -1.0 ub – upper endpoint of the interval, default value is 1.0
display() → None[source]

print the data to the screen

isVerified() → bool[source]

check the ns law to see if it is verified

Returns: true if the NS Law is verified, false otherwise
lb() → double[source]

to get lb

Returns: the value of lb
setLb(double lb) → None[source]

to set the lower bound

Parameters: lb – the new lower bound
setUb(double ub) → None[source]

to set ub

Parameters: ub – the new upper bound
ub() → double[source]

to get ub

Returns: the value of ub