MathOptInterface wrapper

Argos.jl provides a utility to pass the nonlinear problem encoded by a Argos.AbstractNLPEvaluator to a MathOptInterface (MOI) optimization problem. Hence, we can solve the optimal power flow problem using any nonlinear optimization solver compatible with MOI (Ipopt, Knitro, ALGENCAN, ...).

Once the MOI optimizer is set up properly, passing the optimizer to Argos simply amounts to calling the function Argos.optimize!. For example, solving an optimal power flow problem in the full-space amounts to:

using MathOptInterface
using Argos, Ipopt
const MOI = MathOptInterface

# Import data
datafile = joinpath(INSTANCES_DIR, "case57.m")
flp = Argos.FullSpaceEvaluator(datafile)
# Set-up MOI
optimizer = Ipopt.Optimizer()
MOI.set(optimizer, MOI.RawOptimizerAttribute("print_level"), 5)
MOI.set(optimizer, MOI.RawOptimizerAttribute("tol"), 1e-5)
# Solve
solution = Argos.optimize!(optimizer, flp)
MOI.empty!(optimizer)

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit https://github.com/coin-or/Ipopt
******************************************************************************

This is Ipopt version 3.14.17, running with linear solver MUMPS 5.7.3.

Number of nonzeros in equality constraint Jacobian...:      773
Number of nonzeros in inequality constraint Jacobian.:      707
Number of nonzeros in Lagrangian Hessian.............:      503

Total number of variables............................:      119
                     variables with only lower bounds:        0
                variables with lower and upper bounds:       63
                     variables with only upper bounds:        0
Total number of equality constraints.................:      106
Total number of inequality constraints...............:      168
        inequality constraints with only lower bounds:        0
   inequality constraints with lower and upper bounds:        8
        inequality constraints with only upper bounds:      160

iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
   0  5.1392900e+04 4.58e-01 1.66e+00  -1.0 0.00e+00    -  0.00e+00 0.00e+00   0
   1  5.0431136e+04 3.53e-01 1.86e+01  -1.0 7.74e-01    -  6.03e-01 2.26e-01f  1
   2  4.5340875e+04 9.45e-02 6.25e+01  -1.0 1.77e+00    -  2.89e-01 7.44e-01f  1
   3  4.2328165e+04 6.47e-03 3.67e+00  -1.0 1.12e+00    -  9.90e-01 1.00e+00f  1
   4  4.1907573e+04 2.72e-03 1.93e-01  -1.0 4.06e-01    -  9.90e-01 1.00e+00h  1
   5  4.1934465e+04 3.52e-05 2.83e-03  -1.0 5.60e-02    -  1.00e+00 1.00e+00h  1
   6  4.1794266e+04 4.19e-04 2.32e+00  -2.5 2.36e-01    -  9.34e-01 1.00e+00h  1
   7  4.1762805e+04 1.74e-04 4.57e-03  -2.5 2.32e-01    -  1.00e+00 1.00e+00h  1
   8  4.1748993e+04 3.10e-04 1.14e-01  -3.8 1.76e-01    -  8.65e-01 1.00e+00h  1
   9  4.1740509e+04 3.73e-04 8.34e-04  -3.8 1.29e-01    -  1.00e+00 1.00e+00h  1
iter    objective    inf_pr   inf_du lg(mu)  ||d||  lg(rg) alpha_du alpha_pr  ls
  10  4.1739482e+04 5.72e-05 4.93e-05  -3.8 3.75e-02    -  1.00e+00 1.00e+00h  1
  11  4.1737919e+04 5.94e-05 1.77e-03  -5.7 3.32e-02    -  9.07e-01 9.83e-01h  1
  12  4.1737788e+04 1.14e-05 8.12e-06  -5.7 1.26e-02    -  1.00e+00 1.00e+00h  1
  13  4.1737803e+04 1.11e-06 8.45e-07  -5.7 4.26e-03    -  1.00e+00 1.00e+00h  1
  14  4.1737787e+04 1.58e-07 3.39e-06  -8.6 1.47e-03    -  9.99e-01 9.97e-01h  1
  15  4.1737787e+04 3.71e-10 3.05e-10  -8.6 8.02e-05    -  1.00e+00 1.00e+00h  1

Number of Iterations....: 15

                                   (scaled)                 (unscaled)
Objective...............:   1.2780896042182480e+01    4.1737786745449193e+04
Dual infeasibility......:   3.0547981267378921e-10    9.9758665075889075e-07
Constraint violation....:   3.7133185415427761e-10    3.7133185415427761e-10
Variable bound violation:   3.5252853969325315e-09    3.5252853969325315e-09
Complementarity.........:   3.1090481493953218e-09    1.0153027472605639e-05
Overall NLP error.......:   3.1090481493953218e-09    1.0153027472605639e-05


Number of objective function evaluations             = 16
Number of objective gradient evaluations             = 16
Number of equality constraint evaluations            = 16
Number of inequality constraint evaluations          = 16
Number of equality constraint Jacobian evaluations   = 16
Number of inequality constraint Jacobian evaluations = 16
Number of Lagrangian Hessian evaluations             = 15
Total seconds in IPOPT                               = 6.462

EXIT: Optimal Solution Found.