I am trying to maximize hourly profits from a power generation asset. As far as I understood from my research, I might use quadprog::solve.QP.
I did most of the required data preparation already giving me a 96 x 5 data frame.
The columns include the following information:
- Quarter Hour of a day
- Power Price
- Production Volume
- Generation Cost
- Profit
The first two columns are complete which leads to my quadratic optimization. The target function is as follows:
max Profit[i] = Volume[i] * (Price[i] - Cost[i])
The main issue is that the Generation Cost is a function of the Production Volume (which I have predetermined and which moreover depends on various static values).
In addition to that the Production Volume in a certain quarter hour must not differ from the precedent production volume by let's say more than 20 MegaWatt. The Production Volume must not exceed a maximum production volume and not fall below a minimum production volume.
I tried to implement the optimization problem as follows:
Volume = x1
Price = x2
Cost = x3
Profit = x1 * (x2 - x3) --> max
Profit = x1*x2 - x1*x3 --> max
with
x3 = f(x1)
subject to
x1(t) >= x1(t-1) - 20
x1(t) <= x1(t-1) + 20
x1 <= max(x1)
x1 >= min(x1)
From the quadprog manuals I read that I need to use
solve.QP(Dmat, dvec, Amat, bvec)
But I honestly don't know how to fill the two matrices and the two vectors.
Can anyone help?
I hope the information given is sufficient.
Cheers, Tilman