/
spirzen
/
it-code-examples
Обзор
Документация
Войти
/
spirzen
/
it-code-examples
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/python/mp-9-001/main.py
19 строк
402 B
Spirzen
Code migration pack
09 июн 2026, 01:41
09 июн 2026, 01:41
cebc284
Код
Авторство
О чём код?
from scipy.optimize import linprog # min -Z => c = [-3, -2] c = [-3, -2] A_ub = [ [2, 1], [1, 2], ] b_ub = [8, 8] bounds = [(0, None), (0, None)] res = linprog(c, A_ub=A_ub, b_ub=b_ub, bounds=bounds, method="highs") if res.success: x1, x2 = res.x z = -res.fun # вернули max print(x1, x2, z) # ожидаем ~2.666..., 2.666..., 13.333... else: print(res.message)