OSeMOSYS / OSeMOSYS_GNU_MathProg

The GNU MathProg implementation of OSeMOSYS
Apache License 2.0
9 stars 14 forks source link

Should we remove the long version of the OSeMOSYS code? #33

Open willu47 opened 4 years ago

willu47 commented 4 years ago

Yes:

  1. For "serious modelling" we should use the short version of the code due to the performance boost
  2. It is confusing for new users on what the differences are between the two versions of the code, and what are the benefits or disadvantages
  3. It doubles the amount of maintenance and upkeep required
  4. Modifications and innovations are more likely to happen with the short code as

No:

  1. The long version of the code is more transparent and explicit, providing clear insight into the formulation
  2. The long version of the code has more variables, which provides more opportunities to extract shadow prices from the dual solution
  3. Results from the shorter version are harder to interpret because many of the intermediate variables are removed.
  4. The shorter version is harder to debug because of the smaller number of intermediate variables.
willu47 commented 4 years ago

Note that Igor from KOBiZE suggested that significant performance improvements could be made to the long version of the code. He uses a GAMS implementation of the long version which incorporates conditional operators to restrict the number of equations being generated. A start on implementing these suggestions as well as those from @tburandt own GAMS implementation can be found in #27

tniet commented 4 years ago

Hey @willu47 - I think that Yes #3 is really the most important factor to consider. I'm also not sure what you mean by No #2 - I think that getting shadow prices for the parameters is possible for either version of the code. Maybe I'm missing something?

willu47 commented 4 years ago

Hi @tniet - I updated point 2. Maybe it makes more sense now, but really is the same as point 3. just cast in a different way.

tniet commented 4 years ago

Hi @willu47 - Yes, I do see point 3 and point 2 is a sub-set of point 3. Overall, I think the decision will come down to #3 on both - is the maintenance of two versions of code more effort than the challenges of getting some of the information out of the simpler code. From my perspective, Yes #3 makes me lean towards retiring the long code, but I'm open to others' views/thoughts.

FraGard commented 4 years ago

I do agree that #3 is the key point, but based on that I come to different conclusions: I was just able to get the energy utility of Tunisia and students to have their hands on the code and understand how it works thanks to the long version. The short would have been probably more critical. Perhaps an intermediate solution where the long code is used for educational purposes, but not necessarily updated?

willu47 commented 4 years ago

Thanks @FraGard - I would like to get a better understanding of why are the differences in performance between the two code bases so great. @chrwm is currently looking at the expected and actual formulation of the long version of OSeMOSYS and will likely be able to provide some insights in the coming weeks.

tniet commented 4 years ago

That might be a good approach - create a stable (and maybe even simplified), mostly static version of the long code for teaching that provides the basics, and then use the short code for more in-depth analysis. I could see the 'teaching long version' having storage and other extras removed for teaching purposes to simplify things. Once students are familiar with the operation of the code they could move to the short code when building a more complex model.

abhishek0208 commented 4 years ago

Similarly, we could combine both in the same code: leaving the long code commented out and use the short code to actually run the model.