CBC solver

I got this error while trying to test Alpine: Failed to precompile Cbc.
What can I do to fix this ? Any suggestion ?
My Julia version: JuliaPro_v1.5.3-1

Same answer as Neos Server - #2 by odow. Please update to Julia v1.6. If it still errors after that, then please post the output of import Pkg; Pkg.status(), and the result of using Cbc.

I would even say update to 1.7.2, which is the current stable release. Also make sure that you’re using the regular General registry rather than the JuliaPro one (I can’t remember whether registries are persistent across version updates)

2 Likes

Julia was updated to the most recent version but it still errors. I get the following message :

LoadError: MethodError: no method matching Model(::var"#19#20")

Closest candidates are:

Model(::Any, !Matched::Symbol, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Int64, !Matched::Vector{String}, !Matched::Vector{String}, !Matched::Vector{Float64}, !Matched::Vector{Float64}, !Matched::Vector{Symbol}, !Matched::Vector, !Matched::Vector{Tuple{Symbol, Any}}, !Matched::Any, !Matched::Any, !Matched::Vector{Float64}, !Matched::Vector{Float64}, !Matched::Vector{Float64}, !Matched::Vector{Float64}, !Matched::Vector{Vector{Int64}}, !Matched::Vector{Vector{Tuple{Int64, Int64}}}, !Matched::Any, !Matched::MathProgBase.SolverInterface.AbstractMathProgSolver, !Matched::Bool, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Vector, !Matched::JuMP.IndexedVector{Float64}, !Matched::Any, !Matched::Bool, !Matched::Dict{Symbol, Any}, !Matched::IdDict, !Matched::Int64, !Matched::Int64, !Matched::Dict{Symbol, Any}) at C:\Users\DELL\.julia\packages\JuMP\I7whV\src\JuMP.jl:87

Model(::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any, !Matched::Any) at C:\Users\DELL\.julia\packages\JuMP\I7whV\src\JuMP.jl:87

Model(; solver, simplify_nonlinear_expressions) at C:\Users\DELL\.julia\packages\JuMP\I7whV\src\JuMP.jl:167

in expression starting at C:\Users\DELL\Dropbox\Fran_posg\tese\artigos Secundino\sist5.jl:88
top-level scope at sist5.jl:88
eval at boot.jl:373 [inlined]
include_string(mapexpr::typeof(identity), mod::Module, code::String, filename::String) at loading.jl:1196
using JuMP, AmplNLWriter, Bonmin_jll
us = ["Jacui","Ita","Xingo","Salto Santiago","Lajeado"]
d = [4827 3976 3861 3803 3746 3919 4345 4829 5187 5551 5792 5314 6028 6754 6662 6512 5429 4726 4495 4726 4956 4610 4265 3976]
metas=[108 870 1581 760 543]
pmin = [
    1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1   1
    140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140 140
    250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250 250
    170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170 170
    89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89  89
    ]
pmax = [
    30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30  30
    290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290 290
    527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527 527
    317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317 317
    181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181 181
    ]
nmin = [
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
    ]
nmax = [
    6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6 6
    5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
    5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
    4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4
    5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5
    ]
cpp = [15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30 15*30
15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290 15*290
15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527 15*527
15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317 15*317
15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181 15*181]
valor_agua = [
0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304 0.0036*304;
0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517 0.0036*517;
0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351 0.0036*351;
0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887 0.0036*887;
0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434 0.0036*434;
]
c_00 = [-0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608 -0.003608
-0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193 -0.6193
 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188 -5.188
 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225 0.225
 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823 -3.823]#TI
c_10 = [0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889 0.6889
0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071 0.8071
0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499 0.6499
1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121 1.121
1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051 1.051]#POR P
c_01 = [10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88 10.88
71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07 71.07
126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4 126.4
17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23 17.23
288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8 288.8]#POR N
c_20 = [0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814 0.00814
0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046 0.00046
0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992 0.0003992
0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682 0.001682
0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462 0.003462]#POR P2
c_11 = [-0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519 -0.2519
-0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907 -0.1907
-0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817 -0.2817
-0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779 -0.779
-0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643 -0.6643]# POR PN
c_02 = [1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386 1.386
20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15 20.15
47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53 47.53
89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36 89.36
36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65 36.65]#POR N2
ÎĽ = 0.02

model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))

nus = length(us)
nd = length(d)

@variables(model, begin
    p[i=1:nus, t=1:nd] >= 0
    n[i=1:nus, t=0:nd], Int
    y[i=1:nus, t=1:nd] >= 0,Int
    z[t=1:nd] >= 0
end)

    fix.(n[1, 0], 6;force=true)
    fix.(n[2, 0], 3;force=true)
    fix.(n[3, 0], 3;force=true)
    fix.(n[4, 0], 3;force=true)
    fix.(n[5, 0], 3;force=true)

for i in 1:nus
    for t in 1:nd
        set_lower_bound(n[i, t], nmin[i, t])
        set_upper_bound(n[i, t], nmax[i, t])
    end
end
@NLobjective(
    model,
    Min,
    sum(
        sum(
            valor_agua[i,t] * (
                c_00[i,t] +
                c_10[i,t] * p[i, t] +
                c_01[i,t] * n[i, t] +
                c_20[i,t] * p[i, t]^2 +
                c_11[i,t] * p[i, t] * n[i, t] +
                c_02[i,t] * n[i, t]^2
            ) +
            cpp[i,t] * y[i, t]
            for i = 1:nus
        ) + ÎĽ * z[t]^2
        for t = 1:nd
    )
)
@constraints(model, begin
    [i=1:nus, t=1:nd], y[i, t] >= n[i, t] - n[i, t-1]
    [i=1:nus, t=1:nd], y[i,t] >= n[i, t-1] -n[i, t]
    [i=1:nus, t=1:nd], pmin[i, t] * n[i, t] <= p[i, t]
    [i=1:nus, t=1:nd], p[i, t] <= pmax[i, t] * n[i, t]
    [t=1:nd], sum(p[:, t]) + z[t] == d[t]
    [i=1:nus], sum(p[i, :]) == 24 * metas[i]
end)

print(model)
optimize!(model)
@show objective_value(model)
@show value.(p)
@show value.(n)
@show value.(z)
@show value.(y)

I tried to install Alpine and it didnt work, the same problem.

What do you mean by “same problem”? Looks like everything installed fine, and you just have errors in your code now?

Not a JuMP expert, but the error says you shouldn’t pass an anonymous function to Model()

Indeed the first example in the JuMP docs shows this syntax for constructing a model:

model = Model(HiGHS.Optimizer)

so yours should probably be

model = Model(AmplNLWriter.Optimizer(Bonmin_jll.amplexe))

How can I solve that error, it keeps showing the same message. In my code I put just like you suggest.

Sorry, I did look at the solver specific docs now and indeed they suggest passing an anonymous function. The documented usage works fine for me:

julia> using JuMP, AmplNLWriter, Bonmin_jll

julia> model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))
A JuMP Model
Feasibility problem with:
Variables: 0
Model mode: AUTOMATIC
CachingOptimizer state: EMPTY_OPTIMIZER
Solver name: AmplNLWriter

and I can also run all of your code, although it fails with the following:

julia> optimize!(model)
Bonmin 1.8.8 using Cbc 2.10.5 and Ipopt 3.14.4
bonmin:

******************************************************************************
This program contains Ipopt, a library for large-scale nonlinear optimization.
 Ipopt is released as open source code under the Eclipse Public License (EPL).
         For more information visit https://github.com/coin-or/Ipopt
******************************************************************************

NLP0012I 
              Num      Status      Obj             It       time                 Location
NLP0014I             1         OPT 797109.8       28 0.1
Assertion failed: isNlpFeasible(minlp, primalTolerance), file BonHeuristicDiveMIP.cpp, line 133

which sounds more like a specific issue with your problem definition than a programming issue.

It seems very strange to me, it does not run any simple code, absolutely nothing is working.
With the previous version of julia, the bonmin solver solved my problem

What do you mean by “it does not run any simple code”? Are you saying that in a fresh Julia session the following code errors for you?

julia> using JuMP, AmplNLWriter, Bonmin_jll

julia> model = Model(() -> AmplNLWriter.Optimizer(Bonmin_jll.amplexe))

Yes, it errors. I updated Julia also Atom and it didnt work.

What is the error? What is the output of ]st?

[07493b3f] Alpine v0.1.15
[7c4d4715] AmplNLWriter v0.8.1
[c52e3926] Atom v0.12.36
[9961bab8] Cbc v1.0.0
[42e2da0e] Grisu v1.0.2
[b6b21f68] Ipopt v1.0.2
[4076af6c] JuMP v0.18.6
[e5e0dc1b] Juno v0.8.4
[f10290a3] NEOSServer v0.4.2
[2f354839] Pajarito v0.7.0
[fdbf4ff8] XLSX v0.7.9
[29cba6d7] Bonmin_jll v100.800.801+0
[9cc047cb] Ipopt_jll v300.1400.400+0
[c1ab834c] SHOT_jll v100.100.0+0

Precompiling project…
âś— JuMP
âś— Alpine
âś— Pajarito
3 dependencies errored.

Your JuMP version is outdated:

(jl_cP0V7O) pkg> st
      Status `C:\Users\ngudat\AppData\Local\Temp\jl_cP0V7O\Project.toml`
  [7c4d4715] AmplNLWriter v0.8.1
  [4076af6c] JuMP v0.23.1
  [29cba6d7] Bonmin_jll v100.800.801+0

Also the fact that you have Atom and Juno in the same environment as JuMP etc. suggests to me that you are dumping all your packages into the default environment - don’t do this. Work in project-specific environments to minimize dependency conflicts.

Do:

] activate --temp
] add AmplNLWriter JuMP Bonmin_jll

and then run the code I posted again.

1 Like

Work in project-specific environments to minimize dependency conflicts. How can I do this?
I run this

] activate --temp
] add AmplNLWriter JuMP Bonmin_jll

and my ouput

[7c4d4715] AmplNLWriter v0.8.1
[4076af6c] JuMP v0.23.1
[29cba6d7] Bonmin_jll v100.800.801+0

What i need to do now?

Now you run the code again (first my example, and if that works your full code). Make sure you are doing this in a fresh Julia session (i.e. you are doing using AmplNLWriter, JuMP, Bonmin_jll after you’ve activated a new environment and added the packages).

Read this to learn more: 4. Working with Environments · Pkg.jl

> ┌ Warning: `range(start, stop)` (with neither `length` nor `step` given) is deprecated, use `range(start, stop=stop)` instead.
> │   caller = broadcasted at broadcast.jl:1093 [inlined]
> â”” @ Core .\broadcast.jl:1093

I got this error. So sorry, I am new using Julia

That’s a warning, not an error, and seems unrelated to your previous issues (and I don’t get this warning when running the code you posted above).

but how can i solve this warning?

I don’t know, as I said I don’t think this warning is related to the code you posted above. Please read

and make an MWE which produces this warning.