-
Notifications
You must be signed in to change notification settings - Fork 35
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
Cbc_status only available for MIP models #154
Comments
Please provide a reproducible example. |
This looks like you might be using your You should be careful using a non-released version. The API might have changed, and you may get errors like this. |
Yes. I got this error with the |
We distribute binaries for 2.10.3. There is no guarantee of support for anything else. |
I've started the process of updating to 2.10.5: JuliaPackaging/Yggdrasil#2661
It would be useful to post a reproducible example, or add it to the test suite so we can check if it happen in future. I assume at some point it will be part of a released Cbc version. |
The issue also exists for 2.10.5. I'd expect it would happen to any LP. Here is an example example.txt Log:
|
It works fine for 2.10.3. |
This works fine for me on 2.10.5. How did you build yours? julia> using JuMP
julia> using Cbc
julia> m = Model(Cbc.Optimizer);
julia> @variable(m, x[1:3] >= 0);
julia> @constraint(m, sum([1., 2., 3.] .* x) == 10.);
julia> @objective(m, Min, sum([2., 3., 6.] .* x));
julia> optimize!(m);
Welcome to the CBC MILP Solver
Version: 2.10.5
Build Date: Apr 5 2020
command line - Cbc_C_Interface -solve -quit (default strategy 1)
Presolve 0 (-1) rows, 0 (-3) columns and 0 (-3) elements
Empty problem - 0 rows, 0 columns and 0 elements
Optimal - objective value 15
After Postsolve, objective 15, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 15 - 0 iterations time 0.002, Presolve 0.00
Total time (CPU seconds): 0.00 (Wallclock seconds): 0.00
julia> status = termination_status(m)
OPTIMAL::TerminationStatusCode = 1
julia> println("Optimization status", status);
Optimization statusOPTIMAL
julia> println("x = ", value.(x));
x = [0.0, 5.0, 0.0] |
That's odd. I built Cbc with coinbrew in an official (but old, 1.3.0) julia docker container (which is based on Debian 10). It worked fine before and it works for MIPs now, just not for LPs. |
Ah. It seems like we bundle this patch which is the likely culprit: https://github.com/JuliaPackaging/Yggdrasil/blob/master/C/Coin-OR/Cbc/bundled/patches/no_lp.patch Can you test #155? |
@Dx-Wang try the latest |
Thanks, Oscar! The
|
See #160 for the fixes.
…On Fri, 12 Mar 2021, 12:01 PM Dexin Wang, ***@***.***> wrote:
Thanks, Oscar! The Cbc_status error seems to be gone for the latest master
, but there are related errors when calling value on x.
Presolve 0 (-1) rows, 0 (-3) columns and 0 (-3) elements
Optimal - objective value 15
After Postsolve, objective 15, infeasibilities - dual 0 (0), primal 0 (0)
Optimal objective 15 - 0 iterations time 0.002, Presolve 0.00
Optimization statusOPTIMAL
ERROR: LoadError: Result index of attribute MathOptInterface.VariablePrimal(1) out of bounds. There are currently 0 solution(s) in the model.
Stacktrace:
[1] check_result_index_bounds at /root/.julia/packages/MathOptInterface/5WwpK/src/attributes.jl:139 [inlined]
[2] get at /root/.julia/packages/Cbc/d781z/src/MOI_wrapper/MOI_wrapper.jl:760 [inlined]
[3] get(::MathOptInterface.Utilities.CachingOptimizer{Cbc.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.VariablePrimal, ::MathOptInterface.VariableIndex) at /root/.julia/packages/MathOptInterface/5WwpK/src/Utilities/cachingoptimizer.jl:726
[4] get(::MathOptInterface.Bridges.LazyBridgeOptimizer{MathOptInterface.Utilities.CachingOptimizer{Cbc.Optimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}}, ::MathOptInterface.VariablePrimal, ::MathOptInterface.VariableIndex) at /root/.julia/packages/MathOptInterface/5WwpK/src/Bridges/bridge_optimizer.jl:933
[5] get(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.VariablePrimal, ::MathOptInterface.VariableIndex) at /root/.julia/packages/MathOptInterface/5WwpK/src/Utilities/cachingoptimizer.jl:726
[6] _moi_get_result(::MathOptInterface.Utilities.CachingOptimizer{MathOptInterface.AbstractOptimizer,MathOptInterface.Utilities.UniversalFallback{MathOptInterface.Utilities.Model{Float64}}}, ::MathOptInterface.VariablePrimal, ::Vararg{Any,N} where N) at /root/.julia/packages/JuMP/y5vgk/src/JuMP.jl:946
[7] get(::Model, ::MathOptInterface.VariablePrimal, ::VariableRef) at /root/.julia/packages/JuMP/y5vgk/src/JuMP.jl:976
[8] #value#30(::Int64, ::typeof(value), ::VariableRef) at /root/.julia/packages/JuMP/y5vgk/src/variables.jl:766
[9] value at /root/.julia/packages/JuMP/y5vgk/src/variables.jl:766 [inlined]
[10] _broadcast_getindex_evalf at ./broadcast.jl:630 [inlined]
[11] _broadcast_getindex at ./broadcast.jl:603 [inlined]
[12] getindex at ./broadcast.jl:563 [inlined]
[13] macro expansion at ./broadcast.jl:909 [inlined]
[14] macro expansion at ./simdloop.jl:77 [inlined]
[15] copyto! at ./broadcast.jl:908 [inlined]
[16] copyto! at ./broadcast.jl:863 [inlined]
[17] copy at ./broadcast.jl:839 [inlined]
[18] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(value),Tuple{Array{VariableRef,1}}}) at ./broadcast.jl:819
[19] top-level scope at /home/eset_engine/example.jl:14
[20] include at ./boot.jl:328 [inlined]
[21] include_relative(::Module, ::String) at ./loading.jl:1105
[22] include(::Module, ::String) at ./Base.jl:31
[23] exec_options(::Base.JLOptions) at ./client.jl:287
[24] _start() at ./client.jl:460
in expression starting at /home/eset_engine/example.jl:14
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#154 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AB6MQJOCWKELVYN7TST3P4TTDE4S5ANCNFSM4Y2DJ45A>
.
|
I got the following errors when solving an LP (no integer variable) with Cbc. The errors arose when I try to get the value of the variables after the problem is solved. I can use Clp instead, but is this a bug?
Thanks!
The text was updated successfully, but these errors were encountered: