Operations Research, Optimization, Algorithms, Programming, Hands On Tutorials.
integer solution considering only columns produced in the LP. sol_round = linprog(c, A_ub=-A, b_ub=-d, bounds=(0, np.inf), integrality=0) print(f"Rounding solution {np.ceil(sol_round.x).sum()}") sol = linprog(c, A_ub=-A, b_ub=-d, bounds=(0, np.inf), integrality=1) print(f"Integer solution: