Polyhedron of JuMP model with Polyhedra or Lazyset

Polyhedra has what you want:

using JuMP
import CDDLib
import Makie
import GLMakie
import Polyhedra

function j_poly()
    q = [109,115,102,114,108]
    e = [40 150 2.5 50 40; 40 50 2.5 50 40; 40 50 2.5 50 40; 40 50 2.5 50 40; 40 50 102.5 50 40;40 50 0 105 104;40 105 2 2 2; 104 2 2 2 3]
    l = [16, 18, 10, 13, 31, 16, 18, 10]
    p = [100, 105, 90, 105, 95]
    f  = [0.01, 0.012, 0.016, 0.019, 0.022, 0.027, 0.03, 0.045]
    m = Model()
    @variable(m,0<=x[1:5]<=1)
    @constraint(m,c1,sum(x[i]*q[i] for i in 1:5) == 100)
    @constraint(m,c2[k=1:8],sum((l[j] - sum(e[j,i]*x[i] for i in 1:5)*(1+f[j])^(-j)) for j in 1:k) <=30*(1+f[k])^(-k))
    @objective(m,Min,sum(p[i]*x[i] for i in 1:5))
    return m, x
end

model, _ = j_poly()

poly = Polyhedra.polyhedron(model, CDDLib.Library())
poly = Polyhedra.eliminate(poly, [4, 5])

mesh = Polyhedra.Mesh(poly)
Makie.mesh(mesh; color=:blue)

Docs:

1 Like