Solver time seems to be to high for a small energy model using oemof (solph) with CBC solver



I built an electricity energysystem with 6 busses with oemof. Every bus has an easy input. And bus 1 is connected to bus 2 in both direction (2 transformsers). Bus 2 is connected to bus 3 on the same way. …. bus 6 is connected to bus 1. So it is a ring structure. Every bus has a sink.
The bus 1 is also connected with a gas bus by an gas power plant. The gas bus has 1 input with energy.
Now I started to connect one demand on bus 1 with 8760 time steps (one year). I let the program solve the flow of every object in this energysystem. I got the solution after 40 seconds.
But my goal is to solve the problem with more demands in the system. So I integrated a second demand on bus 2. Now the calculation time was about 3 minutes. With an third demand on bus 3 the calculation time was 15 minutes. And with a demand at every bus, it takes more than 40min.

My processor is an i5 4670K 3.4 GHz.

My problem is: Why the CBC solver needs so much time to solve the problem with more demands in the energysystem? Is there any reason?

Do you now how the solver exactly works? I couldn’t find any answer

With one demand in the system:

128382 Obj 1.6384541e+013 Primal inf 6.0004356e+008 (5) Dual inf 2.5973983e-006 (1)
Primal infeasible - objective value 1.6384541e+013
PrimalInfeasible objective 1.638454066e+013 - 128382 iterations time 36.552 

With two demands in the system:

155933 Obj 1.1686988e+014 Primal inf 3.7517663e+010 (20494)
Primal infeasible - objective value 1.1686988e+014
PrimalInfeasible objective 1.16869879e+014 - 155933 iterations time 1728.062


I do agree that 40min seems to be too long for such a small system.

Normally the solver time increases significantly if the problem is infeasible. Therefore you should make sure that the problem is still solvable after you added additional demand objects. By the way, different units (or prefixes) are a typical source of error.

An easy way to make your problem solvable is to add unlimited excess and shortage objects to every bus (balance). Make sure that the shortage source is more expensive for the solver than all other objects, otherwise it might be used instead of your power plants.

For oemof.solph it looks like this (e.g. bus_1):

from oemof import solph

# shortage bus_1
             outputs={bus_1: solph.Flow(variable_costs=50000)})

# excess bus_1
solph.Sink(label='excess_1', inputs={bus_1: solph.Flow()})

If you add these objects to every bus your problem will be solvable. Afterwards you can check the results. If the sum of these sinks and sources is greater than zero the problem would be infeasible without them. Now you can analyse your results to find the problem.

Understanding the OffsetTransformer