MathVM/main.py

24 lines
563 B
Python
Raw Normal View History

2023-12-13 15:36:58 +04:00
import numpy as np
2023-12-13 15:33:09 +04:00
2023-12-13 15:36:58 +04:00
from Simplex import Simplex
2023-12-13 15:33:09 +04:00
2023-12-13 15:36:58 +04:00
table = np.array([[25, -3, 5],
[30, -2, 5],
[10, 1, 0],
[6, 3, -8],
[0, -6, -5]])
2023-12-13 15:33:09 +04:00
2023-12-13 15:36:58 +04:00
result = np.zeros(2)
S = Simplex(table)
table_result = S.calculate(result)
2023-12-13 15:33:09 +04:00
2023-12-13 15:36:58 +04:00
print("Решенная симплекс-таблица:")
for i in range(table_result.shape[0]):
for j in range(table_result.shape[1]):
print(table_result[i, j], end=" ")
print()
2023-12-13 15:33:09 +04:00
2023-12-13 15:36:58 +04:00
print()
print("Решение:")
print("X[1] =", result[0])
print("X[2] =", result[1])