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.
- flixopt/__init__.py +33 -4
- flixopt/aggregation.py +60 -80
- flixopt/calculation.py +403 -182
- flixopt/commons.py +1 -10
- flixopt/components.py +939 -448
- flixopt/config.py +553 -191
- flixopt/core.py +513 -846
- flixopt/effects.py +644 -178
- flixopt/elements.py +610 -355
- flixopt/features.py +394 -966
- flixopt/flow_system.py +736 -219
- flixopt/interface.py +1104 -302
- flixopt/io.py +103 -79
- flixopt/linear_converters.py +387 -95
- flixopt/modeling.py +757 -0
- flixopt/network_app.py +73 -39
- flixopt/plotting.py +294 -138
- flixopt/results.py +1254 -300
- flixopt/solvers.py +25 -21
- flixopt/structure.py +938 -396
- flixopt/utils.py +36 -12
- flixopt-3.0.1.dist-info/METADATA +209 -0
- flixopt-3.0.1.dist-info/RECORD +26 -0
- flixopt-3.0.1.dist-info/top_level.txt +1 -0
- docs/examples/00-Minimal Example.md +0 -5
- docs/examples/01-Basic Example.md +0 -5
- docs/examples/02-Complex Example.md +0 -10
- docs/examples/03-Calculation Modes.md +0 -5
- docs/examples/index.md +0 -5
- docs/faq/contribute.md +0 -61
- docs/faq/index.md +0 -3
- docs/images/architecture_flixOpt-pre2.0.0.png +0 -0
- docs/images/architecture_flixOpt.png +0 -0
- docs/images/flixopt-icon.svg +0 -1
- docs/javascripts/mathjax.js +0 -18
- docs/user-guide/Mathematical Notation/Bus.md +0 -33
- docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +0 -132
- docs/user-guide/Mathematical Notation/Flow.md +0 -26
- docs/user-guide/Mathematical Notation/LinearConverter.md +0 -21
- docs/user-guide/Mathematical Notation/Piecewise.md +0 -49
- docs/user-guide/Mathematical Notation/Storage.md +0 -44
- docs/user-guide/Mathematical Notation/index.md +0 -22
- docs/user-guide/Mathematical Notation/others.md +0 -3
- docs/user-guide/index.md +0 -124
- flixopt/config.yaml +0 -10
- flixopt-2.2.0rc2.dist-info/METADATA +0 -167
- flixopt-2.2.0rc2.dist-info/RECORD +0 -54
- flixopt-2.2.0rc2.dist-info/top_level.txt +0 -5
- pics/architecture_flixOpt-pre2.0.0.png +0 -0
- pics/architecture_flixOpt.png +0 -0
- pics/flixOpt_plotting.jpg +0 -0
- pics/flixopt-icon.svg +0 -1
- pics/pics.pptx +0 -0
- scripts/extract_release_notes.py +0 -45
- scripts/gen_ref_pages.py +0 -54
- tests/ressources/Zeitreihen2020.csv +0 -35137
- {flixopt-2.2.0rc2.dist-info → flixopt-3.0.1.dist-info}/WHEEL +0 -0
- {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
|
|
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
|
-
|
|
18
|
-
mip_gap
|
|
19
|
-
|
|
20
|
-
|
|
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:
|
|
28
|
+
extra_options: dict[str, Any] = field(default_factory=dict)
|
|
27
29
|
|
|
28
30
|
@property
|
|
29
|
-
def options(self) ->
|
|
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) ->
|
|
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
|
|
43
|
-
|
|
44
|
-
|
|
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) ->
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
extra_options
|
|
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:
|
|
72
|
+
threads: int | None = None
|
|
69
73
|
name: ClassVar[str] = 'highs'
|
|
70
74
|
|
|
71
75
|
@property
|
|
72
|
-
def _options(self) ->
|
|
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,
|