Preserve InvestmentUp / RetirementUp = 0 as 'forbid investment'#109
Preserve InvestmentUp / RetirementUp = 0 as 'forbid investment'#109erikfilias wants to merge 1 commit into
Conversation
The input pipeline was filling NaN cells in InvestmentUp / RetirementUp with 0 at CSV-load time, then overriding 0 with 1.0 a few lines later. The combined effect was that an explicit 0 in the CSV (which the column docstring describes as a fraction in [0, 1]) silently became 1.0, letting the solver build the candidate up to MaximumPower / TTC. Users who wrote 0 to forbid investment got the opposite behaviour with no warning. Fix: at CSV-load time, fill NaN with the documented default — 1.0 for upper-bound columns (InvestmentUp, RetirementUp) and 0.0 for everything else. The redundant 'where(par > 0.0, 1.0)' overrides for pGenUpInvest, pGenUpRetire, pNetUpInvest, pH2PipeUpInvest, pHeatPipeUpInvest are then deleted. Also extends the per-column fill behaviour from dfGeneration to dfNetwork / dfNetworkHydrogen / dfNetworkHeat for consistency. Adds a regression test (test_invest_up_zero_enforces_no_investment) on case 9n with InvestmentUp=0 set on the single network candidate; verifies the resulting vNetworkInvest is 0. The same code path applies to pGenUpInvest, pGenUpRetire, pH2PipeUpInvest, pHeatPipeUpInvest. Migration note: legacy CSVs that used 0 as a 'no upper bound' sentinel must leave the cell blank (NaN) for the previous behaviour.
|
The way to forbid an investment is to assign a value of 0.00001 to the upper bound, which will be internally translated to 0. This is the convention used by openTEPES across all files and can be explicitly added to the documentation, if not yet. I don't see the need to change the convention specifically for this file. |
|
Thanks, @arght — I hadn't seen the 1e-5 convention spelled out anywhere in the input docs for it and you are right about we should keep the copenTEPES convention. Glad to close this and switch our cross-evaluation tooling to use the 1e-5 upper bound instead. If it helps, I will open another tiny docs-only PR adding a note next to the InvestmentUp / RetirementUp column descriptions in the README docs — purely the convention, no behaviour change. Closing this PR now. |
|
Ok. thanks |
The input pipeline was filling NaN cells in InvestmentUp / RetirementUp with 0 at CSV-load time, then overriding 0 with 1.0 a few lines later. The combined effect was that an explicit 0 in the CSV (which the column docstring describes as a fraction in [0, 1]) silently became 1.0, letting the solver build the candidate up to MaximumPower / TTC. Users who wrote 0 to forbid investment got the opposite behaviour with no warning.
Fix: at CSV-load time, fill NaN with the documented default — 1.0 for upper-bound columns (InvestmentUp, RetirementUp) and 0.0 for everything else. The redundant 'where(par > 0.0, 1.0)' overrides for pGenUpInvest, pGenUpRetire, pNetUpInvest, pH2PipeUpInvest, pHeatPipeUpInvest are then deleted. Also extends the per-column fill behaviour from dfGeneration to dfNetwork / dfNetworkHydrogen / dfNetworkHeat for consistency.
Adds a regression test (test_invest_up_zero_enforces_no_investment) on case 9n with InvestmentUp=0 set on the single network candidate; verifies the resulting vNetworkInvest is 0. The same code path applies to pGenUpInvest, pGenUpRetire, pH2PipeUpInvest, pHeatPipeUpInvest.
Migration note: legacy CSVs that used 0 as a 'no upper bound' sentinel must leave the cell blank (NaN) for the previous behaviour.