flixopt 1.0.12__py3-none-any.whl → 2.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.
Potentially problematic release.
This version of flixopt might be problematic. Click here for more details.
- docs/examples/00-Minimal Example.md +5 -0
- docs/examples/01-Basic Example.md +5 -0
- docs/examples/02-Complex Example.md +10 -0
- docs/examples/03-Calculation Modes.md +5 -0
- docs/examples/index.md +5 -0
- docs/faq/contribute.md +49 -0
- docs/faq/index.md +3 -0
- docs/images/architecture_flixOpt-pre2.0.0.png +0 -0
- docs/images/architecture_flixOpt.png +0 -0
- docs/images/flixopt-icon.svg +1 -0
- docs/javascripts/mathjax.js +18 -0
- docs/release-notes/_template.txt +32 -0
- docs/release-notes/index.md +7 -0
- docs/release-notes/v2.0.0.md +93 -0
- docs/release-notes/v2.0.1.md +12 -0
- docs/user-guide/Mathematical Notation/Bus.md +33 -0
- docs/user-guide/Mathematical Notation/Effects, Penalty & Objective.md +132 -0
- docs/user-guide/Mathematical Notation/Flow.md +26 -0
- docs/user-guide/Mathematical Notation/LinearConverter.md +21 -0
- docs/user-guide/Mathematical Notation/Piecewise.md +49 -0
- docs/user-guide/Mathematical Notation/Storage.md +44 -0
- docs/user-guide/Mathematical Notation/index.md +22 -0
- docs/user-guide/Mathematical Notation/others.md +3 -0
- docs/user-guide/index.md +124 -0
- {flixOpt → flixopt}/__init__.py +5 -2
- {flixOpt → flixopt}/aggregation.py +113 -140
- flixopt/calculation.py +455 -0
- {flixOpt → flixopt}/commons.py +7 -4
- flixopt/components.py +630 -0
- {flixOpt → flixopt}/config.py +9 -8
- {flixOpt → flixopt}/config.yaml +3 -3
- flixopt/core.py +970 -0
- flixopt/effects.py +386 -0
- flixopt/elements.py +534 -0
- flixopt/features.py +1042 -0
- flixopt/flow_system.py +409 -0
- flixopt/interface.py +265 -0
- flixopt/io.py +308 -0
- flixopt/linear_converters.py +331 -0
- flixopt/plotting.py +1340 -0
- flixopt/results.py +898 -0
- flixopt/solvers.py +77 -0
- flixopt/structure.py +630 -0
- flixopt/utils.py +62 -0
- flixopt-2.0.1.dist-info/METADATA +145 -0
- flixopt-2.0.1.dist-info/RECORD +57 -0
- {flixopt-1.0.12.dist-info → flixopt-2.0.1.dist-info}/WHEEL +1 -1
- flixopt-2.0.1.dist-info/top_level.txt +6 -0
- pics/architecture_flixOpt-pre2.0.0.png +0 -0
- pics/architecture_flixOpt.png +0 -0
- pics/flixopt-icon.svg +1 -0
- pics/pics.pptx +0 -0
- scripts/gen_ref_pages.py +54 -0
- site/release-notes/_template.txt +32 -0
- flixOpt/calculation.py +0 -629
- flixOpt/components.py +0 -614
- flixOpt/core.py +0 -182
- flixOpt/effects.py +0 -410
- flixOpt/elements.py +0 -489
- flixOpt/features.py +0 -942
- flixOpt/flow_system.py +0 -351
- flixOpt/interface.py +0 -203
- flixOpt/linear_converters.py +0 -325
- flixOpt/math_modeling.py +0 -1145
- flixOpt/plotting.py +0 -712
- flixOpt/results.py +0 -563
- flixOpt/solvers.py +0 -21
- flixOpt/structure.py +0 -733
- flixOpt/utils.py +0 -134
- flixopt-1.0.12.dist-info/METADATA +0 -174
- flixopt-1.0.12.dist-info/RECORD +0 -29
- flixopt-1.0.12.dist-info/top_level.txt +0 -3
- {flixopt-1.0.12.dist-info → flixopt-2.0.1.dist-info/licenses}/LICENSE +0 -0
flixopt/solvers.py
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module contains the solvers of the flixopt framework, making them available to the end user in a compact way.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
import logging
|
|
6
|
+
from dataclasses import dataclass, field
|
|
7
|
+
from typing import Any, ClassVar, Dict, Optional
|
|
8
|
+
|
|
9
|
+
logger = logging.getLogger('flixopt')
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@dataclass
|
|
13
|
+
class _Solver:
|
|
14
|
+
"""
|
|
15
|
+
Abstract base class for solvers.
|
|
16
|
+
|
|
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.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
name: ClassVar[str]
|
|
24
|
+
mip_gap: float
|
|
25
|
+
time_limit_seconds: int
|
|
26
|
+
extra_options: Dict[str, Any] = field(default_factory=dict)
|
|
27
|
+
|
|
28
|
+
@property
|
|
29
|
+
def options(self) -> Dict[str, Any]:
|
|
30
|
+
"""Return a dictionary of solver options."""
|
|
31
|
+
return {key: value for key, value in {**self._options, **self.extra_options}.items() if value is not None}
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def _options(self) -> Dict[str, Any]:
|
|
35
|
+
"""Return a dictionary of solver options, translated to the solver's API."""
|
|
36
|
+
raise NotImplementedError
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
class GurobiSolver(_Solver):
|
|
40
|
+
"""
|
|
41
|
+
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
|
+
"""
|
|
47
|
+
|
|
48
|
+
name: ClassVar[str] = 'gurobi'
|
|
49
|
+
|
|
50
|
+
@property
|
|
51
|
+
def _options(self) -> Dict[str, Any]:
|
|
52
|
+
return {
|
|
53
|
+
'MIPGap': self.mip_gap,
|
|
54
|
+
'TimeLimit': self.time_limit_seconds,
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
class HighsSolver(_Solver):
|
|
59
|
+
"""
|
|
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.
|
|
66
|
+
"""
|
|
67
|
+
|
|
68
|
+
threads: Optional[int] = None
|
|
69
|
+
name: ClassVar[str] = 'highs'
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def _options(self) -> Dict[str, Any]:
|
|
73
|
+
return {
|
|
74
|
+
'mip_rel_gap': self.mip_gap,
|
|
75
|
+
'time_limit': self.time_limit_seconds,
|
|
76
|
+
'threads': self.threads,
|
|
77
|
+
}
|