Skip to content

[FileFormats.MOF] add a flag to the file when use_nlp_block=false #2687

@odow

Description

@odow

See https://discourse.julialang.org/t/mof-read-from-file-fails-when-using-moi-parameter-and-non-linear-constraints/126688

It'd be good if we could make this work:

using JuMP
using Ipopt
model = Model(Ipopt.Optimizer)
set_silent(model)
@variable(model, p  MOI.Parameter(1.5))
@variable(model, p_prox)
@variable(model, x)
@constraint(model, con, p_prox == p)
@constraint(model, x * sin(p_prox) == 1)
@objective(model, Min, sum(x))
optimize!(model) # Works
@assert is_solved_and_feasible(model)
write_to_file(model, "test.mof.json")
model_test = read_from_file("test.mof.json"; use_nlp_block = false)
set_optimizer(model_test, Ipopt.Optimizer)
optimize!(model_test)

Reported by @andrewrosemberg

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions