Linear optimization python -


i try add start costs working scheduling problem (working without start costs). schedule should optimized on dynamic period, i.e. 96 quarters of day. have list of 96 prices convert matrix:

prices = np.matrix([prices.as_matrix()]) prices = prices.t length = prices.size range = range(np.size(prices)) 

and following variables:

c_turb = -100 min_turb = 0 max_turb = 8 c_pump = -50 min_pump = -10 max_pump = 0 

this objective funtion:

 prob = pulp.lpproblem("the psp",lpmaximize)  prob +=lpsum([(price[i])*pump[i] in range]              + [price[i]*turbine[i] in range]              + [z_turb[i]*c_turb in range]              + [z_pump[i]*c_pump in range]) 

and variables defined follow:

pump = lpvariable.dicts("pump", range,upbound=0,  cat="integer") turbine = lpvariable.dicts("turbine", range, lowbound=0, cat="integer") pump_status=lpvariable.dicts("pump_status", range,  cat="binary") turbine_status=lpvariable.dicts("turbine_status", range,  cat="binary") z_pump = lpvariable.dicts("pump_startup", range,  cat="binary") z_turb= lpvariable.dicts("turbine_startup", range, cat="binary")  in pump:      pump[i].lowbound = -10 #bounds can vary each irrelevant problem  in turbine:      turbine[i].upbound = 8 

now added following constraints:

for in range(1,length+1):     n=range(0,i)     prob += lpsum((-0.8*pump[i]-turbine[i])*0.25 in n ) <=50        prob += lpsum((-0.8*pump[i]-turbine[i])*0.25 in n) >=0     prob += pump[i]>=min_pump*pump_status[i]     prob += pump[i]<= max_pump*pump_status[i]     prob += turbine[i] >= min_turb * turbine_status[i]     prob += turbine[i] <= max_turb * turbine_status[i]      if == 1:         prob += z_pump[i] == pump_status[i]     else:         prob+= z_pump[i]>=pump_status[i]-pump_status[i-1]         prob+= z_pump[i]<=pump_status[i]         prob+= z_pump[i]<=(1-pump_status[i-1])      if == 1:         prob += z_turb[i] == pump_status[i]     else:         prob+= z_turb[i]>=turbine_status[i]-turbine_status[i-1]         prob+= z_turb[i]<=turbine_status[i]         prob+= z_turb[i]<=(1-turbine_status[i-1]) 

where turbine_status , pump_status should on/off status of turbine/pump in particular quarter i. z_pump , z_turb should store number of starts, i.e. switch status 0 1.

however, error in line: prob += pump[i]>=min_pump*pump_status[i]. unfortunately error info: 96 not verbose....

can point me right direction?

thank you!!


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -