Created
October 22, 2016 07:37
-
-
Save jakwuh/3bbaa3a77f0bcef864a039993156cfe1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from scipy.optimize import linprog | |
c = [-6, -3, 2, 1, 14] # x_1 + x_2 - 2x_3 - x_4 -> max | |
# Ax <= b | |
A = [[0, 0, 0, 1, 2], [3, 0, 2, 0, -4], [0, -1, 3, 0, 0]] | |
b = [-4, 25, 6] | |
x0_bounds = (1, 4) | |
x1_bounds = (-1, 3) | |
x2_bounds = (-2, 2) | |
x3_bounds = (1, 4) | |
x4_bounds = (-3, 1) | |
res = linprog(c, A_ub=A, b_ub=b, bounds=(x0_bounds, x1_bounds, x2_bounds, x3_bounds, x4_bounds), | |
options={"disp": True}) | |
print(res) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment