Closed hellemo closed 2 years ago
Thanks. I must have missed an argument somewhere. Looks difficult to debug!
grid4.mps: https://gist.github.com/hellemo/7b549f496f7a6ad2803d0e53794c9330
Do any other problems work? What if you manually try to formulate a problem in JuMP?
Yes, I originally formulated the problem directly in JuMP, and that also crashes.
I was able to solve some trivial problems, both LP and MILP, and also the same problem as above without any binary constraints (LP), but adding a single binary constraint causes a crash during presolve.
However, if I manually add a constraint to the binary variables to also be <= 1, HiGHS succeeds in solving the problem.
@variable(model, x[M, M, L] <=1, Bin) # works
@variable(model, x[M, M, L], Bin) # crashes
@variable(model, x[M, M, L]) # works
Thanks! That gives me a good lead. I'll take a look.
I can't cause your grid.mps
example to crash, but something is definitely wrong. 88 binary + 6 continuous doesn't add to 97...
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 6 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) No symmetry present
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 0 100 0.0s
R 0 0 0 0.00% -33.51968176 -30.0122001 11.69% 638 38 272 452 0.2s
L 0 0 0 0.00% -33.49139743 -31.0559017 7.84% 1055 41 272 563 0.2s
L 0 0 0 0.00% -33.49139743 -31.07071068 7.79% 1055 29 272 589 0.3s
Solving report
Status Optimal
Primal bound -31.0707106781
Dual bound -31.0707106781
Solution status feasible
-31.0707106781 (objective)
0 (bound viol.)
0 (int. viol.)
0 (row viol.)
Timing 0.70 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 3
LP iterations 13220 (total)
11307 (strong br.)
463 (separation)
921 (heuristics)
What is your versioninfo()
?
Happens both on 1.6.3 and 1.7rc2 for me (both on WSL2):
julia> versioninfo()
Julia Version 1.7.0-rc2
Commit f23fc0d27a (2021-10-20 12:45 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-12.0.1 (ORCJIT, skylake)
Environment:
JULIA_COPY_STACKS = 1
JULIA_NUM_THREADS = 4
julia> using JuMP, HiGHS
julia> m = JuMP.read_from_file("grid4.mps");
julia> set_optimizer(m, HiGHS.Optimizer)
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 7 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) No symmetry present
Solving root node LP relaxation
corrupted double-linked list
julia> versioninfo()
Julia Version 1.6.3
Commit ae8452a9e0 (2021-09-23 17:34 UTC)
Platform Info:
OS: Linux (x86_64-pc-linux-gnu)
CPU: Intel(R) Core(TM) i7-8665U CPU @ 1.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-11.0.1 (ORCJIT, skylake)
Environment:
JULIA_COPY_STACKS = 1
JULIA_NUM_THREADS = 4
julia> using JuMP, HiGHS
julia> m = JuMP.read_from_file("grid4.mps");
julia> set_optimizer(m, HiGHS.Optimizer)
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 7 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) No symmetry present
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 0 100 0.0s
corrupted double-linked list
signal (6): Aborted
in expression starting at REPL[5]:1
@jajhall any ideas for how to debug?
Is it expected to see things like
97 cols (88 binary, 0 integer, 0 implied int., 6 continuous)
where the sum of the variables doesn't add up?
Odd, indeed. I've just run master on the grid4.mps, and it prints '97 cols (88 binary, 0 integer, 0 implied int., 9 continuous)' The number of continuous variables is an array size rather than an identifier, so maybe it wasn't getting resized. That said, too small sounds unsafe, but it's code of @lgottwald, not me. Whatever the problem might have been, it seems to be fixed. As for the original issue, when "loading via JuMP", can you use HiGHS to print the MPS file?
I think this must be a size issue in HiGHS presolve, because I get non-repeatable behavior, which suggests its accessing an array out of bounds which sometimes contains good or bad data. I can't reproduce the weird number of continuous variables, but the MPS file I did manage to produce looked fine. It solved well with HiGHS and Gurobi, and found the same solution.
julia> using JuMP, HiGHS, HiGHS_jll
julia> m = read_from_file("grid.mps")
A JuMP Model
Minimization problem with:
Variables: 240
Objective function type: AffExpr
`AffExpr`-in-`MathOptInterface.GreaterThan{Float64}`: 315 constraints
`AffExpr`-in-`MathOptInterface.LessThan{Float64}`: 114 constraints
`VariableRef`-in-`MathOptInterface.ZeroOne`: 145 constraints
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia> set_optimizer(m, HiGHS.Optimizer)
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 9 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) No symmetry present
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 0 100 0.0s
L 0 0 0 0.00% -33.226229 -30.0559017 10.55% 6824 49 624 1176 0.7s
L 0 0 0 0.00% -33.226229 -31.0559017 6.99% 6307 36 624 1180 0.8s
B 0 0 0 0.00% -33.226229 -31.0559017 6.99% 6308 36 624 1816 0.9s
B 4 0 2 50.00% -33.226229 -31.07071068 6.94% 6331 36 664 15347 1.3s
B 4 0 2 50.00% -33.226229 -31.07071068 6.94% 6333 36 664 15347 1.3s
Solving report
Status Optimal
Primal bound -31.0707106781
Dual bound -31.0707106781
Solution status feasible
-31.0707106781 (objective)
0 (bound viol.)
0 (int. viol.)
0 (row viol.)
Timing 1.30 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 5
LP iterations 16611 (total)
14257 (strong br.)
1076 (separation)
640 (heuristics)
julia> h = unsafe_backend(m)
A HiGHS model with 240 columns and 429 rows.
julia> for info in h.binaries
Highs_changeColBounds(
h,
info.column,
max(0.0, info.lower),
min(1.0, info.upper),
)
end
julia> Highs_writeModel(h, "jump.mps")
WARNING: There are empty or excessively-long Column names: using constructed names with prefix C
WARNING: There are empty or excessively-long Row names: using constructed names with prefix R
1
julia> HiGHS_jll.highs(exe -> run(`$(exe) ./grid.mps`))
Running HiGHS 1.1.0 [date: , git hash: ]
Copyright (c) 2021 ERGO-Code under MIT licence terms
Number of BV entries in BOUNDS section is 145
MIP grid has 429 rows; 240 cols; 1103 nonzeros; 145 integer variables
Presolving model
178 rows, 213 cols, 669 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 9 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) Found 1 generators
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 0 123 0.0s
L 0 0 0 0.00% -33.36608558 -30.03535534 11.09% 5321 48 404 772 0.4s
L 0 0 0 0.00% -33.36608558 -31.03535534 7.51% 5273 25 404 798 0.5s
B 0 0 0 0.00% -33.36608558 -31.0559017 7.44% 5273 25 404 935 0.5s
B 0 0 0 0.00% -33.36608558 -31.07071068 7.39% 5281 25 420 935 0.7s
Solving report
Status Optimal
Primal bound -31.0707106781
Dual bound -31.0707106781
Solution status feasible
-31.0707106781 (objective)
0 (bound viol.)
0 (int. viol.)
0 (row viol.)
Timing 0.77 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 1
LP iterations 11269 (total)
10063 (strong br.)
649 (separation)
163 (heuristics)
Process(`/Users/oscar/.julia/artifacts/1041abffa4433b76e0e27c0777c8307a69a26c6f/bin/highs ./grid.mps`, ProcessExited(0))
julia> HiGHS_jll.highs(exe -> run(`$(exe) ./jump.mps`))
Running HiGHS 1.1.0 [date: , git hash: ]
Copyright (c) 2021 ERGO-Code under MIT licence terms
Number of BV entries in BOUNDS section is 145
MIP jump has 429 rows; 240 cols; 1103 nonzeros; 145 integer variables
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 9 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) Found 1 generators
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 0 100 0.0s
H 0 0 0 0.00% -33.226229 -29.0559017 14.35% 6825 49 622 1176 0.7s
L 0 0 0 0.00% -33.226229 -30.03535534 10.62% 6826 49 623 1176 0.7s
B 0 0 0 0.00% -33.226229 -31.0559017 6.99% 6309 36 623 1536 0.8s
B 0 0 0 0.00% -33.226229 -31.07071068 6.94% 6313 36 629 1536 0.9s
Solving report
Status Optimal
Primal bound -31.0707106781
Dual bound -31.0707106781
Solution status feasible
-31.0707106781 (objective)
0 (bound viol.)
0 (int. viol.)
0 (row viol.)
Timing 1.02 (total)
0.00 (presolve)
0.00 (postsolve)
Nodes 1
LP iterations 9036 (total)
7174 (strong br.)
1076 (separation)
360 (heuristics)
Process(`/Users/oscar/.julia/artifacts/1041abffa4433b76e0e27c0777c8307a69a26c6f/bin/highs ./jump.mps`, ProcessExited(0))
Othertimes I get this
julia> using JuMP, HiGHS, HiGHS_jll
julia> m = read_from_file("grid.mps")
A JuMP Model
Minimization problem with:
Variables: 240
Objective function type: AffExpr
`AffExpr`-in-`MathOptInterface.GreaterThan{Float64}`: 315 constraints
`AffExpr`-in-`MathOptInterface.LessThan{Float64}`: 114 constraints
`VariableRef`-in-`MathOptInterface.ZeroOne`: 145 constraints
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia> set_optimizer(m, HiGHS.Optimizer)
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 5 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) No symmetry present
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -inf inf inf 0 0 18 0 0.0s
H 0 0 0 0.00% -inf -28.03535534 9999.00% 0 0 36 0 0.0s
H 0 0 0 0.00% -inf -31.03535534 9999.00% 1 0 36 0 0.0s
WARNING: Untransformed solution with objective -32.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0354 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0354 is violated by 1 for the original model
WARNING: Untransformed solution with objective -33.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0559 is violated by 1 for the original model
WARNING: Untransformed solution with objective -34.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0559 is violated by 1 for the original model
H 3251 7 1538 48.36% -inf -31.0559017 9999.00% 14 0 7618 4529 2.8s
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -32.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
WARNING: Untransformed solution with objective -31.0707 is violated by 1 for the original model
julia> using JuMP, HiGHS, HiGHS_jll
julia> m = read_from_file("grid.mps")
A JuMP Model
Minimization problem with:
Variables: 240
Objective function type: AffExpr
`AffExpr`-in-`MathOptInterface.GreaterThan{Float64}`: 315 constraints
`AffExpr`-in-`MathOptInterface.LessThan{Float64}`: 114 constraints
`VariableRef`-in-`MathOptInterface.ZeroOne`: 145 constraints
Model mode: AUTOMATIC
CachingOptimizer state: NO_OPTIMIZER
Solver name: No optimizer attached.
julia> set_optimizer(m, HiGHS.Optimizer)
julia> optimize!(m)
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
julia(38128,0x1123e4e00) malloc: Incorrect checksum for freed object 0x7fa67281a488: probably modified after being freed.
Corrupt value: 0x700000007000000
julia(38128,0x1123e4e00) malloc: *** set a breakpoint in malloc_error_break to debug
signal (6): Abort trap: 6
in expression starting at REPL[21]:1
Looks like this has been fixed with v1.2 in the od/v1.2 branch:
julia> VERSION
v"1.7.2"
(dev-highs) pkg> st
Status `~/projects/dev-highs/Project.toml`
[87dc4568] HiGHS v0.3.2 `~/code/HiGHS.jl`
[4076af6c] JuMP v0.22.3
julia> using JuMP, HiGHS
julia> m = JuMP.read_from_file("grid4.mps");
julia> set_optimizer(m, HiGHS.Optimizer);
julia> optimize!(m);
Presolving model
334 rows, 228 cols, 996 nonzeros
148 rows, 183 cols, 609 nonzeros
148 rows, 97 cols, 437 nonzeros
148 rows, 97 cols, 437 nonzeros
Solving MIP model with:
148 rows
97 cols (88 binary, 0 integer, 0 implied int., 9 continuous)
437 nonzeros
( 0.0s) Starting symmetry detection
( 0.0s) Found 1 generators
Solving root node LP relaxation
Nodes | B&B Tree | Objective Bounds | Dynamic Constraints | Work
Proc. InQueue | Leaves Expl. | BestBound BestSol Gap | Cuts InLp Confl. | LpIters Time
0 0 0 0.00% -34.83199078 inf inf 0 0 9 108 0.0s
L 0 0 0 0.00% -33.2970431 -31.07071068 7.17% 5726 48 406 802 0.9s
Solving report
Status Optimal
Primal bound -31.0707106781
Dual bound -31.0707106781
Gap 0% (tolerance: 0.01%)
Solution status feasible
-31.0707106781 (objective)
0 (bound viol.)
2.84217094304e-14 (int. viol.)
0 (row viol.)
Timing 1.36 (total)
0.01 (presolve)
0.00 (postsolve)
Nodes 3
LP iterations 5705 (total)
3526 (strong br.)
694 (separation)
1160 (heuristics)
I noticed the update and gave HiGHS another try with the same test problem as in https://github.com/jump-dev/HiGHS.jl/issues/65
While the updated version of HiGHS_jll solves the problem without problems, it crashes on me when loading via JuMP:
HiGHS_jll can load and solve the same file without issues in the same environment: