Closed Dx-Wang closed 3 years ago
Please provide a reproducible example.
/root/.julia/packages/Cbc/8ANWi/deps/../../../../../../CbcInstall/dist/lib/libCbcSolver.so
This looks like you might be using your devel
copy (https://github.com/jump-dev/Cbc.jl/issues/152)?
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 devel
version of Cbc. Let me try if this occurs with v2.10.5
or v2.10.3
.
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: https://github.com/JuliaPackaging/Yggdrasil/pull/2661
Let me try if this occurs with v2.10.5 or v2.10.3.
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:
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 statusnothing
ERROR: LoadError: OptimizeNotCalled()
Stacktrace:
[1] _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:944
[2] get(::Model, ::MathOptInterface.VariablePrimal, ::VariableRef) at /root/.julia/packages/JuMP/y5vgk/src/JuMP.jl:976
[3] #value#30(::Int64, ::typeof(value), ::VariableRef) at /root/.julia/packages/JuMP/y5vgk/src/variables.jl:766
[4] value at /root/.julia/packages/JuMP/y5vgk/src/variables.jl:766 [inlined]
[5] _broadcast_getindex_evalf at ./broadcast.jl:630 [inlined]
[6] _broadcast_getindex at ./broadcast.jl:603 [inlined]
[7] getindex at ./broadcast.jl:563 [inlined]
[8] macro expansion at ./broadcast.jl:909 [inlined]
[9] macro expansion at ./simdloop.jl:77 [inlined]
[10] copyto! at ./broadcast.jl:908 [inlined]
[11] copyto! at ./broadcast.jl:863 [inlined]
[12] copy at ./broadcast.jl:839 [inlined]
[13] materialize(::Base.Broadcast.Broadcasted{Base.Broadcast.DefaultArrayStyle{1},Nothing,typeof(value),Tuple{Array{VariableRef,1}}}) at ./broadcast.jl:819
[14] top-level scope at /home/eset_engine/example.jl:11
[15] include at ./boot.jl:328 [inlined]
[16] include_relative(::Module, ::String) at ./loading.jl:1105
[17] include(::Module, ::String) at ./Base.jl:31
[18] exec_options(::Base.JLOptions) at ./client.jl:287
[19] _start() at ./client.jl:460
in expression starting at /home/eset_engine/example.jl:11
It works fine for 2.10.3.
optimize!
does not return a status like that.
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 master
. I merged since it seems like the correct thing to do in more cases.
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
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 https://github.com/jump-dev/Cbc.jl/issues/154#issuecomment-797107041, 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!