I have a question regarding optimization with scipy. I would like to optimize the schedule of a pump storage plant. Basically there are 96 known prices (for each quarter of the day) and the model should decide whether to (1) pump, (2) turbine or (3) do nothing for each respective quarter. Thereby, there are some bounds for X: -100
To start I tried the following:
from scipy.optimize import minimize
prices=np.array([[1.5,50,30]])
xp =np.array([[1.5,50,30]])
fun = lambda x: xp* prices #here xp and prices should be matrices
cons = ({'type': 'ineq', 'fun': lambda x: (xp*0.25)<=500},
{'type': 'ineq', 'fun': lambda x: (xp*0.25)>=0})
bnds = ((0, None), (0, None), (0, None))
res = minimize(fun, (2, 0,0), method='SLSQP', bounds=bnds, constraints=cons)
However, this throws an error:
ValueError: all the input arrays must have same number of dimensions
I have no clue why this error appears. Can somebody give me a hint?
Thank you!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire