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

CBC ignores attempts to silence it. #175

Closed
freemin7 opened this issue Sep 15, 2021 · 1 comment
Closed

CBC ignores attempts to silence it. #175

freemin7 opened this issue Sep 15, 2021 · 1 comment

Comments

@freemin7
Copy link

Dependencies:

 pkg> st
      Status `~/Projekte/Julia/MILP_benchmark/Project.toml`
  [9961bab8] Cbc v0.8.1
  [60bf3e95] GLPK v0.14.12
  [4076af6c] JuMP v0.21.10

Code

using JuMP
import Cbc

function example_transp(factory)
    ORIG = ["GARY", "CLEV", "PITT"]
    DEST = ["FRA", "DET", "LAN", "WIN", "STL", "FRE", "LAF"]
    supply = [1_400, 2_600, 2_900]
    demand = [900, 1_200, 600, 400, 1_700, 1_100, 1_000]
    cost = [
        39 14 11 14 16 82 8
        27 9 12 9 26 95 17
        24 14 17 13 28 99 20
    ]
    model = Model(factory)
    set_silent(model)
    @variable(model, trans[1:length(ORIG), 1:length(DEST)] >= 0)
    @objective(
        model,
        Min,
        sum(
            cost[i, j] * trans[i, j] for i in 1:length(ORIG),
            j in 1:length(DEST)
        )
    )
    @constraints(
        model,
        begin
            [i in 1:length(ORIG)], sum(trans[i, :]) == supply[i]
            [j in 1:length(DEST)], sum(trans[:, j]) == demand[j]
        end
    )
    optimize!(model)
    if termination_status(model) == MOI.OPTIMAL
    	println("transp ",solver_name(model)," ", solve_time(model))
    else
    	println("transp ",solver_name(model)," failed")
    end
    return
end

example_transp(with_optimizer(Cbc.Optimizer, logLevel = 0))

This outputs:

Presolve 10 (0) rows, 21 (0) columns and 42 (0) elements
0  Obj 0 Primal inf 13800 (10)
13  Obj 196200
Optimal - objective value 196200
Optimal objective 196200 - 13 iterations time 0.002
transp COIN Branch-and-Cut (Cbc) 0.000453948974609375

when i only expected the last line.

@odow
Copy link
Member

odow commented Sep 15, 2021

Closing as duplicate of #168

@odow odow closed this as completed Sep 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants