21 lines
384 B
Python
21 lines
384 B
Python
import numpy as np
|
|
import tabulate as tb
|
|
from SimplexMethod import SimplexMethod
|
|
|
|
table = np.array([
|
|
[18, 1, 3],
|
|
[16, 2, 1],
|
|
[5, 0, 1],
|
|
[21, 3, 0],
|
|
[0, -2, -3]
|
|
])
|
|
|
|
result = np.zeros(2)
|
|
S = SimplexMethod(table)
|
|
table_result = S.calculate(result)
|
|
|
|
print(tb.tabulate(table_result))
|
|
|
|
print("\n")
|
|
print(f"X[max] = {result}")
|
|
print(f"F[max] = {table_result[-1][0]:.2f}") |