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

MISOCP solves returning status "Unknown" (different from #100) #101

Closed
chriscoey opened this issue Dec 13, 2016 · 21 comments
Closed

MISOCP solves returning status "Unknown" (different from #100) #101

chriscoey opened this issue Dec 13, 2016 · 21 comments
Assignees

Comments

@chriscoey
Copy link
Contributor

We also get Unknown from a large number of MISOCPs we attempt to solve. What we observe is that MOSEK gets to the time limit AND has a feasible solution, but apparently the optimality gap is not yet satisfied. Then Mosek.jl fails to handle the status properly and returns Unknown (perhaps it should be Suboptimal).

In another case where no feasible solution was found by the time limit, MOSEK finished and Mosek.jl returned (correctly) the UserLimit status. The only difference here was that no feasible solution was found, whereas in the Unknown cases, we had both upper and lower bounds.

Here is the end of a printout (the lines with ## are our printings, not MOSEK's):

1179079  1176550  335532   30       5.0076984618e+05     5.0052105644e+05     0.05        3599.5
1179105  1176576  335540   24       5.0076984618e+05     5.0052105735e+05     0.05        3599.5
1179131  1176602  335546   45       5.0076984618e+05     5.0052105779e+05     0.05        3599.6
1179157  1176628  335550   24       5.0076984618e+05     5.0052105879e+05     0.05        3599.7
1179183  1176654  335560   36       5.0076984618e+05     5.0052106168e+05     0.05        3599.8
1179209  1176680  335566   39       5.0076984618e+05     5.0052106190e+05     0.05        3599.8
1179235  1176706  335570   35       5.0076984618e+05     5.0052106307e+05     0.05        3599.9
1179261  1176732  335576   29       5.0076984618e+05     5.0052106463e+05     0.05        3600.0
Maximum amount of time 3600.00 (=dpar_optimizer_max_time) is reached.

Objective of best integer solution : 5.007698461827e+05      
Best objective bound               : 5.005210646327e+05      
Construct solution objective       : Not employed
Construct solution # roundings     : 0
User objective cut value           : 0
Number of cuts generated           : 0
Number of branches                 : 1179261
Number of relaxations solved       : 1176732
Number of interior point iterations: 21020134
Number of simplex iterations       : 0
Time spend presolving the root     : 0.00
Time spend in the heuristic        : 0.00
Time spend in the sub optimizers   : 0.00
  Time spend optimizing the root   : 0.00
Mixed integer optimizer terminated. Time: 3601.02

Optimizer terminated. Time: 3601.03 
#STATUS# Unknown
#OBJVAL# 500769.8461827041
#OBJBOUND# 500521.06463272555
#TIMESOLVER# 3601.032301902771

@mlubin @ulfworsoe

@erling-d-andersen
Copy link

There is almost surely a bug in Julia interface.

Btw getting the Julia interface to print the MOSEK solution summary after each optimization as default would help debugging so much.

@mlubin
Copy link
Contributor

mlubin commented Dec 15, 2016

@ulfworsoe, looks like the fix to #89 was incomplete

@ulfworsoe ulfworsoe self-assigned this Dec 15, 2016
ulfworsoe added a commit that referenced this issue Dec 15, 2016
Related to issue #101. Produce :Suboptimal if for primal feasible MIP or
primal-dual feasible.
@ulfworsoe
Copy link
Member

The issue is at least partially fixed now. A feasible solution should now produce Suboptimal status.

@mlubin
Copy link
Contributor

mlubin commented Dec 15, 2016

@ulfworsoe, that doesn't follow the MPB convention. If the solver stops because of a time limit, it should return :UserLimit regardless of whether it has found a primal solution so far.

@ulfworsoe
Copy link
Member

Fair enough. The status function is a mess since it mixes Mosek's response code, problem status and solution status into one value. Do you have a description of MPB conventions somewhere?

@ulfworsoe
Copy link
Member

Basically the relevant questions:

  • Does UserLimit take precedence over an optimal solution or only a feasible one?
  • Does Stall take precedence over an optimal solution or a feasible one?

@mlubin
Copy link
Contributor

mlubin commented Dec 15, 2016

The statuses are currently documented at http://mathprogbasejl.readthedocs.io/en/latest/solverinterface.html#status. I agree that they could use a revamp, that's something I'm open to considering.

Does UserLimit take precedence over an optimal solution or only a feasible one?

I don't understand how the solver could terminate because of the time limit if it already has an optimal solution.

Does Stall take precedence over an optimal solution or a feasible one?

Stall is not a standard status. Error maybe?

You should consider the statuses, as they're currently defined, as an explanation of why the solver stopped. :Optimal is not really about the solution itself but more explaining that the solver stopped because it found a solution that it was happy with. @ccoffrin has pointed out that :Optimal should really be called :Success or something similar.

@mlubin
Copy link
Contributor

mlubin commented Dec 18, 2016

Btw getting the Julia interface to print the MOSEK solution summary after each optimization as default would help debugging so much.

Agreed. @ulfworsoe, could we do that?

@ulfworsoe
Copy link
Member

Done.

@mlubin
Copy link
Contributor

mlubin commented Dec 23, 2016

@ulfworsoe, Mosek seems to be returning :Stall on some problems where it used to return :Optimal and is therefore failing JuMP's tests.

@ulfworsoe
Copy link
Member

Yes. If the solver stalls and stops, but finds that the solution after post-solve happens to be optimal, it will produce an optimal solution but still return the actual reason for stopping.

@mlubin
Copy link
Contributor

mlubin commented Dec 28, 2016

Fair enough

@erling-d-andersen
Copy link

erling-d-andersen commented Dec 29, 2016 via email

@ulfworsoe
Copy link
Member

That is possible.

The problem here is: It is possible that the MOSEK solver terminates with a non-ok status and produces an optimal solution anyway. In this case it is my understanding (from the above discussion) that MathProgBase.status() should return the solver response rather than the solution status if the solver response is not ok

@mlubin
Copy link
Contributor

mlubin commented Dec 29, 2016

The offending test is an SDP:

using JuMP, Base.Test, Mosek
m = Model(solver=MosekSolver())
@variable(m, y)
@variable(m, z)
c = @SDconstraint(m, [0 y; z 0] <= [1 0; 0 0])
@objective(m, Max, y/2+z/2)
status = solve(m)

@test status == :Optimal
@test isapprox(getobjectivevalue(m), 0, atol=1e-5)
@test isapprox(getvalue(y), 0, atol=1e-5)
@test isapprox(getvalue(z), 0, atol=1e-5)

X = getdual(c)
@test isapprox(X[1,1], 0, atol=1e-5)
@test isapprox(X[1,2], 1/2, atol=1e-5)
@test isapprox(X[2,1], 1/2, atol=1e-5)
@test isapprox(getdual(y), 0, atol=1e-5)
@test isapprox(getdual(z), 0, atol=1e-5)

Ulf is correct that MathProgBase.status() should return the solver response. It's a bit confusing that the solver can stall and still return an optimal solution though. Why is it called a stall if the optimality tolerances are satisfied?

@erling-d-andersen
Copy link

erling-d-andersen commented Dec 30, 2016 via email

@mlubin
Copy link
Contributor

mlubin commented Jan 2, 2017

No need to convince me, I'm already convinced that the status API in MathProgBase needs to be redone.

@ccoffrin
Copy link

ccoffrin commented Jan 2, 2017

I find the idea of having 4 values, i.e. return code, optimizer status, problem status, and solution status, quite interesting.

@erling-d-andersen
Copy link

erling-d-andersen commented Jan 2, 2017 via email

@erling-d-andersen
Copy link

erling-d-andersen commented Jan 2, 2017 via email

@ulfworsoe
Copy link
Member

Closing ancient issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants