lanl-ansi / Juniper.jl

A JuMP-based Nonlinear Integer Program Solver
https://lanl-ansi.github.io/Juniper.jl/stable/
MIT License
179 stars 22 forks source link

Use a custom linear relaxation for fpump #255

Open this-josh opened 1 year ago

this-josh commented 1 year ago

Implementation of #254

this-josh commented 1 year ago

@Wikunia here is the implementation I have, as mentioned in #255 I'm not convinced it it a good approach. It works as such:

       # build MINLP
        _nl_solver = optimizer_with_attributes(Ipopt.Optimizer, "print_level" => 0)

        juniper_opt = optimizer_with_attributes(Juniper.Optimizer, "nl_solver" => _nl_solver, "mip_solver" => HiGHS.Optimizer)
        model = Model(juniper_opt)
        @variable(model, a, integer=true)
        @constraint(model, 0<=model[:a] <= 10)
        @NLconstraint(model, model[:a] * abs(model[:a]) >=3)
        @objective(model, Min, model[:a])
        juniper_opt = optimizer_with_attributes(Juniper.Optimizer, "nl_solver" => _nl_solver, "mip_solver" => HiGHS.Optimizer, "time_limit"=>64)

        # build MILP
        mip = Model(juniper_opt)
        @variable(mip, a, integer=true)
        @constraint(mip, mip[:a] * mip[:a] ==0)
        @constraint(mip, mip[:a] <= 10)
        @objective(mip, Min, mip[:a])
        set_silent(mip)
        set_optimizer_attribute(model, "mip_model", mip)

        optimize!(mip)
        # set the MINLP to have the MILP model
        set_optimizer_attribute(model, "mip_model", mip)
        optimize!(model)

Note six test_linear_transform tests are failing but they are also failing on main.