Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import numpy as np
- import scipy.optimize as scipy
- np.set_printoptions(precision = 4)
- np.set_printoptions(suppress = True)
- #zad1
- A =[[4, 3],
- [1, 1],
- [-1, 0],
- [0, -1]]
- b = [190, 55, 0, 0]
- c = [-23, -17]
- res = scipy.linprog(c, A, b).x
- result = 23 * res[0] + 17 * res[1]
- print("Task 1")
- print("x vector:", res)
- print("Result for F(x) function:", result)
- print("###################################\n")
- #zad2
- A =[[4, 3],
- [1, 1],
- [-1, 0],
- [0, -1],
- [1, 0]]
- b = [190, 55, 0, 0, 47]
- c = [-23, -17]
- res = scipy.linprog(c, A, b).x
- result = 23 * res[0] + 17 * res[1]
- print("Task 2")
- print("x vector:", res)
- print("Result for F(x) function:", result)
- print("###################################\n")
- #zad3
- A =[[4, 3],
- [1, 1],
- [-1, 0],
- [0, -1]]
- b = [190, 55, -48, 0]
- c = [-23, -17]
- res = scipy.linprog(c, A, b).x
- result = 23 * res[0] + 17 * res[1]
- print("Task 3")
- print("x vector:", res)
- print("Result for F(x) function:", result)
- print("###################################\n")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement