deflex.DeflexScenario.compute

DeflexScenario.compute(solver='cbc', with_duals=True, **kwargs)

Create a solph.Model from the input data and optimise it using an external solver. Afterwards the results are stored in the results attribute.

Parameters:
  • solver (str) – The name of the solver as used in the Pyomo package like cbc, glpk, gurobi, cplex… (default: cbc).
  • with_duals (bool) – Receive the dual variables of all buses in the results (default: True).

Examples

>>> import deflex as dflx
>>> fn = dflx.fetch_test_files("de02_no-heat_csv")
>>> sc = dflx.create_scenario(fn, "csv")
>>> sc.results is None
True
>>> sc.compute()  # doctest: +ELLIPSIS
Welcome to the CBC MILP ...
>>> sc.results.keys()
['Problem', 'Solver', 'Solution', 'Main', 'Param', 'Meta']