我正在尝试使用 Python 中的 Pulp 来解决线性优化问题。
这是代码:
import pandas as pd
import pulp
D_XB = 20
D_XP = 0
D_XC = 0
Available_Time = 1440 #in minutes
test = [['A1', 'A2', 'A3', 'A4', 'A5'], [1,2,1,0,3], [16,32,0,16,32], [10,10,10,10,10], [120,210,180,180,350]]
Cycles = pd.DataFrame(test, index=['Cycles', 'QTA1', 'QTA2', 'QTA3', 'T_TOT']).T
A1 = pulp.LpVariable("Cycle_A1", lowBound=0, cat='Integer')
A2 = pulp.LpVariable("Cycle_A2", lowBound=0, cat='Integer')
A3 = pulp.LpVariable("Cycle_A3", lowBound=0, cat='Integer')
A4 = pulp.LpVariable("Cycle_A4", lowBound=0, cat='Integer')
A5 = pulp.LpVariable("Cycle_A5", lowBound=0, cat='Integer')
# Defining the problem as a minimization problem (Minimize Storage) …Run Code Online (Sandbox Code Playgroud)