本文整理汇总了Python中display.Display.run_simplex方法的典型用法代码示例。如果您正苦于以下问题:Python Display.run_simplex方法的具体用法?Python Display.run_simplex怎么用?Python Display.run_simplex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类display.Display
的用法示例。
在下文中一共展示了Display.run_simplex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: example1
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import run_simplex [as 别名]
def example1():
coefficients = np.array([[1, 1],
[1, -1]], dtype='float')
constraints = np.array([[4],
[2]], dtype='float')
objective = np.array([3, 2])
simplex = Simplex(coefficients=coefficients, constraints=constraints, objective=objective)
display = Display(simplex_init=simplex)
display.run_simplex()
示例2: example2
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import run_simplex [as 别名]
def example2():
coefficients = np.array([[4.1, 2],
[2, 4]], dtype='float')
constraints = np.array([[40],
[32]], dtype='float')
objective = np.array([80, 55])
simplex = Simplex(coefficients=coefficients, constraints=constraints, objective=objective)
display = Display(simplex_init=simplex)
display.run_simplex()
示例3: run_from_txt
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import run_simplex [as 别名]
def run_from_txt():
with open("lp.txt") as file:
content = file.read()
kw = {}
exec(content, globals(), kw)
A = np.array(kw['A'])
b = np.array(kw['b'])
c = np.array(kw['c'])
d = Display(Simplex(coefficients=A, constraints=b, objective=c))
d.run_simplex()
示例4: example3
# 需要导入模块: from display import Display [as 别名]
# 或者: from display.Display import run_simplex [as 别名]
def example3():
coefficients = np.array([[2, 1, 0],
[1, 2, -2],
[0, 1, 2]], dtype='float')
constraints = np.array([[10],
[20],
[ 5]], dtype='float')
objective = np.array([2, -1, 2])
simplex = Simplex(coefficients=coefficients, constraints=constraints, objective=objective)
display = Display(simplex_init=simplex)
display.run_simplex()