You can use LPVisu to visualize Integer Linear Programming problems in Jupyter notebooks. First import the LPVisu class:


In [ ]:
from lp_visu import LPVisu

You can then define a problem:


In [ ]:
# problem definition
A = [[1.0, 0.0], [1.0, 2.0], [2.0, 1.0]]
b = [8.0, 15.0, 18.0]
c = [-4.0, -3.0]

x1_bounds = (0, None)
x2_bounds = (0, None)

# GUI bounds
x1_gui_bounds = (-1, 16)
x2_gui_bounds = (-1, 10)

To draw the polygon, create an object of type LPVisu. Do not forget to use the notebook parameter. Use the integers parameter to draw integers inside the polygon.


In [ ]:
visu = LPVisu(A, b, c,
              x1_bounds, x2_bounds,
              x1_gui_bounds, x2_gui_bounds,
              scale = 0.8,
              integers = True)

You can add cuts with the A_cuts and b_cuts parameters.


In [ ]:
visu = LPVisu(A, b, c,
              x1_bounds, x2_bounds,
              x1_gui_bounds, x2_gui_bounds,
              scale = 0.8,
              A_cuts = [[0.0, 1.0]], b_cuts = [6.0], integers = True)