Skip to content

Bug repeatedly resolving an LP with rows deleted in between #2267

@odow

Description

@odow

By the power of git bisect, this commit broke SDDP.jl: b03608c

commit b03608c811f4ea329b60550df86477d2745ca3cf
Author: JAJHall <[email protected]>
Date:   Mon Jan 13 17:50:34 2025 +0000

    All unit tests pass

 src/lp_data/HStruct.h         | 14 ++++++++++++--
 src/lp_data/Highs.cpp         |  9 ++-------
 src/lp_data/HighsSolution.cpp | 33 ++++++++++++++++++++-------------
 src/simplex/HApp.h            | 12 ++++++++++++
 4 files changed, 46 insertions(+), 22 deletions(-)

It is not present in v1.9.0, but it is present in v1.10.0.

I'm still chasing a minimal reproducible example. But for now... we have this horrific thing which solves a multistage stochastic program:

using SDDP, HiGHS, Random
function main(; seed)
    Random.seed!(seed)
    S = [0 1 2; 0 0 1; 0 0 0]
    days = [60, 60, 245]
    D = [210, 210, 858]
    q = [4.5, 5.5, 6.5]
    b = [30 75 37.5; 15 37.5 18.25; 7.5 18.75 9.325]
    r = [5, 6, 7]
    graph = SDDP.MarkovianGraph([
        ones(Float64, 1, 1),
        [0.14 0.69 0.17],
        [0.14 0.69 0.17; 0.14 0.69 0.17; 0.14 0.69 0.17],
        [0.14 0.69 0.17; 0.14 0.69 0.17; 0.14 0.69 0.17],
    ])
    model = SDDP.PolicyGraph(
        graph;
        lower_bound = 0.0,
        direct_mode = true,
        optimizer = HiGHS.Optimizer,
    ) do sp, (t, j)
        @variable(sp, 0 <= x_a <= 60, SDDP.State, initial_value = 60)
        @variable(sp, x_b[1:3] >= 0, SDDP.State, initial_value = 0)
        @variable(sp, u[1:5,1:3] >= 0)
        @constraint(sp, x_a.out <= x_a.in)
        if t == 1
            @constraint(sp, [i in 1:3], x_b[i].in == x_b[i].out)
        else
            @expression(sp, e[c in 1:3], x_b[c].in + u[1,c] - u[2,c] - u[3,c] + u[4,c] - u[5,c])
            @constraints(sp, begin
                sum(u[3, :]) >= D[t-1]
                x_b[t-1].out == e[t-1] + x_a.in * b[t-1,j]
                [c = 1:3; c != t - 1], x_b[c].out == e[c]
                sum(x_b[i].out for i in 1:3) <= 3000
                [c in 1:3], u[2, c] <= x_b[c].in
                sum(u[2, :]) <= 3000
            end)
            @stageobjective(
                sp,
                1000 * sum(u[4:5, :]) + 50 * x_a.in +
                sum(0.05 * x_b[i].in * days[t-1] + r[i] * u[1, i] + S[i, t-1] * u[3, i] - q[i] * u[2, i] for i in 1:3)
            )
        end
    end
    SDDP.train(model)
    @assert isapprox(SDDP.calculate_bound(model), 4074.1391; atol = 1e-4)
    return
end

# for seed in 1:100
#     @show seed
#     main(; seed)
# end

main(; seed = 3)

The log file is huge, but here it is:

highs_issue.log

I'll try to find the offending subproblem tomorrow.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions