Skip to main content
`Ctrl`+`K`
scipy.optimize.

# linprog_verbose_callback

scipy.optimize.linprog_verbose_callback(res)

  A sample callback function demonstrating the linprog callback interface. This callback produces detailed output to sys.stdout before each iteration and after the final iteration of the simplex algorithm.

  Parameters:
    resA `scipy.optimize.OptimizeResult` consisting of the following fields:
      x1-D array

        The independent variable vector which optimizes the linear programming problem.

      funfloat

        Value of the objective function.

      successbool

        True if the algorithm succeeded in finding an optimal solution.

      slack1-D array

        The values of the slack variables. Each slack variable corresponds to an inequality constraint. If the slack is zero, then the corresponding constraint is active.

      con1-D array

        The (nominally zero) residuals of the equality constraints, that is, `b - A_eq @ x`

      phaseint

        The phase of the optimization being executed. In phase 1 a basic feasible solution is sought and the T has an additional row representing an alternate objective function.

      statusint

        An integer representing the exit status of the optimization:

        `0` : Optimization terminated successfully

        `1` : Iteration limit reached

        `2` : Problem appears to be infeasible

        `3` : Problem appears to be unbounded

        `4` : Serious numerical difficulties encountered

      nitint

        The number of iterations performed.

      messagestr

        A string descriptor of the exit status of the optimization.