#python #python-3.x
Вопрос:
Надеюсь, что Это не дубликат. Я искал дубликат, но пока не мог его найти.
Может ли кто-нибудь помочь мне с этой ошибкой?
from mip import Model, xsum, maximize, BINARY
el_price = 6.43 # Electricity price
del_t = .25 # duration of time step
demand = [3,4,5,6,7,8] # Electicity demand
gas_p = [0.23, 0.52, 0.34] # Gas price for different gases
em_fc = 0.2 # emission factor
co2_p = .25 # CO2 Price
capacity = [3,3,4,6,7,8] # capacity for the power plant
T = range(len(demand))
I = range(len(gas_p))
m = Model("Maximizing profit")
y = [m.add_var(lb = 0) for t in T for i in I] # Electricity generation
print(y)
m.objective = maximize(xsum((el_price * del_t * y[t][i]) for t in T for i in I) - (xsum(gas_p[i] for i in I) (em_fc * co2_p) ))
m.objective