deflex.restore_results

deflex.restore_results(file_names, scenario_class=<class 'deflex.scenario.DeflexScenario'>)[source]

Restore only the result dictionary from a dumped scenario or a list of dumped scenarios. The results will be a deflex result dictionary with the following keys:

  • main – Results of all variables
  • param – Input parameter
  • meta – Meta information and tags of the scenario
  • problem – Information about the linear problem such as lower bound, upper bound etc.
  • solver – Solver results
  • solution – Information about the found solution and the objective value
Parameters:
  • file_names (list or string) – All file names (full path) that should be loaded.
  • scenario_class (class) – A child of the deflex.Scenario class or the Scenario class itself.
Returns:

  • A list of results dictionaries or a single dictionary if one file name is
  • given (list or dict)

Examples

>>> from deflex import fetch_test_files
>>> fn1 = fetch_test_files("de21_no-heat_transmission.dflx")
>>> fn2 = fetch_test_files("de02_no-heat.dflx")
>>> sorted(restore_results(fn1).keys())
['Input data', 'Main', 'Meta', 'Param', 'Problem', 'Solution', 'Solver']
>>> sorted(restore_results([fn1, fn2])[0].keys())
['Input data', 'Main', 'Meta', 'Param', 'Problem', 'Solution', 'Solver']