flixopt 2.2.0rc2__py3-none-any.whl → 3.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. flixopt/__init__.py +33 -4
  2. flixopt/aggregation.py +60 -80
  3. flixopt/calculation.py +403 -182
  4. flixopt/commons.py +1 -10
  5. flixopt/components.py +939 -448
  6. flixopt/config.py +553 -191
  7. flixopt/core.py +513 -846
  8. flixopt/effects.py +644 -178
  9. flixopt/elements.py +610 -355
  10. flixopt/features.py +394 -966
  11. flixopt/flow_system.py +736 -219
  12. flixopt/interface.py +1104 -302
  13. flixopt/io.py +103 -79
  14. flixopt/linear_converters.py +387 -95
  15. flixopt/modeling.py +757 -0
  16. flixopt/network_app.py +73 -39
  17. flixopt/plotting.py +294 -138
  18. flixopt/results.py +1254 -300
  19. flixopt/solvers.py +25 -21
  20. flixopt/structure.py +938 -396
  21. flixopt/utils.py +36 -12
  22. flixopt-3.0.1.dist-info/METADATA +209 -0
  23. flixopt-3.0.1.dist-info/RECORD +26 -0
  24. flixopt-3.0.1.dist-info/top_level.txt +1 -0
  25. docs/examples/00-Minimal Example.md +0 -5
  26. docs/examples/01-Basic Example.md +0 -5
  27. docs/examples/02-Complex Example.md +0 -10
  28. docs/examples/03-Calculation Modes.md +0 -5
  29. docs/examples/index.md +0 -5
  30. docs/faq/contribute.md +0 -61
  31. docs/faq/index.md +0 -3
  32. docs/images/architecture_flixOpt-pre2.0.0.png +0 -0
  33. docs/images/architecture_flixOpt.png +0 -0
  34. docs/images/flixopt-icon.svg +0 -1
  35. docs/javascripts/mathjax.js +0 -18
  36. docs/user-guide/Mathematical Notation/Bus.md +0 -33
  37. docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +0 -132
  38. docs/user-guide/Mathematical Notation/Flow.md +0 -26
  39. docs/user-guide/Mathematical Notation/LinearConverter.md +0 -21
  40. docs/user-guide/Mathematical Notation/Piecewise.md +0 -49
  41. docs/user-guide/Mathematical Notation/Storage.md +0 -44
  42. docs/user-guide/Mathematical Notation/index.md +0 -22
  43. docs/user-guide/Mathematical Notation/others.md +0 -3
  44. docs/user-guide/index.md +0 -124
  45. flixopt/config.yaml +0 -10
  46. flixopt-2.2.0rc2.dist-info/METADATA +0 -167
  47. flixopt-2.2.0rc2.dist-info/RECORD +0 -54
  48. flixopt-2.2.0rc2.dist-info/top_level.txt +0 -5
  49. pics/architecture_flixOpt-pre2.0.0.png +0 -0
  50. pics/architecture_flixOpt.png +0 -0
  51. pics/flixOpt_plotting.jpg +0 -0
  52. pics/flixopt-icon.svg +0 -1
  53. pics/pics.pptx +0 -0
  54. scripts/extract_release_notes.py +0 -45
  55. scripts/gen_ref_pages.py +0 -54
  56. tests/ressources/Zeitreihen2020.csv +0 -35137
  57. {flixopt-2.2.0rc2.dist-info → flixopt-3.0.1.dist-info}/WHEEL +0 -0
  58. {flixopt-2.2.0rc2.dist-info → flixopt-3.0.1.dist-info}/licenses/LICENSE +0 -0
flixopt/solvers.py CHANGED
@@ -2,9 +2,11 @@
2
2
  This module contains the solvers of the flixopt framework, making them available to the end user in a compact way.
3
3
  """
4
4
 
5
+ from __future__ import annotations
6
+
5
7
  import logging
6
8
  from dataclasses import dataclass, field
7
- from typing import Any, ClassVar, Dict, Optional
9
+ from typing import Any, ClassVar
8
10
 
9
11
  logger = logging.getLogger('flixopt')
10
12
 
@@ -14,41 +16,42 @@ class _Solver:
14
16
  """
15
17
  Abstract base class for solvers.
16
18
 
17
- Attributes:
18
- mip_gap (float): Solver's mip gap setting. The MIP gap describes the accepted (MILP) objective,
19
- and the lower bound, which is the theoretically optimal solution (LP)
20
- logfile_name (str): Filename for saving the solver log.
19
+ Args:
20
+ mip_gap: Acceptable relative optimality gap in [0.0, 1.0].
21
+ time_limit_seconds: Time limit in seconds.
22
+ extra_options: Additional solver options merged into `options`.
21
23
  """
22
24
 
23
25
  name: ClassVar[str]
24
26
  mip_gap: float
25
27
  time_limit_seconds: int
26
- extra_options: Dict[str, Any] = field(default_factory=dict)
28
+ extra_options: dict[str, Any] = field(default_factory=dict)
27
29
 
28
30
  @property
29
- def options(self) -> Dict[str, Any]:
31
+ def options(self) -> dict[str, Any]:
30
32
  """Return a dictionary of solver options."""
31
33
  return {key: value for key, value in {**self._options, **self.extra_options}.items() if value is not None}
32
34
 
33
35
  @property
34
- def _options(self) -> Dict[str, Any]:
36
+ def _options(self) -> dict[str, Any]:
35
37
  """Return a dictionary of solver options, translated to the solver's API."""
36
38
  raise NotImplementedError
37
39
 
38
40
 
39
41
  class GurobiSolver(_Solver):
40
42
  """
43
+ Gurobi solver configuration.
44
+
41
45
  Args:
42
- mip_gap (float): Solver's mip gap setting. The MIP gap describes the accepted (MILP) objective,
43
- and the lower bound, which is the theoretically optimal solution (LP)
44
- time_limit_seconds (int): Solver's time limit in seconds.
45
- extra_options (str): Filename for saving the solver log.
46
+ mip_gap: Acceptable relative optimality gap in [0.0, 1.0]; mapped to Gurobi `MIPGap`.
47
+ time_limit_seconds: Time limit in seconds; mapped to Gurobi `TimeLimit`.
48
+ extra_options: Additional solver options merged into `options`.
46
49
  """
47
50
 
48
51
  name: ClassVar[str] = 'gurobi'
49
52
 
50
53
  @property
51
- def _options(self) -> Dict[str, Any]:
54
+ def _options(self) -> dict[str, Any]:
52
55
  return {
53
56
  'MIPGap': self.mip_gap,
54
57
  'TimeLimit': self.time_limit_seconds,
@@ -57,19 +60,20 @@ class GurobiSolver(_Solver):
57
60
 
58
61
  class HighsSolver(_Solver):
59
62
  """
60
- Args:
61
- mip_gap (float): Solver's mip gap setting. The MIP gap describes the accepted (MILP) objective,
62
- and the lower bound, which is the theoretically optimal solution (LP)
63
- time_limit_seconds (int): Solver's time limit in seconds.
64
- threads (int): Number of threads to use.
65
- extra_options (str): Filename for saving the solver log.
63
+ HiGHS solver configuration.
64
+
65
+ Attributes:
66
+ mip_gap: Acceptable relative optimality gap in [0.0, 1.0]; mapped to HiGHS `mip_rel_gap`.
67
+ time_limit_seconds: Time limit in seconds; mapped to HiGHS `time_limit`.
68
+ extra_options: Additional solver options merged into `options`.
69
+ threads (int | None): Number of threads to use. If None, HiGHS chooses.
66
70
  """
67
71
 
68
- threads: Optional[int] = None
72
+ threads: int | None = None
69
73
  name: ClassVar[str] = 'highs'
70
74
 
71
75
  @property
72
- def _options(self) -> Dict[str, Any]:
76
+ def _options(self) -> dict[str, Any]:
73
77
  return {
74
78
  'mip_rel_gap': self.mip_gap,
75
79
  'time_limit': self.time_limit_seconds,