Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View hdavid16's full-sized avatar

Hector Perez hdavid16

View GitHub Profile
@hdavid16
hdavid16 / feasible_space.jl
Last active November 2, 2022 23:38
Visualizing an LP using JuMP and Polyhedra
using JuMP, HiGHS, Polyhedra, CDDLib, Plots
# solve LP
m = Model(HiGHS.Optimizer)
x, y = @variable(m, v[i=1:2], lower_bound = 0)
@constraint(m, c[i=1:4], [6,1,-1,0][i]*x + [4,2,1,1][i]*y ≤ [24,6,1,2][i])
@objective(m, Max, x+y)
optimize!(m)
xopt, yopt = value.(v)