Closed henhuy closed 4 years ago
Hey, as far as I see the problem, the only way would be to use binary variables. Adding
x <= y * investment_max
initial_cost = y * 100
with y being binary {0,1}, x the investment
So y must be 1 if x is supposed to be anything then zero and otherwise 0. Adding initial cost only in the case of investment.
investment_max
can also be an arbitrary high number, but close to the highest value you would expect for x to avoid numerical instability of the problem due to differences the matrix (Big-M-constraint).
Actually you could take a look at the offset transformer, which is mathematically a similar if not same problem (if I remember correctly). I was on holiday quite a while an my head is not yet working a 100%, but I think it should be right and unfortunately also the only solution to your problem (increasing run time significantly). Correct me if you find an error, but you will need a binary variable for investment yes/no for sure.
Hey @simnh , thank you for your hint! I will look into that. Nice
hey, some time ago, we were discussing this topic within our project as well. So, thanks for opening this issue!
We tried and implemented some stuff, but did not manage to propose it here on github so far. And we realized the same problem, @simnh was mentioning:
investment_max can also be an arbitrary high number, but close to the highest value you would expect for x to avoid numerical instability of the problem due to differences the matrix (Big-M-constraint).
I will open a PR for proposing and discussing our implementation. I think that's a nice feature, which should not be missed in oemof :)
I'm trying to implement initial costs for a PV component which holds an investment optimization. For example, add 100€ to PV costs if (and only if) PV is built: 0 kW -> 0€ x kW -> 100€ + x kW * 2 €/kW
As far as I can see, there is not yet an option for that in oemof. I tried to implement an additional
InitialInvestmentFlow
but as this leads toRuntimeError: Cannot write legal LP file. Objective 'objective' has nonlinear terms that are not quadratic.
Is it even possible to implement it? Some hints would be nice!See my code example below. Problematic line is:
If I remove "greater than" part, some costs are added (not what I want, but only to check if custom flow works)
Example script: