oemof-solph icon indicating copy to clipboard operation
oemof-solph copied to clipboard

Introduce parameter "expected" for Flows

Open p-snft opened this issue 3 years ago • 4 comments

This value can be used as a hint to the optimiser to speed up minimisation. The fature is actually a reintroduction: Up to oemof v0.3, it was possible to have a time series "actual_value" plus a boolean parameter "fixed". When fixed was false, it was just taken as the initial value for optimisation of the energy system. When compared to this previous implemenataion, having either fix=(series) or expected=(series) might be easier to understand.

  • [ ] Test speed-up for complex model
  • [ ] (More) documentation
  • [ ] Unit tests

Implements #759

p-snft avatar Dec 17 '21 15:12 p-snft

For testing the speedup, I consider the following:

  • Source with high nominal value and random costs. (Binary/ NonConvex so that performance is needed.)
  • GenericStorage with very high capacity and random series for loss_rate.
  • Sink with random (fix) demand

With a sufficiently high number of time steps, this should be rather hard to optimised. So:

  1. Optimise without giving starting values.
  2. Redo 1. to make sure there is no effect due to caching, branch prediction and stuff like that.
  3. Optimise using solution of 1. as starting values.
  4. Redo 1 once again, same reasoning as in 2, should again be slower.

p-snft avatar Dec 17 '21 21:12 p-snft

Hello @p-snft! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 23:16: E226 missing whitespace around arithmetic operator

Line 391:80: E501 line too long (80 > 79 characters)

Comment last updated at 2022-04-06 07:19:27 UTC

pep8speaks avatar Feb 07 '22 16:02 pep8speaks

It looks like my implementation does not improve performance in my benchmark/ example case:

Time to solve run (no hints): 292.25 s Time to solve run (no hints): 281.17 s Time to solve run (with hints): 286.85 s Time to solve run (no hints): 375.14 s

Problem is maybe caused by #818.

Update: It's not.

p-snft avatar Feb 07 '22 16:02 p-snft

I learned that a parameter warmstart=True has to be used when solving the Promo model so that the starting values are used.

p-snft avatar Apr 04 '22 21:04 p-snft