001// Copyright (c) FIRST and other WPILib contributors.
002// Open Source Software; you can modify and/or share it under the terms of
003// the WPILib BSD license file in the root directory of this project.
004
005package org.wpilib.math.optimization.solver;
006
007import org.ejml.simple.SimpleMatrix;
008
009/** Solver iteration information exposed to an iteration callback. */
010public class IterationInfo {
011  /** The solver iteration. */
012  public final int iteration;
013
014  /** The decision variables (dense internal storage). */
015  public final SimpleMatrix x;
016
017  /** The gradient of the cost function (sparse internal storage). */
018  public final SimpleMatrix g;
019
020  /** The Hessian of the Lagrangian (sparse internal storage). */
021  public final SimpleMatrix H;
022
023  /** The equality constraint Jacobian (sparse internal storage). */
024  public final SimpleMatrix A_e;
025
026  /** The inequality constraint Jacobian (sparse internal storage). */
027  public final SimpleMatrix A_i;
028
029  /**
030   * Constructs iteration info.
031   *
032   * @param iteration The solver iteration.
033   * @param x The decision variables (dense internal storage).
034   * @param g The gradient of the cost function (sparse internal storage).
035   * @param H The Hessian of the Lagrangian (sparse internal storage).
036   * @param A_e The equality constraint Jacobian (sparse internal storage).
037   * @param A_i The inequality constraint Jacobian (sparse internal storage).
038   */
039  public IterationInfo(
040      int iteration,
041      SimpleMatrix x,
042      SimpleMatrix g,
043      SimpleMatrix H,
044      SimpleMatrix A_e,
045      SimpleMatrix A_i) {
046    this.iteration = iteration;
047    this.x = x;
048    this.g = g;
049    this.H = H;
050    this.A_e = A_e;
051    this.A_i = A_i;
052  }
053}