Skip to content

typeassert failure with Ipopt 1.14.2 #159

Description

@DaniGlez

Describe the bug 🐞

I'm using Ipopt through ADNLPModels. On Ipopt = 1.14.2 (but not 1.14.1), with NLPModelsIpopt 0.11.3, I get the following when running the MWE:

    ERROR: TypeError: in typeassert, expected Nothing,
           got a value of type Tuple{Vector{Int32}, Vector{Int32}}
    _Eval_H_CB at .../Ipopt/.../src/C_wrapper.jl:126
    NLPModelsIpopt.solve!(IpoptSolver, ADNLPModel, ...)

Minimal Reproducible Example 👇

using ADNLPModels
using NLPModelsIpopt

objective(x)         = -(x[1] + x[2])
constraint!(c, x)    = (c[1] = x[1]^2 + x[2]^2; c)

nlp = ADNLPModel!(
    objective,
    [0.5, 0.5],          # x0
    [-1.0, -1.0],        # lvar
    [ 1.0,  1.0],        # uvar
    constraint!,
    [0.0],               # lcon
    [1.0],               # ucon
)

stats = ipopt(nlp, print_level=0)
println("status   = ", stats.status)
println("solution = ", stats.solution)
println("obj      = ", stats.objective)

From what I see, Ipopt.jl PR #533 (shipped in 1.14.2) refactored the C callbacks and tightened their return-type asserts. _Eval_H_CB now requires prob.eval_h(...) to return Nothing through a type assertion ::Nothing, but NLPModelsIpopt 0.11.3 still returns (iRow, jCol)::Tuple{Vector{Int32},Vector{Int32}} on the structure-evaluation pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions