CUTEst tutorial

This tutorial shows how to solve a problem from CUTEst.jl with Penelopt.jl.

Inequality Constraints

Penelopt.jl solves problems of the form minimize f(x) s.t. c(x) = 0. Therefore, choose a CUTEst problem containing only equality constraints.

1. Load a CUTEst problem

In this example, we use the Hock–Schittkowski problem HS6.

using CUTEst

nlp = CUTEstModel("HS6")

2. Solve with Penelopt

using Penelopt

stats = L2Penalty(nlp; print_level = 1)
┌ Info: 
This is Penelopt.jl v0.1.0.
Running with linear solver LDLFactorizations.jl v0.10.2.

  Problem name: HS6
   All variables: ████████████████████ 2      All constraints: ████████████████████ 1
            free: ████████████████████ 2                 free: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
           lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0                lower: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
           upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0                upper: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
         low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0              low/upp: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
           fixed: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0                fixed: ████████████████████ 1
          infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0               infeas: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
            nnzh: ( 66.67% sparsity)   1               linear: ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 0
                                                    nonlinear: ████████████████████ 1
                                                         nnzj: (  0.00% sparsity)   2
                                                     lin_nnzj: (------% sparsity)
                                                     nln_nnzj: (  0.00% sparsity)   2


[ Info: ------------------------------------------------------------------------------------------------------
[ Info: Iter   sIter  Objective       pfeas       dfeas       τ           ptol        dtol        ‖x‖
[ Info: ------------------------------------------------------------------------------------------------------
[ Info: 0      0      +4.8400000e+00  8.15e+00    4.40e+00    1.00e+00    1.00e+00    8.15e-02    1.56e+00
[ Info: 1      7      +5.9658917e-03  2.13e-01    5.60e-02    1.00e+00    2.13e-03    5.60e-04    1.24e+00
[ Info: 2      2      +4.0311094e-07  1.30e-03    4.59e-04    1.00e+00    1.30e-05    4.59e-06    1.41e+00
[ Info: 3      2      +2.3024446e-15  9.81e-10    3.85e-08    1.00e+00    8.05e-08    1.36e-07    1.41e+00
┌ Info: 
Number of Iterations: 3


Objective...........: +2.302444565942107e-15
Primal Feasibility..:  9.806977452342380e-10
Dual Feasibility....:  3.847362065834796e-08


EXIT: first_order.
println("status    : ", stats.status)
println("objective : ", stats.objective)
println("solution  : ", stats.solution)
status    : first_order
objective : 2.3024445659421074e-15
solution  : [0.9999999520162052, 0.9999999039343429]

See the options reference for the full list of keyword arguments accepted by the solver.

3. Finalize the CUTEst model

Once the CUTEst problem has been used, you should finalize it, see the CUTEst documentation.

finalize(nlp)