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.jl doesn't propagate primalTolerance/dualTolerance when problem is an LP #211

Closed
SBuercklin opened this issue Dec 12, 2022 · 6 comments
Labels
Upstream Issue with upstream library

Comments

@SBuercklin
Copy link

When setting the RawOptimizerAttribute primalTolerance or dualTolerance, it doesn't affect the actual optimization when the problem is an LP and presumably Cbc is calling out to Clp. On older versions of Cbc_jll (namely 2.10.3) these parameters do affect the optimal solution that is found.

The script below throws an assertion error with [email protected] but passes with [email protected]. Link to the model .mps. The optimal solution on 2.10.8 is unchanged by setting the tolerances, whereas 2.10.3 and the CLI show that the optimal solution should vary with the tolerances.

import MathOptInterface as MOI
using Cbc

model1 = MOI.FileFormats.Model(format = MOI.FileFormats.FORMAT_MPS)
MOI.read_from_file(model1, "model-w-objective.mps")
model2 = deepcopy(model1)

# MOI changed the name of this between releases which are compatible with the different Cbc versions
_parameter = isdefined(MOI, :RawOptimizerAttribute) ? MOI.RawOptimizerAttribute : MOI.RawParameter

optimizer = Cbc.Optimizer()
MOI.set(optimizer, _parameter("primalTolerance"), 1e-9)
MOI.set(optimizer, _parameter("dualTolerance"), 1e-9)

MOI.copy_to(optimizer, model1)
MOI.optimize!(optimizer)

optimizer2 = Cbc.Optimizer()
MOI.set(optimizer2, _parameter("primalTolerance"), 1e-5)
MOI.set(optimizer2, _parameter("dualTolerance"), 1e-5)

MOI.copy_to(optimizer2, model2)
MOI.optimize!(optimizer2)

# On 2.10.3: Optimized objective: 51.799895235326034
# On 2.10.8: Optimized objective: 51.76590549946883
println("Optimized objective: $(MOI.get(optimizer, MOI.ObjectiveValue()))")

# On 2.10.3: Optimized objective2: 13.511438022052
# On 2.10.8: Optimized objective2: 51.76590549946883
println("Optimized objective2: $(MOI.get(optimizer2, MOI.ObjectiveValue()))")

# Assertion fails on 2.10.8
@assert MOI.get(optimizer, MOI.ObjectiveValue()) != MOI.get(optimizer2, MOI.ObjectiveValue())

I get the correct behavior when running this from the 2.10.8 CLI and the optimized objective agrees with the 2.10.3 result, so it seems Cbc.jl (or the Cbc_jll C interface) is not properly setting the tolerances.

CLI on 2.10.8
Welcome to the CBC MILP Solver 
Version: 2.10.8 
Build Date: Jan  1 1970 

CoinSolver takes input from arguments ( - switches to stdin)
Enter ? for list of commands or help
Coin:import model-w-objective.mps
At line 1 NAME
At line 2 ROWS
At line 14422 COLUMNS
At line 53620 RHS
At line 68039 RANGES
At line 68040 BOUNDS
At line 73448 ENDATA
Problem no_name has 14418 rows, 5406 columns and 36310 elements
Coin0008I no_name read with 0 errors
Coin:dualTolerance 1e-9
dualTolerance was changed from 1e-07 to 1e-09
Coin:primalTolerance 1e-9
primalTolerance was changed from 1e-07 to 1e-09
Coin:solve
Presolve 7341 (-7077) rows, 3175 (-2231) columns and 21593 (-14717) elements
Perturbing problem by 0.001% of 546.62548 - largest nonzero change 0.00054598524 ( 4.9831485%) - largest zero change 0.00053817832
0  Obj -0.24037935 Primal inf 47.699527 (376) Dual inf 10.636153 (353) w.o. free dual inf (0)
221  Obj -1.6384981e+11 Primal inf 2.3379433e+14 (1922) Dual inf 3.9776749 (132) w.o. free dual inf (0)
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
End of values pass after 221 iterations
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
442  Obj 8.1587866e+14 Primal inf 9.6062735e+11 (1335) Dual inf 4.5160925e+17 (1361) w.o. free dual inf (934)
663  Obj 8.1587866e+14 Primal inf 9.5578775e+11 (1215) Dual inf 2.6125925e+17 (1106) w.o. free dual inf (679)
884  Obj 8.1588162e+14 Primal inf 9.5404936e+11 (1047) Dual inf 1.2471336e+17 (1006) w.o. free dual inf (616)
1105  Obj 8.1588162e+14 Primal inf 9.5404936e+11 (862) Dual inf 3.4730788e+16 (786) w.o. free dual inf (433)
1326  Obj 7.7935097e+14 Primal inf 3.086179e+11 (390) Dual inf 2.7203701e+16 (452) w.o. free dual inf (246)
1547  Obj 141.66128 Primal inf 0.00011985785 (126) Dual inf 2.1058158e+17 (798) w.o. free dual inf (714)
1733  Obj 432.09412 Primal inf 1.3409578e-05 (45) Dual inf 6.5357831e+16 (736) w.o. free dual inf (652)
1954  Obj 432.07726 Primal inf 1.3406235e-05 (44) Dual inf 5.191735e+14 (699) w.o. free dual inf (615)
2081  Obj 431.79203 Primal inf 1.3386413e-05 (44) Dual inf 5.2893291e+14 (637) w.o. free dual inf (553)
2212  Obj 431.5402 Primal inf 1.3366411e-05 (44) Dual inf 3.3022969e+16 (592) w.o. free dual inf (534)
2375  Obj 431.48834 Primal inf 1.3359193e-05 (44) Dual inf 9.0646103e+12 (455)
2510  Obj 431.45544 Primal inf 1.3356801e-05 (44) Dual inf 9.2835236e+13 (571)
2665  Obj 431.40232 Primal inf 1.335389e-05 (54) Dual inf 1.2389503e+17 (960)
2841  Obj 428.30033 Primal inf 1.3178888e-05 (45) Dual inf 1.2422285e+16 (546)
3014  Obj 285.79366 Primal inf 1.018485e-05 (132) Dual inf 2.7708233e+16 (431)
3066  Obj 263.70776 Primal inf 9.5338694e-06 (129) Dual inf 1.4794275e+17 (457)
3067  Obj 263.70776 Primal inf 9.5338684e-06 (129) Dual inf 1.4774997e+17 (494)
3069  Obj 263.70776 Primal inf 9.4362785e-06 (128) Dual inf 1.3470689e+17 (618)
3072  Obj 263.71298 Primal inf 9.3629398e-06 (127) Dual inf 1.5698637e+17 (482)
3076  Obj 256.53006 Primal inf 8.7450789e-06 (129) Dual inf 1.4715594e+16 (484)
3081  Obj 256.11466 Primal inf 8.6364837e-06 (127) Dual inf 1.6917832e+16 (440)
3088  Obj 255.01224 Primal inf 8.3507187e-06 (123) Dual inf 2.3868616e+16 (451)
3097  Obj 253.68885 Primal inf 8.0267361e-06 (120) Dual inf 1.8666127e+16 (534)
3109  Obj 206.22995 Primal inf 6.7074453e-06 (123) Dual inf 2.9312337e+16 (471)
3124  Obj 203.98155 Primal inf 6.0293496e-06 (123) Dual inf 1.736557e+16 (568)
3143  Obj 202.25828 Primal inf 5.6773102e-06 (121) Dual inf 2.0312973e+16 (435)
3167  Obj 185.82661 Primal inf 4.5924786e-06 (127) Dual inf 7.890085e+15 (428)
3197  Obj 152.8656 Primal inf 3.1225615e-06 (114) Dual inf 3.576849e+15 (534)
3235  Obj 139.68837 Primal inf 1.5393807e-06 (113) Dual inf 7.1072378e+15 (557)
3283  Obj 94.367616 Primal inf 7.9457012e-07 (132) Dual inf 3.904761e+15 (627)
3343  Obj 84.21207 Primal inf 3.4591038e-07 (112) Dual inf 1.2598788e+15 (1176)
3418  Obj 84.955698 Primal inf 2.4581696e-07 (95) Dual inf 5.1337746e+15 (988)
3512  Obj 80.397024 Primal inf 1.4365847e-07 (60) Dual inf 3.2264244e+14 (458)
3630  Obj 85.357756 Primal inf 6.8897511e-08 (27) Dual inf 1.6422159e+15 (435)
3778  Obj 81.046819 Dual inf 1.4331528e+10 (516)
3948  Obj 60.204038 Dual inf 2.1895777e+10 (880)
4120  Obj 54.422032 Dual inf 1.5110648e+10 (939)
4294  Obj 49.241705 Dual inf 6.8724866e+09 (265)
4479  Obj 48.005587 Dual inf 3.5179711e+09 (169)
4666  Obj 46.130113 Dual inf 1.5537037e+08 (73)
4804  Obj 45.786709 Dual inf 5.9042002e-06 (6)
4804  Obj 45.786709
Optimal - objective value 45.786709
After Postsolve, objective 45.786709, infeasibilities - dual 0.00011828636 (2), primal 0.00017483103 (593)
Presolved model was optimal, full model needs cleaning up
0  Obj 51.464925 Primal inf 0.016551991 (160) Dual inf 5.8723649e-06 (1)
200  Obj 51.643879 Primal inf 0.06113929 (106)
400  Obj 51.799895 Primal inf 0.00023855905 (34) Dual inf 1.3070935e-09 (3)
470  Obj 51.799895
470  Obj 51.799895 Dual inf 0.00054016871 (4)
Optimal - objective value 51.799895
Optimal objective 51.79989524 - 5274 iterations time 0.742, Presolve 0.01
@SBuercklin
Copy link
Author

I made the following change to Cbc.jl/src/MOI_wrapper/MOI_wrapper.jl on master with [email protected] which should guarantee that the tolerances are set to a fixed value of 1e-9:

function MOI.optimize!(model::Optimizer)
    if !isempty(model.variable_start)
        columns = fill(Cint(0), length(model.variable_start))
        values = fill(0.0, length(model.variable_start))
        for (i, (variable, value)) in enumerate(model.variable_start)
            columns[i] = Cint(variable.value - 1)
            values[i] = value
        end
        Cbc_setMIPStartI(model, length(columns), columns, values)
    end
    t = time()
    model.variable_primal = nothing
    model.constraint_primal = nothing

    # Added the following lines to fix tolerances to 1e-9
    MOI.set(model, MOI.RawOptimizerAttribute("dualTolerance"), 1e-9)
    MOI.set(model, MOI.RawOptimizerAttribute("primalTolerance"), 1e-9)

    model.Cbc_solve_return_code = Cbc_solve(model)
    model.has_solution = _result_count(model)
    model.solve_time = time() - t
    model.termination_status = _termination_status(model)
    return
end

and the resulting optimization is unchanged:

julia> println("Optimized objective: $(MOI.get(optimizer, MOI.ObjectiveValue()))")
Optimized objective: 51.76590549946883

julia> println("Optimized objective2: $(MOI.get(optimizer2, MOI.ObjectiveValue()))")
Optimized objective2: 51.76590549946883

@odow
Copy link
Member

odow commented Dec 12, 2022

This is an upstream issue: coin-or/Cbc#512. It is not a bug in Cbc.jl.

We forward all parameters to Cbc_setParameter.

In 2.10.3 we used to use a patched version of Cbc that didn't forward LPs to Clp, but instead pretended that LPs were in fact MIPs (so no duals were returned). Now we use the upstream version of Cbc with no patches.

@odow odow added the Upstream Issue with upstream library label Dec 12, 2022
@odow
Copy link
Member

odow commented Dec 12, 2022

Closing as a duplicate of #168

@odow
Copy link
Member

odow commented Dec 12, 2022

@SBuercklin: the waiting time for a fix in Cbc is unknown. I'd encourage you to use HiGHS.jl instead.

@odow
Copy link
Member

odow commented Dec 12, 2022

Here's a reproducer with just the C API:

julia> using Cbc

julia> model = Cbc_newModel()
Ptr{Nothing} @0x00007fce3926e7b0

julia> Cbc_readMps(model, "/tmp/model-w-objective.mps")
Coin0008I no_name read with 0 errors
0

julia> Cbc_setParameter(model, "primalTolerance", "1e-9")

julia> Cbc_setParameter(model, "dualTolerance", "1e-9")

julia> Cbc_solve(model)
Presolve 7341 (-7077) rows, 3175 (-2231) columns and 21593 (-14717) elements
Perturbing problem by 0.001% of 546.62548 - largest nonzero change 0.00064574999 ( 5.8935995%) - largest zero change 0.00063651655
0  Obj -0.24043638 Primal inf 47.699152 (376) Dual inf 10.635801 (353) w.o. free dual inf (0)
221  Obj -1.6384893e+11 Primal inf 2.3379433e+14 (1922) Dual inf 3.977543 (132) w.o. free dual inf (0)
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
End of values pass after 221 iterations
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
442  Obj 8.1587866e+14 Primal inf 9.6050008e+11 (1331) Dual inf 4.4709653e+17 (1360) w.o. free dual inf (931)
663  Obj 8.1587866e+14 Primal inf 9.5613969e+11 (1211) Dual inf 2.5613355e+17 (1104) w.o. free dual inf (675)
884  Obj 8.1588162e+14 Primal inf 9.5404945e+11 (1046) Dual inf 1.2334758e+17 (1002) w.o. free dual inf (616)
1105  Obj 8.1588162e+14 Primal inf 9.5404945e+11 (857) Dual inf 3.1418242e+16 (782) w.o. free dual inf (429)
1326  Obj 8.1588186e+14 Primal inf 6.4679477e+11 (727) Dual inf 1.6737373e+17 (707) w.o. free dual inf (398)
1547  Obj 8.1588347e+14 Primal inf 2.9117093e+11 (339) Dual inf 6.7952521e+16 (436) w.o. free dual inf (224)
1768  Obj 82412.24 Primal inf 0.83471689 (17) Dual inf 6.6106839e+16 (359) w.o. free dual inf (285)
1989  Obj 130.53507 Primal inf 5.3395488e-05 (46) Dual inf 8.2177328e+15 (565)
2123  Obj 384.14878 Primal inf 3.2575585e-06 (2) Dual inf 5.2062717e+13 (459)
2264  Obj 61.881431 Dual inf 1.0944411e+10 (1093)
2447  Obj 56.415868 Dual inf 917903.61 (583)
2577  Obj 56.415774 Dual inf 1545282.5 (286)
2663  Obj 55.97662 Dual inf 799966.9 (236)
2773  Obj 53.583323 Dual inf 4.0326197e+08 (961)
2908  Obj 25.724354 Dual inf 552150.68 (680)
3062  Obj 17.144506 Dual inf 182481.78 (631)
3223  Obj 13.926879 Dual inf 477402.35 (523)
3401  Obj 13.428826
Optimal - objective value 13.428826
After Postsolve, objective 13.428826, infeasibilities - dual 1.3518109e-05 (2), primal 0.0029425297 (1012)
Presolved model was optimal, full model needs cleaning up
0  Obj 13.561825 Primal inf 0.00032149222 (443) Dual inf 4.1380456e-06 (2)
0  Obj 13.561825 Primal inf 0.00032149222 (443) Dual inf 1.1610145e+13 (950)
200  Obj 14.074781 Primal inf 0.00020182602 (348) Dual inf 2.7634662e+12 (731)
400  Obj 14.079213 Primal inf 0.00020173392 (348) Dual inf 1.959684e+12 (661)
600  Obj 14.184701 Primal inf 0.00019993733 (348) Dual inf 1.5863075e+12 (652)
800  Obj 15.179129 Primal inf 0.00018928311 (348) Dual inf 1.1726357e+13 (754)
1000  Obj 30.770223 Primal inf 0.0001047261 (283) Dual inf 3.1623539e+12 (755)
1200  Obj 37.119592 Primal inf 1.6868928e-05 (27) Dual inf 1.2025406e+12 (542)
1400  Obj 39.706806 Primal inf 1.5473725e-05 (17) Dual inf 5.6315568e+12 (520)
1600  Obj 43.338303 Dual inf 2.8691436e+08 (1273)
1800  Obj 38.262854 Dual inf 45177738 (377)
2000  Obj 31.997342 Dual inf 1.0712852e+08 (400)
2200  Obj 26.493529 Dual inf 1.2118885e+08 (1039)
2400  Obj 26.419387 Dual inf 1.3088092e+08 (1007)
2600  Obj 23.549975 Dual inf 33438285 (386)
2771  Obj 21.92414 Dual inf 12304730 (204)
2971  Obj 19.425851 Dual inf 14721963 (229)
3171  Obj 18.42455 Dual inf 571858.61 (147)
3325  Obj 18.154071 Dual inf 6943914.1 (177)
3525  Obj 18.04515 Dual inf 55.000607 (55)
3598  Obj 18.045134
Optimal - objective value 18.045134
Optimal objective 18.04513356 - 6999 iterations time 1.682, Presolve 0.01
0

julia> Cbc_getObjValue(model)
18.045133561135206

julia> Cbc_deleteModel(model)

But the numerics are really bad with your model. You should have no confidence that Cbc is finding a feasible solution.

julia> Cbc_jll.cbc() do exe
       run(`$(exe) model-w-objective.mps solve`)
       end
Welcome to the CBC MILP Solver 
Version: 2.10.8 
Build Date: Oct 26 2022 

command line - /Users/oscar/.julia/artifacts/8694b73659baccd37a0259ce6797aaab9d8cd7f7/bin/cbc model-w-objective.mps solve (default strategy 1)
At line 1 NAME
At line 2 ROWS
At line 14422 COLUMNS
At line 53620 RHS
At line 68039 RANGES
At line 68040 BOUNDS
At line 73448 ENDATA
Problem no_name has 14418 rows, 5406 columns and 36310 elements
Coin0008I no_name read with 0 errors
Presolve 7341 (-7077) rows, 3175 (-2231) columns and 21593 (-14717) elements
Perturbing problem by 0.001% of 546.62548 - largest nonzero change 0.00064574999 ( 5.8935995%) - largest zero change 0.00063651655
0  Obj -0.24043638 Primal inf 47.699152 (376) Dual inf 10.635801 (353) w.o. free dual inf (0)
221  Obj -1.6384893e+11 Primal inf 2.3379433e+14 (1922) Dual inf 3.977543 (132) w.o. free dual inf (0)
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
End of values pass after 221 iterations
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
442  Obj 8.1587866e+14 Primal inf 9.6050008e+11 (1331) Dual inf 4.4709653e+17 (1360) w.o. free dual inf (931)
663  Obj 8.1587866e+14 Primal inf 9.5613969e+11 (1211) Dual inf 2.5613355e+17 (1104) w.o. free dual inf (675)
884  Obj 8.1588162e+14 Primal inf 9.5404945e+11 (1046) Dual inf 1.2334758e+17 (1002) w.o. free dual inf (616)
1105  Obj 8.1588162e+14 Primal inf 9.5404945e+11 (857) Dual inf 3.1418242e+16 (782) w.o. free dual inf (429)
1326  Obj 8.1588186e+14 Primal inf 6.4679477e+11 (727) Dual inf 1.6737373e+17 (707) w.o. free dual inf (398)
1547  Obj 8.1588347e+14 Primal inf 2.9117093e+11 (339) Dual inf 6.7952521e+16 (436) w.o. free dual inf (224)
1768  Obj 82412.24 Primal inf 0.83471689 (17) Dual inf 6.6106839e+16 (359) w.o. free dual inf (285)
1989  Obj 130.53507 Primal inf 5.3395488e-05 (46) Dual inf 8.2177328e+15 (565)
2123  Obj 384.14878 Primal inf 3.2575585e-06 (2) Dual inf 5.2062717e+13 (459)
2264  Obj 61.881431 Dual inf 1.0944411e+10 (1093)
2447  Obj 56.415868 Dual inf 917903.61 (583)
2577  Obj 56.415774 Dual inf 1545282.5 (286)
2663  Obj 55.97662 Dual inf 799966.9 (236)
2773  Obj 53.583323 Dual inf 4.0326197e+08 (961)
2908  Obj 25.724354 Dual inf 552150.68 (680)
3062  Obj 17.144506 Dual inf 182481.78 (631)
3223  Obj 13.926879 Dual inf 477402.35 (523)
3401  Obj 13.428826
Optimal - objective value 13.428826
After Postsolve, objective 13.428826, infeasibilities - dual 1.3518109e-05 (2), primal 0.0029425297 (1012)
Presolved model was optimal, full model needs cleaning up
0  Obj 13.561825 Primal inf 0.00032149222 (443) Dual inf 4.1380456e-06 (2)
0  Obj 13.561825 Primal inf 0.00032149222 (443) Dual inf 1.1610145e+13 (950)
200  Obj 14.074781 Primal inf 0.00020182602 (348) Dual inf 2.7634662e+12 (731)
400  Obj 14.079213 Primal inf 0.00020173392 (348) Dual inf 1.959684e+12 (661)
600  Obj 14.184701 Primal inf 0.00019993733 (348) Dual inf 1.5863075e+12 (652)
800  Obj 15.179129 Primal inf 0.00018928311 (348) Dual inf 1.1726357e+13 (754)
1000  Obj 30.770223 Primal inf 0.0001047261 (283) Dual inf 3.1623539e+12 (755)
1200  Obj 37.119592 Primal inf 1.6868928e-05 (27) Dual inf 1.2025406e+12 (542)
1400  Obj 39.706806 Primal inf 1.5473725e-05 (17) Dual inf 5.6315568e+12 (520)
1600  Obj 43.338303 Dual inf 2.8691436e+08 (1273)
1800  Obj 38.262854 Dual inf 45177738 (377)
2000  Obj 31.997342 Dual inf 1.0712852e+08 (400)
2200  Obj 26.493529 Dual inf 1.2118885e+08 (1039)
2400  Obj 26.419387 Dual inf 1.3088092e+08 (1007)
2600  Obj 23.549975 Dual inf 33438285 (386)
2771  Obj 21.92414 Dual inf 12304730 (204)
2971  Obj 19.425851 Dual inf 14721963 (229)
3171  Obj 18.42455 Dual inf 571858.61 (147)
3325  Obj 18.154071 Dual inf 6943914.1 (177)
3525  Obj 18.04515 Dual inf 55.000607 (55)
3598  Obj 18.045134
Optimal - objective value 18.045134
Optimal objective 18.04513356 - 6999 iterations time 1.922, Presolve 0.05
Total time (CPU seconds):       2.02   (Wallclock seconds):       1.81

Process(`/Users/oscar/.julia/artifacts/8694b73659baccd37a0259ce6797aaab9d8cd7f7/bin/cbc model-w-objective.mps solve`, ProcessExited(0))

julia> Cbc_jll.cbc() do exe
       run(`$(exe) model-w-objective.mps primalTolerance=1e-9 solve`)
       end
Welcome to the CBC MILP Solver 
Version: 2.10.8 
Build Date: Oct 26 2022 

command line - /Users/oscar/.julia/artifacts/8694b73659baccd37a0259ce6797aaab9d8cd7f7/bin/cbc model-w-objective.mps primalTolerance=1e-9 solve (default strategy 1)
At line 1 NAME
At line 2 ROWS
At line 14422 COLUMNS
At line 53620 RHS
At line 68039 RANGES
At line 68040 BOUNDS
At line 73448 ENDATA
Problem no_name has 14418 rows, 5406 columns and 36310 elements
Coin0008I no_name read with 0 errors
primalTolerance was changed from 1e-07 to 1e-09
Presolve 7341 (-7077) rows, 3175 (-2231) columns and 21593 (-14717) elements
Perturbing problem by 0.001% of 546.62548 - largest nonzero change 0.00055587184 ( 5.0733734%) - largest zero change 0.00054792355
0  Obj -0.240385 Primal inf 47.699527 (376) Dual inf 10.636118 (353) w.o. free dual inf (0)
221  Obj -1.6384972e+11 Primal inf 2.3379433e+14 (1922) Dual inf 3.9776618 (132) w.o. free dual inf (0)
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
End of values pass after 221 iterations
221  Obj -6.1432412e+09 Primal inf 2.2208601e+14 (1922) Dual inf 1.3488867e+18 (1509) w.o. free dual inf (1024)
442  Obj 8.1587866e+14 Primal inf 9.6062735e+11 (1335) Dual inf 4.5160925e+17 (1361) w.o. free dual inf (934)
663  Obj 8.1587866e+14 Primal inf 9.5578775e+11 (1215) Dual inf 2.6125925e+17 (1106) w.o. free dual inf (679)
884  Obj 8.1588162e+14 Primal inf 9.5404936e+11 (1047) Dual inf 1.2471336e+17 (1006) w.o. free dual inf (616)
1105  Obj 8.1588162e+14 Primal inf 9.5404936e+11 (862) Dual inf 3.4730788e+16 (786) w.o. free dual inf (433)
1326  Obj 7.7935097e+14 Primal inf 3.086179e+11 (390) Dual inf 2.7203701e+16 (452) w.o. free dual inf (246)
1547  Obj 141.66128 Primal inf 0.00011985785 (126) Dual inf 2.1058158e+17 (798) w.o. free dual inf (714)
1733  Obj 432.09412 Primal inf 1.3409578e-05 (45) Dual inf 6.5357831e+16 (735) w.o. free dual inf (651)
1954  Obj 432.07726 Primal inf 1.3406235e-05 (44) Dual inf 5.191735e+14 (699) w.o. free dual inf (615)
2081  Obj 431.79203 Primal inf 1.3386413e-05 (44) Dual inf 5.2893291e+14 (637) w.o. free dual inf (553)
2212  Obj 431.5402 Primal inf 1.3366411e-05 (44) Dual inf 3.3022969e+16 (591) w.o. free dual inf (533)
2375  Obj 431.48834 Primal inf 1.3359193e-05 (44) Dual inf 9.0646103e+12 (455)
2510  Obj 431.45544 Primal inf 1.3356801e-05 (44) Dual inf 9.2835236e+13 (570)
2665  Obj 431.40232 Primal inf 1.335389e-05 (54) Dual inf 1.2389503e+17 (958)
2841  Obj 428.30033 Primal inf 1.3178888e-05 (45) Dual inf 1.2422285e+16 (546)
3014  Obj 285.79366 Primal inf 1.018485e-05 (132) Dual inf 2.7708233e+16 (430)
3066  Obj 263.70776 Primal inf 9.5338694e-06 (129) Dual inf 1.4794275e+17 (457)
3067  Obj 263.70776 Primal inf 9.5338684e-06 (129) Dual inf 1.4774997e+17 (494)
3069  Obj 263.70776 Primal inf 9.4362785e-06 (128) Dual inf 1.3470689e+17 (618)
3072  Obj 263.71298 Primal inf 9.3629398e-06 (127) Dual inf 1.5698637e+17 (482)
3076  Obj 256.53006 Primal inf 8.7450789e-06 (129) Dual inf 1.4715594e+16 (484)
3081  Obj 256.11466 Primal inf 8.6364837e-06 (127) Dual inf 1.6917832e+16 (440)
3088  Obj 255.01224 Primal inf 8.3507187e-06 (123) Dual inf 2.3868616e+16 (451)
3097  Obj 253.68885 Primal inf 8.0267361e-06 (120) Dual inf 1.8666127e+16 (534)
3109  Obj 206.22995 Primal inf 6.7074453e-06 (123) Dual inf 2.9312337e+16 (471)
3124  Obj 203.98155 Primal inf 6.0293496e-06 (123) Dual inf 1.736557e+16 (568)
3143  Obj 202.25828 Primal inf 5.6773102e-06 (121) Dual inf 2.0312973e+16 (435)
3167  Obj 185.82661 Primal inf 4.5924786e-06 (127) Dual inf 7.890085e+15 (428)
3197  Obj 152.8656 Primal inf 3.1225615e-06 (114) Dual inf 3.576849e+15 (534)
3235  Obj 139.68837 Primal inf 1.5393807e-06 (113) Dual inf 7.1072378e+15 (552)
3283  Obj 94.367616 Primal inf 7.9457012e-07 (132) Dual inf 3.904761e+15 (594)
3343  Obj 84.21207 Primal inf 3.4591038e-07 (112) Dual inf 1.2598788e+15 (1139)
3418  Obj 84.955698 Primal inf 2.4581696e-07 (95) Dual inf 5.1337746e+15 (896)
3512  Obj 80.397024 Primal inf 1.4365847e-07 (60) Dual inf 3.2264244e+14 (419)
3630  Obj 85.357756 Primal inf 6.8897511e-08 (27) Dual inf 1.6422159e+15 (367)
3778  Obj 81.046819 Dual inf 1.4331528e+10 (503)
3948  Obj 60.204038 Dual inf 2.1895777e+10 (880)
4120  Obj 54.422032 Dual inf 1.5110648e+10 (917)
4294  Obj 49.241705 Dual inf 6.8724866e+09 (259)
4479  Obj 48.005587 Dual inf 3.5179711e+09 (169)
4666  Obj 46.130113 Dual inf 1.5537037e+08 (71)
4804  Obj 45.786709 Dual inf 5.7734258e-06 (1)
4804  Obj 45.786709
Optimal - objective value 45.786709
After Postsolve, objective 45.786709, infeasibilities - dual 0.00011828636 (2), primal 0.00017483103 (593)
Presolved model was optimal, full model needs cleaning up
0  Obj 51.464925 Primal inf 0.016551991 (160) Dual inf 5.7733649e-06 (1)
200  Obj 51.643879 Primal inf 0.06113929 (106)
400  Obj 51.799895 Primal inf 0.00023855905 (34)
470  Obj 51.799895
470  Obj 51.799895 Dual inf 0.00053977271 (4)
Optimal - objective value 51.799895
Optimal objective 51.79989524 - 5274 iterations time 1.102, Presolve 0.05
Total time (CPU seconds):       1.21   (Wallclock seconds):       0.97

Note the difference in objective with the difference tolerances. You should reconsider your formulation to avoid

For example, Gurobi prints:

shell> gurobi_cl model-w-objective.mps
Set parameter LogFile to value "gurobi.log"
Using license file /Users/oscar/gurobi.lic

Gurobi Optimizer version 10.0.0 build v10.0.0rc2 (mac64[x86])
Copyright (c) 2022, Gurobi Optimization, LLC

Read MPS format model from file model-w-objective.mps
Reading time = 0.02 seconds
: 14418 rows, 5406 columns, 36310 nonzeros

CPU model: Intel(R) Core(TM) i5-8259U CPU @ 2.30GHz
Thread count: 4 physical cores, 8 logical processors, using up to 8 threads

Optimize a model with 14418 rows, 5406 columns and 36310 nonzeros
Model fingerprint: 0x639f04a7
Coefficient statistics:
  Matrix range     [1e-06, 2e+04]
  Objective range  [3e-06, 8e+05]
  Bounds range     [2e-15, 2e-15]
  RHS range        [1e+00, 1e+00]
Presolve removed 7358 rows and 2518 columns
Presolve time: 0.04s
Presolved: 7060 rows, 2888 columns, 23038 nonzeros

Concurrent LP optimizer: dual simplex and barrier
Showing barrier log only...

Presolve time: 0.05s
Presolved: 2528 rows, 7060 columns, 22678 nonzeros

Ordering time: 0.00s

Barrier statistics:
 Dense cols : 3
 Free vars  : 73
 AA' NZ     : 1.548e+04
 Factor NZ  : 3.034e+04 (roughly 4 MB of memory)
 Factor Ops : 3.980e+05 (less than 1 second per iteration)
 Threads    : 1

                  Objective                Residual
Iter       Primal          Dual         Primal    Dual     Compl     Time
   0   6.72313547e-03 -1.77724512e-15  2.84e+07 1.60e+01  3.61e+03     0s
   1  -8.39782179e+01  3.45848348e+02  2.60e+07 9.17e+00  2.78e+03     0s
   2  -5.40262750e+02  6.29702935e+02  1.51e+06 2.55e+00  4.58e+02     0s
   3  -7.40264338e+01  3.49507149e+02  1.99e+05 9.95e-02  4.68e+01     0s
   4  -6.79099955e+00  1.50539331e+02  2.21e+04 3.06e-02  1.31e+01     0s
   5  -3.25262091e+00  9.51627940e+01  1.69e+04 1.67e-02  7.76e+00     0s
   6   5.77498033e+00  5.16956699e+01  5.96e+03 7.52e-03  3.52e+00     0s
   7   1.86775602e+01  3.73013998e+01  1.37e+03 4.01e-03  1.67e+00     0s
   8   2.73485299e+01  3.59485795e+01  6.08e+02 2.23e-03  9.73e-01     0s
   9   3.41520486e+01  3.62846307e+01  3.02e+02 1.69e-03  6.18e-01     0s
  10   3.66405738e+01  3.70943786e+01  2.21e+02 1.17e-03  4.45e-01     0s
  11   3.89273155e+01  3.89610688e+01  1.00e+02 5.62e-04  2.25e-01     0s
  12   4.00369525e+01  3.92709482e+01  3.58e+01 4.27e-04  1.42e-01     0s
  13   4.07892807e+01  3.94179304e+01  2.17e+01 3.59e-04  1.11e-01     0s
  14   4.13866299e+01  3.95683670e+01  1.70e+01 3.20e-04  1.00e-01     0s
  15   4.18573070e+01  3.99704834e+01  1.43e+01 2.54e-04  8.58e-02     0s
  16   4.21068888e+01  4.02996295e+01  9.28e+00 2.14e-04  7.36e-02     0s
  17   4.30094162e+01  4.01534064e+01  5.12e+00 1.34e-04  4.33e-02     0s
  18   4.50092304e+01  4.04047707e+01  2.25e+00 6.12e-05  2.68e-02     0s
  19   4.56889614e+01  4.12249081e+01  1.59e+00 1.77e-05  2.08e-02     0s
  20   4.61745699e+01  4.12679509e+01  1.27e+00 1.73e-05  2.32e-02     0s
  21   4.73260233e+01  4.15989410e+01  4.96e-01 7.53e-06  1.17e-02     0s
  22   4.86935896e+01  4.17453600e+01  8.39e-02 5.56e-06  3.19e-03     0s
  23   4.95267835e+01  4.21549080e+01  3.92e-02 2.29e-06  1.03e-03     0s
  24   4.95195631e+01  4.22348580e+01  3.91e-02 2.26e-06  1.04e-03     0s
  25   4.94289498e+01  4.22594926e+01  3.65e-02 2.25e-06  1.14e-03     0s
  26   4.96008557e+01  4.26355923e+01  3.18e-02 2.13e-06  1.26e-03     0s
  27   4.95644477e+01  4.27271074e+01  3.01e-02 2.10e-06  1.22e-03     0s
  28   4.97276950e+01  4.29039998e+01  2.59e-02 2.05e-06  8.49e-04     0s
  29   4.97619183e+01  4.29851416e+01  2.46e-02 2.02e-06  7.75e-04     0s
  30   4.97638866e+01  4.30593701e+01  2.44e-02 2.00e-06  8.07e-04     0s
  31   4.97735721e+01  4.31733875e+01  2.41e-02 1.97e-06  8.38e-04     0s
  32   4.98036185e+01  4.33928919e+01  2.27e-02 1.90e-06  7.48e-04     0s
  33   4.99355055e+01  4.32352405e+01  1.94e-02 1.95e-06  9.41e-04     0s
  34   5.00538519e+01  4.31258950e+01  1.67e-02 1.98e-06  1.73e-03     0s
  35   5.00794971e+01  4.42304786e+01  1.60e-02 1.67e-06  2.63e-03     0s
  36   5.00815089e+01  4.41939592e+01  1.58e-02 1.69e-06  2.65e-03     0s
  37   5.00864068e+01  4.43845358e+01  1.49e-02 1.63e-06  2.53e-03     0s
  38   5.02425746e+01  4.45045046e+01  1.18e-02 1.60e-06  2.54e-03     0s
  39   5.03387199e+01  4.50073624e+01  9.19e-03 1.94e-06  2.49e-03     0s
  40   5.03578392e+01  4.51642503e+01  8.67e-03 2.03e-06  2.36e-03     0s
  41   5.04035465e+01  4.52813753e+01  7.49e-03 2.10e-06  2.10e-03     0s
  42   5.04067249e+01  4.54401336e+01  7.33e-03 2.03e-06  2.01e-03     0s
  43   5.04737505e+01  4.54981518e+01  6.36e-03 1.76e-06  1.75e-03     0s
  44   5.05422339e+01  4.55085967e+01  5.49e-03 1.74e-06  1.62e-03     0s
  45   5.06616384e+01  4.57881008e+01  4.05e-03 1.45e-06  1.08e-03     0s
  46   5.06706333e+01  4.58333652e+01  3.96e-03 1.45e-06  1.03e-03     0s
  47   5.07008297e+01  4.59081367e+01  3.69e-03 1.29e-06  9.72e-04     0s
  48   5.07568963e+01  4.59593422e+01  3.18e-03 1.26e-06  9.37e-04     0s
  49   5.07658280e+01  4.59484696e+01  3.02e-03 1.26e-06  9.95e-04     0s
  50   5.07948847e+01  4.60592385e+01  2.61e-03 1.23e-06  9.66e-04     0s
  51   5.08551589e+01  4.61975841e+01  2.17e-03 1.20e-06  7.66e-04     0s
  52   5.08731590e+01  4.61900635e+01  2.06e-03 1.20e-06  7.18e-04     0s
  53   5.08827117e+01  4.62760005e+01  1.99e-03 1.18e-06  6.62e-04     0s
  54   5.09174380e+01  4.62575646e+01  1.80e-03 1.19e-06  6.55e-04     0s
  55   5.10319562e+01  4.63344558e+01  1.27e-03 1.17e-06  7.13e-04     0s
  56   5.11443977e+01  4.63567717e+01  8.03e-04 1.16e-06  8.03e-04     0s
  57   5.13719404e+01  4.64970813e+01  3.05e-04 1.41e-06  8.86e-04     0s
  58   5.14383377e+01  4.66319081e+01  2.49e-04 1.48e-06  4.46e-04     0s
  59   5.14560555e+01  4.67806041e+01  2.12e-04 1.50e-06  5.61e-04     0s
  60   5.16507155e+01  4.73800014e+01  8.68e-05 1.66e-06  2.04e-04     0s
  61   5.16717960e+01  4.74134787e+01  8.29e-05 1.65e-06  1.84e-04     0s
  62   5.16735515e+01  4.76242058e+01  8.17e-05 1.57e-06  2.03e-04     0s
  63   5.16651438e+01  4.77550958e+01  7.43e-05 1.52e-06  2.48e-04     0s
  64   5.16712961e+01  4.77628144e+01  7.28e-05 1.51e-06  2.40e-04     0s
  65   5.16870913e+01  4.79339536e+01  6.86e-05 1.14e-06  3.77e-04     0s
  66   5.16954349e+01  4.81069618e+01  6.58e-05 1.09e-06  3.46e-04     0s
  67   5.16703087e+01  4.82860864e+01  6.00e-05 1.07e-06  2.41e-04     0s
  68   5.17043307e+01  4.83202369e+01  4.92e-05 1.06e-06  1.64e-04     0s
  69   5.17223922e+01  4.84554831e+01  4.70e-05 1.11e-06  2.21e-04     0s
  70   5.17282356e+01  4.87138357e+01  4.52e-05 1.12e-06  1.75e-04     0s
  71   5.17300867e+01  4.87854781e+01  4.36e-05 1.09e-06  1.58e-04     0s
  72   5.17307456e+01  4.88535342e+01  4.18e-05 1.07e-06  1.54e-04     0s
  73   5.17292411e+01  4.92860491e+01  3.73e-05 9.08e-07  1.82e-04     0s
  74   5.17305547e+01  4.95356438e+01  3.46e-05 8.16e-07  1.62e-04     0s

Barrier performed 74 iterations in 0.23 seconds (0.21 work units)
Barrier solve interrupted - model solved by another algorithm


Solved with dual simplex
Extra simplex iterations after uncrush: 143
Iteration    Objective       Primal Inf.    Dual Inf.      Time
   22155    5.1006051e+01   0.000000e+00   0.000000e+00      4s

Solved in 22155 iterations and 3.74 seconds (8.11 work units)
Optimal objective  5.100605113e+01

Note the different objective again, the large matrix range, and the 1e-15(!!!!) bound range.

@SBuercklin
Copy link
Author

The model in use is just for validation that everything on the backend is working, not a practical model, but I'll pass your feedback along to those who are working on the model more directly. We're going to be trying out alternative solvers (including HiGHS.jl) as well, we were just trying to get Cbc working on latest to have a standard to compare everything against.

Thanks for your help Oscar!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Upstream Issue with upstream library
Development

No branches or pull requests

2 participants