Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MINLPTest 007_020 #54

Open
odow opened this issue Nov 22, 2021 · 6 comments
Open

Fix MINLPTest 007_020 #54

odow opened this issue Nov 22, 2021 · 6 comments
Labels
bug Something isn't working

Comments

@odow
Copy link
Member

odow commented Nov 22, 2021

We shouldn't be failing MINLPTests. They're intended to be "easy" to solve:

# TODO fix failures:
"003_010",
"003_011",
"003_012",
"003_013",
"003_014",
"003_015",
"003_016",
"007_010",
"007_020",

@odow odow added the bug Something isn't working label Nov 22, 2021
@odow
Copy link
Member Author

odow commented Nov 22, 2021

Most are expected because the underlying problem is non-convex. However, 007_020 is incorrect:

using Pavito, JuMP, GLPK, Ipopt
mip_solver = MOI.OptimizerWithAttributes(
    GLPK.Optimizer,
    "msg_lev" => 0,
    "tol_int" => 1e-9,
    "tol_bnd" => 1e-7,
    "mip_gap" => 0.0,
)
cont_solver = MOI.OptimizerWithAttributes(Ipopt.Optimizer, MOI.Silent() => true)
optimizer = MOI.OptimizerWithAttributes(
    Pavito.Optimizer,
    "timeout" => 120.0,
    "mip_solver_drives" => true,
    "mip_solver" => mip_solver,
    "cont_solver" => cont_solver,
    "log_level" => 1,
)
model = Model(optimizer; add_bridges = false)
@variable(model, -2 <= x <= 3, Int)
@variable(model, y, Bin)
@NLconstraint(model, (x - 0.5)^2 + (4 * y - 2)^2 <= 3)
julia> optimize!(model)

MINLP has a linear objective, 2 continuous variables, 2 integer variables, 1 nonlinear constraints, and 0 quadratic constraints

Pavito started, using MIP-solver-driven method...
┌ Warning: Infeasible NLP problem terminated with primal status: UNKNOWN_RESULT_STATUS
└ @ Pavito ~/.julia/dev/Pavito/src/optimize.jl:693
┌ Warning: Integer-infeasible solution in lazy callback
└ @ Pavito ~/.julia/dev/Pavito/src/optimize.jl:173

Pavito finished...

Status           LOCALLY_SOLVED
Objective value            Inf
Objective bound        0.00000
Objective gap              Inf
Callbacks                    2
Total time             0.01550 sec
MIP total time         0.00000 sec
NLP total time         0.01469 sec

julia> solution_summary(model)
* Solver : Pavito

* Status
  Termination status : LOCALLY_SOLVED
  Primal status      : FEASIBLE_POINT
  Dual status        : NO_SOLUTION
  Message from the solver:
  "LOCALLY_SOLVED"

* Candidate solution
  Objective value      : Inf
  Objective bound      : 0.0

* Work counters
  Solve time (sec)   : 0.01550

@chriscoey
Copy link
Contributor

Yes I think some bugs have crept in as the package has become more complex. I don't have time to look at these issues before I graduate because Pavito isn't part of my thesis but hopefully someone can! Ideally the package would be simplified again, e.g. by removing all of the messy quadratic stuff in favor of a QP to NLP bridge.

@odow
Copy link
Member Author

odow commented Nov 22, 2021

To update this, only 007_020 remains an issue:

# ======================= Unexpected failures ======================
# LOCALLY_SOLVED instead of LOCALLY_INFEASIBLE
"007_020",
# ======================== Expected failures =======================
# Nonconvex: contains sin(x)^2
"003_010",
"003_011",
"003_012",
"003_013",
"003_014",
"003_015",
"003_016",
# Non-convex: user-defined function y^3
"006_010",

@odow odow changed the title Fix MINLPTest failures Fix MINLPTest 007_020 Nov 22, 2021
@chriscoey
Copy link
Contributor

Pinging @ccoffrin in case he has any thoughts

@ccoffrin
Copy link
Collaborator

@chriscoey it looks to me that Pavito claims to find a "feasible" solution when none exists. The objective value of Inf might be suspect (or just a JuMP default?), we can over look this as no objective function is defined for this problem.

Can someone post the solution vector returned by Pavito on this case? This should provide some additional insights into what might be wrong.

@chriscoey
Copy link
Contributor

chriscoey commented Nov 22, 2021

I fixed the issue for the iterative algorithm in #60, but not for the MSD algorithm.
The "solution" is NaNs. The MIP solver thinks it is feasible and we just use that status. There are some icky things going on in MSD, like us not adding cuts when the MIP solution is integer-infeasible. Also Ipopt fails on the subproblem.

MINLP has a linear objective, 2 continuous variables, 2 integer variables, 1 nonlinear constraints, and 0 quadratic constraints

Pavito started, using MIP-solver-driven method...
┌ Warning: Infeasible NLP problem terminated with primal status: UNKNOWN_RESULT_STATUS
└ @ Pavito ~/.julia/dev/Pavito/src/optimize.jl:694
┌ Warning: Integer-infeasible solution in lazy callback
└ @ Pavito ~/.julia/dev/Pavito/src/optimize.jl:173

Pavito finished...

Status           LOCALLY_SOLVED
Objective value            Inf
Objective bound        0.00000
Objective gap              Inf
Callbacks                    2
Total time             0.02041 sec
MIP total time         0.00000 sec
NLP total time         0.01976 sec

model.incumbent = [NaN, NaN]
nlp_mi_007_020: Test Failed at /Users/coey/.julia/packages/MINLPTests/iuxu3/src/MINLPTests.jl:56
  Expression: JuMP.termination_status(model) == termination_target[problem_type]
   Evaluated: MathOptInterface.LOCALLY_SOLVED == MathOptInterface.LOCALLY_INFEASIBLE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Development

No branches or pull requests

3 participants