Right solver for JuMP to find every solution of a linear system of equations with integer solutions

@mtanneau: I gave a pure-Julia constraint-programming solution one post above :wink:

To finish it off, define

function integerize(X, i)
    Xi = X[i]
    a = ceil(Xi.lo)
    b = floor(Xi.hi)
    
    if a > b
        return emptyinterval(X)
    end

    return setindex(X, interval(a, b), i)
end 

function integerize(X)
    for i in 1:length(X)
        X = integerize(X, i)
    end
    
    return X
end

Then

julia> p = pave(C1 ∩ C2 ∩ C3 ∩ C4, X, 1e-2);

julia> unique(integerize.(p.boundary))
3-element Array{IntervalBox{4,Float64},1}:
 [2, 2] Γ— [1, 1] Γ— [0, 0] Γ— [1, 1]
 βˆ… Γ— βˆ… Γ— βˆ… Γ— βˆ…
 [1, 1] Γ— [2, 2] Γ— [1, 1] Γ— [0, 0]

give the desired solutions!

1 Like