Class PenaltyBarrierU_quadratic

Inheritance Relationships

Base Type

Class Documentation

class Mechatronix::PenaltyBarrierU_quadratic : public Mechatronix::PenaltyBarrierU_base

Piecewise quadratic penalty.

Public Functions

inline explicit PenaltyBarrierU_quadratic(string const &n)

Construct the penalty.

inline virtual void setup(real_type epsilon, real_type tolerance) override

Initialize the penalty internal parameters based on the values of \( h \) and \( \epsilon \)

Parameters
  • epsilon[in] value \( \epsilon \)

  • tolerance[in] value \( h \)

inline virtual real_type eval(real_type x) const override

Compute the penalty

\[\begin{split} p(x) = A_1 x^2 + A_2 \begin{cases} (x+H)^2 & x < -H \\[1em] 0 & x\in[-H,H] \\[1em] (x-H)^2 & x > H \end{cases} } \end{split}\]

where the parameters

\[ H=1-h,\qquad A_1 = \frac{\epsilon}{H^2}, \qquad A_2 = \frac{H^2-\epsilon}{H^2h^2}, \]

are precomputed after a call of method setup.

../_images/U_QUADRATIC2_0.jpeg

inline virtual real_type eval_D(real_type x) const override

First derivative of the penalty

../_images/U_QUADRATIC2_1.jpeg

inline virtual real_type eval_DD(real_type x) const override

Second derivative of the penalty

../_images/U_QUADRATIC2_2.jpeg

inline virtual real_type solve(real_type RHS) const override

Solve the problem \( p'(x) = r \)

\[\begin{split} x = \begin{cases} C_1 R-C_2 & R < -H \\[1em] R & R\in[-H,H] \\[1em] C_1 R+C_2 & R > H \end{cases}, \qquad R = \frac{r}{2A_1},\quad C_1 = \frac{A_1}{A_1+A_2},\quad C_2 = \frac{H\,A_2}{A_1+A_2}, \end{split}\]