Class MeritFunctionL2

java.lang.Object
org.hipparchus.optim.nonlinear.vector.constrained.MeritFunctionL2

public class MeritFunctionL2 extends Object
Implementation of the Augmented Lagrangian Merit Function.

This class implements the penalty function used for the line search procedure in Sequential Quadratic Programming (SQP), as described by Klaus Schittkowski (1982).

The function, often denoted as \(\Phi(x, v, r)\), combines the objective function with equality and inequality constraints using an Augmented Lagrangian formulation. This approach ensures that the search direction \(d\) generated by the QP subproblem is a descent direction for the merit function, provided the penalty parameters \(r_j\) are sufficiently large.

* @see Schittkowski (1982): On the convergence of a sequential quadratic programming method
  • Constructor Details

  • Method Details

    • update

      public void update(RealVector newJ, RealMatrix newJE, RealMatrix newJI, RealVector newX, RealVector newY, RealVector newDx, RealVector newU)
      Updates internal states with the results from the QP subproblem.

      This method must be called before performing a line search to ensure gradients and search directions are consistent with the current iterate.

      Parameters:
      newJ - Gradient of objective at current x
      newJE - Gradient of equality at current x
      newJI - Gradient of inequality at current x
      newX - Current iterate
      newY - Lagrange multipliers from the previous iteration
      newDx - Search direction solution from the QP subproblem
      newU - Multipliers solution from the QP subproblem
    • value0

      public double value0()
      Computes the merit function value at the current point (\(\alpha = 0\)). Internal helper for initialization and gradient consistency.
      Returns:
      current penalty value
    • value

      public double value(double alpha)
      Evaluate merit function for a given step alpha.

      Optimized version to minimize overhead while maintaining strict numerical consistency with the original backup summation order to prevent floating-point drift.

      Parameters:
      alpha - line search step length
      Returns:
      penalty value at x + alpha*dx
    • gradX

      public RealVector gradX()
      Computes the gradient of the merit function with respect to x.
      Returns:
      \(\nabla_x \Phi(x, v, r)\)
    • gradY

      public RealVector gradY()
      Computes the gradient of the merit function with respect to the multipliers y.
      Returns:
      \(\nabla_y \Phi(x, v, r)\)
    • updateRj

      public void updateRj(RealMatrix H, RealVector newY, RealVector newDx, RealVector newU, double sigmaValue, int iterations)
      Update the weight vector \(r_j\) (Penalty Parameters).

      This is a critical step in Schittkowski's algorithm. The penalty parameters \(r_j\) are updated after solving the QP subproblem but before the line search. They are chosen such that the search direction \(dx\) is a descent direction for the merit function: \(\nabla \Phi(x, v, r)^T d_{QP} < 0\).

      Parameters:
      H - Hessian Matrix (or its BFGS approximation)
      newY - last estimate of multipliers
      newDx - primal direction solution from QP
      newU - dual direction (multipliers) from QP
      sigmaValue - value of the additional slack variable in augmented QP
      iterations - current iteration count
    • resetRj

      public void resetRj()
      Resets the penalty parameters vector \(r\) to its initial values. Useful when the optimizer performs a restart or recovery from a bad step.
    • rUp

      public void rUp()
      Increases the penalty parameters globally. Used in augmented QP mode when the standard descent conditions are not met.
    • getR

      public RealVector getR()
      Returns the penalty parameters vector.
      Returns:
      vector r
    • getRmax

      public double getRmax()
      Returns the maximum allowed penalty value.
      Returns:
      rMax