本文整理汇总了Python中tableau.Tableau.simplex_method方法的典型用法代码示例。如果您正苦于以下问题:Python Tableau.simplex_method方法的具体用法?Python Tableau.simplex_method怎么用?Python Tableau.simplex_method使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tableau.Tableau
的用法示例。
在下文中一共展示了Tableau.simplex_method方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: range
# 需要导入模块: from tableau import Tableau [as 别名]
# 或者: from tableau.Tableau import simplex_method [as 别名]
curses.endwin()
# convert the input to simplex tableau
print exit_mes
print buf
# do simplex method
if input_ok:
# split buffers to formulas
formulas = [b.split() for b in buf] # formulas[var_num] is ineq
# make variables
var_list = []
for vi in range(var_num):
var_list.append(Variable(0, False))
for fe in formulas:
var_list.append(Variable(0, True, float(fe[var_num + 1]),
fe[var_num])) # ineq type
# make coefficient tableau
row_list = []
for ri in range(var_num):
row_list.append(RowLine([0] * (var_num + for_num)))
for i, fe in enumerate(formulas):
tmp_f = [float(e) for e in fe[:var_num]]
tmp_zeros = [0] * for_num
tmp_zeros[i] = -1
row_list.append(RowLine(tmp_f + tmp_zeros))
# simplex tableau
table = Tableau(var_list, row_list)
# do simplex method
table.simplex_method()