walopy 0.2.1__tar.gz
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.
- walopy-0.2.1/LICENSE +21 -0
- walopy-0.2.1/PKG-INFO +214 -0
- walopy-0.2.1/README.md +177 -0
- walopy-0.2.1/pyproject.toml +52 -0
- walopy-0.2.1/setup.cfg +4 -0
- walopy-0.2.1/src/walopy/__init__.py +162 -0
- walopy-0.2.1/src/walopy/__main__.py +101 -0
- walopy-0.2.1/src/walopy/_utils.py +67 -0
- walopy-0.2.1/src/walopy/advanced.py +803 -0
- walopy-0.2.1/src/walopy/bottleneck.py +155 -0
- walopy-0.2.1/src/walopy/fitting.py +188 -0
- walopy-0.2.1/src/walopy/inventory.py +407 -0
- walopy-0.2.1/src/walopy/kpi.py +274 -0
- walopy-0.2.1/src/walopy/network.py +227 -0
- walopy-0.2.1/src/walopy/operations.py +328 -0
- walopy-0.2.1/src/walopy/plotting.py +626 -0
- walopy-0.2.1/src/walopy/queuing.py +302 -0
- walopy-0.2.1/src/walopy/solver.py +612 -0
- walopy-0.2.1/src/walopy.egg-info/PKG-INFO +214 -0
- walopy-0.2.1/src/walopy.egg-info/SOURCES.txt +31 -0
- walopy-0.2.1/src/walopy.egg-info/dependency_links.txt +1 -0
- walopy-0.2.1/src/walopy.egg-info/requires.txt +15 -0
- walopy-0.2.1/src/walopy.egg-info/top_level.txt +1 -0
- walopy-0.2.1/tests/test_advanced.py +177 -0
- walopy-0.2.1/tests/test_bottleneck.py +49 -0
- walopy-0.2.1/tests/test_fitting.py +90 -0
- walopy-0.2.1/tests/test_inventory.py +114 -0
- walopy-0.2.1/tests/test_kpi.py +93 -0
- walopy-0.2.1/tests/test_network.py +78 -0
- walopy-0.2.1/tests/test_new_models.py +126 -0
- walopy-0.2.1/tests/test_operations.py +56 -0
- walopy-0.2.1/tests/test_queuing.py +71 -0
- walopy-0.2.1/tests/test_solver.py +138 -0
walopy-0.2.1/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 LeoSanta15
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
walopy-0.2.1/PKG-INFO
ADDED
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: walopy
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Queuing theory, operations analysis, OEE, bottleneck analysis and KPI trees for Python
|
|
5
|
+
Author-email: LeoSanta15 <angelsanta1@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/LeoSanta15/walopy
|
|
8
|
+
Project-URL: Issues, https://github.com/LeoSanta15/walopy/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/LeoSanta15/walopy/blob/main/CHANGELOG.md
|
|
10
|
+
Keywords: queuing theory,operations research,little's law,kingman,bottleneck,OEE,efficiency,utilization,unit cost,KPI
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Classifier: Operating System :: OS Independent
|
|
18
|
+
Classifier: Intended Audience :: Science/Research
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering
|
|
20
|
+
Requires-Python: >=3.9
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
License-File: LICENSE
|
|
23
|
+
Requires-Dist: numpy>=1.22
|
|
24
|
+
Requires-Dist: pandas>=1.4
|
|
25
|
+
Requires-Dist: matplotlib>=3.5
|
|
26
|
+
Requires-Dist: plotly>=5.0
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: pytest>=7; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest-cov>=4; extra == "dev"
|
|
30
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
31
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
32
|
+
Provides-Extra: docs
|
|
33
|
+
Requires-Dist: sphinx>=7; extra == "docs"
|
|
34
|
+
Requires-Dist: sphinx-rtd-theme>=2; extra == "docs"
|
|
35
|
+
Requires-Dist: myst-parser>=2; extra == "docs"
|
|
36
|
+
Dynamic: license-file
|
|
37
|
+
|
|
38
|
+
# walopy
|
|
39
|
+
|
|
40
|
+
**Queuing theory, operations analysis, inventory models, KPI trees and more for Python.**
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
pip install walopy
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Quick start
|
|
49
|
+
|
|
50
|
+
```python
|
|
51
|
+
import walopy as wl
|
|
52
|
+
|
|
53
|
+
# --- Queuing models ---
|
|
54
|
+
r = wl.mm1(lam=3.0, mu=5.0)
|
|
55
|
+
print(r) # ρ=0.6 L=1.5 Lq=0.9 W=0.5 Wq=0.3
|
|
56
|
+
r.plot() # interactive Wq sensitivity chart
|
|
57
|
+
|
|
58
|
+
r = wl.mmc(lam=8.0, mu=5.0, c=2)
|
|
59
|
+
r = wl.md1(lam=3.0, mu=5.0)
|
|
60
|
+
r = wl.kingman(lam=3.0, mu=5.0, ca2=1.2, cs2=0.8)
|
|
61
|
+
|
|
62
|
+
L = wl.littles_law(lam=5.0, W=0.4) # → 2.0
|
|
63
|
+
|
|
64
|
+
# --- Finite-capacity and priority queues ---
|
|
65
|
+
r = wl.mm1k(lam=5.0, mu=3.0, K=10) # M/M/1/K
|
|
66
|
+
r = wl.mmck(lam=8.0, mu=3.0, c=2, K=20) # M/M/c/K
|
|
67
|
+
r = wl.erlang_b(lam=5.0, mu=1.0, c=8) # Erlang B blocking probability
|
|
68
|
+
|
|
69
|
+
# Non-preemptive HOL priority (class 0 = highest priority)
|
|
70
|
+
pri = wl.mm1_priority([2.0, 1.5, 0.5], mu=5.0)
|
|
71
|
+
print(pri)
|
|
72
|
+
|
|
73
|
+
# --- Fit parameters from real data ---
|
|
74
|
+
import numpy as np
|
|
75
|
+
rng = np.random.default_rng(42)
|
|
76
|
+
fit = wl.fit_from_data(
|
|
77
|
+
inter_arrivals=rng.exponential(0.2, 1000), # true λ = 5
|
|
78
|
+
service_times=rng.exponential(0.1, 1000), # true μ = 10
|
|
79
|
+
)
|
|
80
|
+
print(fit) # λ ≈ 5, μ ≈ 10, ca² ≈ 1, cs² ≈ 1
|
|
81
|
+
r = wl.kingman(**fit.to_model_kwargs()) # plug estimates directly into model
|
|
82
|
+
|
|
83
|
+
# From raw timestamps
|
|
84
|
+
ts = np.cumsum(rng.exponential(0.2, 1000))
|
|
85
|
+
fit = wl.fit_from_data(arrival_timestamps=ts)
|
|
86
|
+
|
|
87
|
+
# --- Jackson network of queues ---
|
|
88
|
+
net = wl.jackson_network(
|
|
89
|
+
station_names=["Intake", "QC", "Packaging"],
|
|
90
|
+
mu=[10.0, 8.0, 12.0],
|
|
91
|
+
gamma=[5.0, 0.0, 0.0],
|
|
92
|
+
routing=[[0.0, 1.0, 0.0], # Intake → QC
|
|
93
|
+
[0.0, 0.0, 1.0], # QC → Packaging
|
|
94
|
+
[0.0, 0.0, 0.0]], # Packaging → exit
|
|
95
|
+
servers=[1, 1, 2],
|
|
96
|
+
)
|
|
97
|
+
print(net)
|
|
98
|
+
print(net.to_frame())
|
|
99
|
+
|
|
100
|
+
# --- Solvers ---
|
|
101
|
+
r = wl.solve_lam("Wq", 0.5, mu=5.0, model="mm1") # max λ for Wq ≤ 0.5
|
|
102
|
+
r = wl.solve_mu("Wq", 0.3, lam=3.0, model="mm1") # min μ for Wq ≤ 0.3
|
|
103
|
+
r = wl.solve_servers("Wq", 0.1, lam=8.0, mu=5.0) # min c for Wq ≤ 0.1
|
|
104
|
+
r = wl.optimize_servers(lam=6.0, mu=5.0,
|
|
105
|
+
cost_per_server=10.0,
|
|
106
|
+
cost_per_wait=5.0)
|
|
107
|
+
|
|
108
|
+
# --- Sensitivity sweep ---
|
|
109
|
+
import numpy as np
|
|
110
|
+
df = wl.sensitivity(wl.mm1, "lam", np.linspace(0.5, 4.5, 20), mu=5.0)
|
|
111
|
+
|
|
112
|
+
# --- Batch: apply model to a DataFrame of scenarios ---
|
|
113
|
+
import pandas as pd
|
|
114
|
+
scenarios = pd.DataFrame({"lam": [1.0, 2.0, 3.0, 4.0]})
|
|
115
|
+
df = wl.batch_model(wl.mm1, scenarios, mu=5.0)
|
|
116
|
+
|
|
117
|
+
# --- Compare multiple results ---
|
|
118
|
+
df = wl.compare(
|
|
119
|
+
wl.mm1(3.0, 5.0),
|
|
120
|
+
wl.mmc(3.0, 5.0, 2),
|
|
121
|
+
wl.md1(3.0, 5.0),
|
|
122
|
+
labels=["M/M/1", "M/M/2", "M/D/1"],
|
|
123
|
+
)
|
|
124
|
+
|
|
125
|
+
# --- Simulation ---
|
|
126
|
+
sim = wl.monte_carlo_gg1(lam=3.0, mu=5.0, ca2=1.0, cs2=0.5,
|
|
127
|
+
n_customers=50_000, seed=42)
|
|
128
|
+
print(sim.Wq_p95) # 95th-percentile waiting time
|
|
129
|
+
|
|
130
|
+
# --- OEE ---
|
|
131
|
+
r = wl.oee(availability=0.90, performance=0.80, quality=0.95)
|
|
132
|
+
print(r) # OEE = 68.4%
|
|
133
|
+
r.plot()
|
|
134
|
+
|
|
135
|
+
# --- Bottleneck analysis ---
|
|
136
|
+
r = wl.bottleneck_analysis(
|
|
137
|
+
station_names=["Corte", "Soldadura", "Pintura"],
|
|
138
|
+
capacities=[120.0, 80.0, 100.0],
|
|
139
|
+
demand_rate=70.0,
|
|
140
|
+
)
|
|
141
|
+
print(r) # Bottleneck: Soldadura
|
|
142
|
+
r.plot()
|
|
143
|
+
|
|
144
|
+
# --- KPI trees (interactive Plotly) ---
|
|
145
|
+
tree = wl.oee_kpi_tree(0.9, 0.8, 0.95)
|
|
146
|
+
tree.plot() # treemap or sunburst
|
|
147
|
+
|
|
148
|
+
tree = wl.roi_kpi_tree(
|
|
149
|
+
revenue=50_000, fixed_cost=10_000,
|
|
150
|
+
variable_cost_per_unit=8, units_sold=2_000,
|
|
151
|
+
investment=20_000,
|
|
152
|
+
)
|
|
153
|
+
print(tree) # ROI = 1.20 (120%)
|
|
154
|
+
|
|
155
|
+
# --- Line balance and takt time ---
|
|
156
|
+
takt = wl.takt_time(available_time=480, demand=60) # 8 min/unit
|
|
157
|
+
lb = wl.line_balance(["A", "B", "C"], [5.0, 9.0, 4.0], takt=10.0)
|
|
158
|
+
print(lb.bottleneck, lb.balance_efficiency)
|
|
159
|
+
|
|
160
|
+
# --- Break-even ---
|
|
161
|
+
be = wl.break_even(fixed_cost=10_000, price_per_unit=25,
|
|
162
|
+
variable_cost_per_unit=15, actual_units=1_500)
|
|
163
|
+
print(be.bep_units, be.margin_of_safety_pct)
|
|
164
|
+
|
|
165
|
+
# --- Inventory ---
|
|
166
|
+
r = wl.eoq(demand_rate=1000, ordering_cost=50, holding_cost=2)
|
|
167
|
+
print(r) # EOQ ≈ 223.6 units
|
|
168
|
+
|
|
169
|
+
r = wl.reorder_point(
|
|
170
|
+
demand_rate=50, lead_time=2,
|
|
171
|
+
demand_std=10, lead_time_std=0.5,
|
|
172
|
+
service_level=0.95,
|
|
173
|
+
)
|
|
174
|
+
print(r.reorder_point, r.safety_stock)
|
|
175
|
+
|
|
176
|
+
r = wl.newsvendor(
|
|
177
|
+
demand_mean=100, demand_std=20,
|
|
178
|
+
price=10, cost=6, salvage=2,
|
|
179
|
+
)
|
|
180
|
+
print(r.optimal_qty, r.critical_ratio)
|
|
181
|
+
|
|
182
|
+
# --- CLI ---
|
|
183
|
+
# python -m walopy mm1 --lam 3 --mu 5
|
|
184
|
+
# python -m walopy mmc --lam 8 --mu 5 --c 2
|
|
185
|
+
# python -m walopy eoq --demand 1000 --ordering 50 --holding 2
|
|
186
|
+
# python -m walopy --version
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
---
|
|
190
|
+
|
|
191
|
+
## Modules
|
|
192
|
+
|
|
193
|
+
| Module | Key functions |
|
|
194
|
+
|---|---|
|
|
195
|
+
| `queuing` | `mm1`, `mmc`, `md1`, `kingman`, `littles_law` |
|
|
196
|
+
| `advanced` | `mm1k`, `mmck`, `erlang_b`, `mm1_priority`, `monte_carlo_gg1`, `takt_time`, `line_balance`, `break_even`, `queue_length_pmf`, `sojourn_cdf` |
|
|
197
|
+
| `fitting` | `fit_from_data` — estimate λ, μ, ca², cs² from observed data |
|
|
198
|
+
| `inventory` | `eoq`, `reorder_point`, `newsvendor` |
|
|
199
|
+
| `network` | `jackson_network` — open Jackson networks |
|
|
200
|
+
| `operations` | `oee`, `utilization_efficiency`, `unit_cost` |
|
|
201
|
+
| `bottleneck` | `bottleneck_analysis` |
|
|
202
|
+
| `kpi` | `KPINode`, `oee_kpi_tree`, `throughput_kpi_tree`, `roi_kpi_tree` |
|
|
203
|
+
| `solver` | `solve_lam`, `solve_mu`, `solve_servers`, `optimize_servers`, `sensitivity`, `batch_model`, `compare` |
|
|
204
|
+
| `plotting` | All `.plot()` back-ends (Matplotlib + Plotly) |
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
208
|
+
## Requirements
|
|
209
|
+
|
|
210
|
+
Python ≥ 3.9 · numpy ≥ 1.22 · pandas ≥ 1.4 · matplotlib ≥ 3.5 · plotly ≥ 5.0
|
|
211
|
+
|
|
212
|
+
## License
|
|
213
|
+
|
|
214
|
+
MIT
|
walopy-0.2.1/README.md
ADDED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
# walopy
|
|
2
|
+
|
|
3
|
+
**Queuing theory, operations analysis, inventory models, KPI trees and more for Python.**
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
pip install walopy
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## Quick start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
import walopy as wl
|
|
15
|
+
|
|
16
|
+
# --- Queuing models ---
|
|
17
|
+
r = wl.mm1(lam=3.0, mu=5.0)
|
|
18
|
+
print(r) # ρ=0.6 L=1.5 Lq=0.9 W=0.5 Wq=0.3
|
|
19
|
+
r.plot() # interactive Wq sensitivity chart
|
|
20
|
+
|
|
21
|
+
r = wl.mmc(lam=8.0, mu=5.0, c=2)
|
|
22
|
+
r = wl.md1(lam=3.0, mu=5.0)
|
|
23
|
+
r = wl.kingman(lam=3.0, mu=5.0, ca2=1.2, cs2=0.8)
|
|
24
|
+
|
|
25
|
+
L = wl.littles_law(lam=5.0, W=0.4) # → 2.0
|
|
26
|
+
|
|
27
|
+
# --- Finite-capacity and priority queues ---
|
|
28
|
+
r = wl.mm1k(lam=5.0, mu=3.0, K=10) # M/M/1/K
|
|
29
|
+
r = wl.mmck(lam=8.0, mu=3.0, c=2, K=20) # M/M/c/K
|
|
30
|
+
r = wl.erlang_b(lam=5.0, mu=1.0, c=8) # Erlang B blocking probability
|
|
31
|
+
|
|
32
|
+
# Non-preemptive HOL priority (class 0 = highest priority)
|
|
33
|
+
pri = wl.mm1_priority([2.0, 1.5, 0.5], mu=5.0)
|
|
34
|
+
print(pri)
|
|
35
|
+
|
|
36
|
+
# --- Fit parameters from real data ---
|
|
37
|
+
import numpy as np
|
|
38
|
+
rng = np.random.default_rng(42)
|
|
39
|
+
fit = wl.fit_from_data(
|
|
40
|
+
inter_arrivals=rng.exponential(0.2, 1000), # true λ = 5
|
|
41
|
+
service_times=rng.exponential(0.1, 1000), # true μ = 10
|
|
42
|
+
)
|
|
43
|
+
print(fit) # λ ≈ 5, μ ≈ 10, ca² ≈ 1, cs² ≈ 1
|
|
44
|
+
r = wl.kingman(**fit.to_model_kwargs()) # plug estimates directly into model
|
|
45
|
+
|
|
46
|
+
# From raw timestamps
|
|
47
|
+
ts = np.cumsum(rng.exponential(0.2, 1000))
|
|
48
|
+
fit = wl.fit_from_data(arrival_timestamps=ts)
|
|
49
|
+
|
|
50
|
+
# --- Jackson network of queues ---
|
|
51
|
+
net = wl.jackson_network(
|
|
52
|
+
station_names=["Intake", "QC", "Packaging"],
|
|
53
|
+
mu=[10.0, 8.0, 12.0],
|
|
54
|
+
gamma=[5.0, 0.0, 0.0],
|
|
55
|
+
routing=[[0.0, 1.0, 0.0], # Intake → QC
|
|
56
|
+
[0.0, 0.0, 1.0], # QC → Packaging
|
|
57
|
+
[0.0, 0.0, 0.0]], # Packaging → exit
|
|
58
|
+
servers=[1, 1, 2],
|
|
59
|
+
)
|
|
60
|
+
print(net)
|
|
61
|
+
print(net.to_frame())
|
|
62
|
+
|
|
63
|
+
# --- Solvers ---
|
|
64
|
+
r = wl.solve_lam("Wq", 0.5, mu=5.0, model="mm1") # max λ for Wq ≤ 0.5
|
|
65
|
+
r = wl.solve_mu("Wq", 0.3, lam=3.0, model="mm1") # min μ for Wq ≤ 0.3
|
|
66
|
+
r = wl.solve_servers("Wq", 0.1, lam=8.0, mu=5.0) # min c for Wq ≤ 0.1
|
|
67
|
+
r = wl.optimize_servers(lam=6.0, mu=5.0,
|
|
68
|
+
cost_per_server=10.0,
|
|
69
|
+
cost_per_wait=5.0)
|
|
70
|
+
|
|
71
|
+
# --- Sensitivity sweep ---
|
|
72
|
+
import numpy as np
|
|
73
|
+
df = wl.sensitivity(wl.mm1, "lam", np.linspace(0.5, 4.5, 20), mu=5.0)
|
|
74
|
+
|
|
75
|
+
# --- Batch: apply model to a DataFrame of scenarios ---
|
|
76
|
+
import pandas as pd
|
|
77
|
+
scenarios = pd.DataFrame({"lam": [1.0, 2.0, 3.0, 4.0]})
|
|
78
|
+
df = wl.batch_model(wl.mm1, scenarios, mu=5.0)
|
|
79
|
+
|
|
80
|
+
# --- Compare multiple results ---
|
|
81
|
+
df = wl.compare(
|
|
82
|
+
wl.mm1(3.0, 5.0),
|
|
83
|
+
wl.mmc(3.0, 5.0, 2),
|
|
84
|
+
wl.md1(3.0, 5.0),
|
|
85
|
+
labels=["M/M/1", "M/M/2", "M/D/1"],
|
|
86
|
+
)
|
|
87
|
+
|
|
88
|
+
# --- Simulation ---
|
|
89
|
+
sim = wl.monte_carlo_gg1(lam=3.0, mu=5.0, ca2=1.0, cs2=0.5,
|
|
90
|
+
n_customers=50_000, seed=42)
|
|
91
|
+
print(sim.Wq_p95) # 95th-percentile waiting time
|
|
92
|
+
|
|
93
|
+
# --- OEE ---
|
|
94
|
+
r = wl.oee(availability=0.90, performance=0.80, quality=0.95)
|
|
95
|
+
print(r) # OEE = 68.4%
|
|
96
|
+
r.plot()
|
|
97
|
+
|
|
98
|
+
# --- Bottleneck analysis ---
|
|
99
|
+
r = wl.bottleneck_analysis(
|
|
100
|
+
station_names=["Corte", "Soldadura", "Pintura"],
|
|
101
|
+
capacities=[120.0, 80.0, 100.0],
|
|
102
|
+
demand_rate=70.0,
|
|
103
|
+
)
|
|
104
|
+
print(r) # Bottleneck: Soldadura
|
|
105
|
+
r.plot()
|
|
106
|
+
|
|
107
|
+
# --- KPI trees (interactive Plotly) ---
|
|
108
|
+
tree = wl.oee_kpi_tree(0.9, 0.8, 0.95)
|
|
109
|
+
tree.plot() # treemap or sunburst
|
|
110
|
+
|
|
111
|
+
tree = wl.roi_kpi_tree(
|
|
112
|
+
revenue=50_000, fixed_cost=10_000,
|
|
113
|
+
variable_cost_per_unit=8, units_sold=2_000,
|
|
114
|
+
investment=20_000,
|
|
115
|
+
)
|
|
116
|
+
print(tree) # ROI = 1.20 (120%)
|
|
117
|
+
|
|
118
|
+
# --- Line balance and takt time ---
|
|
119
|
+
takt = wl.takt_time(available_time=480, demand=60) # 8 min/unit
|
|
120
|
+
lb = wl.line_balance(["A", "B", "C"], [5.0, 9.0, 4.0], takt=10.0)
|
|
121
|
+
print(lb.bottleneck, lb.balance_efficiency)
|
|
122
|
+
|
|
123
|
+
# --- Break-even ---
|
|
124
|
+
be = wl.break_even(fixed_cost=10_000, price_per_unit=25,
|
|
125
|
+
variable_cost_per_unit=15, actual_units=1_500)
|
|
126
|
+
print(be.bep_units, be.margin_of_safety_pct)
|
|
127
|
+
|
|
128
|
+
# --- Inventory ---
|
|
129
|
+
r = wl.eoq(demand_rate=1000, ordering_cost=50, holding_cost=2)
|
|
130
|
+
print(r) # EOQ ≈ 223.6 units
|
|
131
|
+
|
|
132
|
+
r = wl.reorder_point(
|
|
133
|
+
demand_rate=50, lead_time=2,
|
|
134
|
+
demand_std=10, lead_time_std=0.5,
|
|
135
|
+
service_level=0.95,
|
|
136
|
+
)
|
|
137
|
+
print(r.reorder_point, r.safety_stock)
|
|
138
|
+
|
|
139
|
+
r = wl.newsvendor(
|
|
140
|
+
demand_mean=100, demand_std=20,
|
|
141
|
+
price=10, cost=6, salvage=2,
|
|
142
|
+
)
|
|
143
|
+
print(r.optimal_qty, r.critical_ratio)
|
|
144
|
+
|
|
145
|
+
# --- CLI ---
|
|
146
|
+
# python -m walopy mm1 --lam 3 --mu 5
|
|
147
|
+
# python -m walopy mmc --lam 8 --mu 5 --c 2
|
|
148
|
+
# python -m walopy eoq --demand 1000 --ordering 50 --holding 2
|
|
149
|
+
# python -m walopy --version
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
## Modules
|
|
155
|
+
|
|
156
|
+
| Module | Key functions |
|
|
157
|
+
|---|---|
|
|
158
|
+
| `queuing` | `mm1`, `mmc`, `md1`, `kingman`, `littles_law` |
|
|
159
|
+
| `advanced` | `mm1k`, `mmck`, `erlang_b`, `mm1_priority`, `monte_carlo_gg1`, `takt_time`, `line_balance`, `break_even`, `queue_length_pmf`, `sojourn_cdf` |
|
|
160
|
+
| `fitting` | `fit_from_data` — estimate λ, μ, ca², cs² from observed data |
|
|
161
|
+
| `inventory` | `eoq`, `reorder_point`, `newsvendor` |
|
|
162
|
+
| `network` | `jackson_network` — open Jackson networks |
|
|
163
|
+
| `operations` | `oee`, `utilization_efficiency`, `unit_cost` |
|
|
164
|
+
| `bottleneck` | `bottleneck_analysis` |
|
|
165
|
+
| `kpi` | `KPINode`, `oee_kpi_tree`, `throughput_kpi_tree`, `roi_kpi_tree` |
|
|
166
|
+
| `solver` | `solve_lam`, `solve_mu`, `solve_servers`, `optimize_servers`, `sensitivity`, `batch_model`, `compare` |
|
|
167
|
+
| `plotting` | All `.plot()` back-ends (Matplotlib + Plotly) |
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Requirements
|
|
172
|
+
|
|
173
|
+
Python ≥ 3.9 · numpy ≥ 1.22 · pandas ≥ 1.4 · matplotlib ≥ 3.5 · plotly ≥ 5.0
|
|
174
|
+
|
|
175
|
+
## License
|
|
176
|
+
|
|
177
|
+
MIT
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=77.0.3", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "walopy"
|
|
7
|
+
version = "0.2.1"
|
|
8
|
+
description = "Queuing theory, operations analysis, OEE, bottleneck analysis and KPI trees for Python"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [{ name = "LeoSanta15", email = "angelsanta1@gmail.com" }]
|
|
14
|
+
keywords = [
|
|
15
|
+
"queuing theory", "operations research", "little's law", "kingman",
|
|
16
|
+
"bottleneck", "OEE", "efficiency", "utilization", "unit cost", "KPI",
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Programming Language :: Python :: 3.9",
|
|
21
|
+
"Programming Language :: Python :: 3.10",
|
|
22
|
+
"Programming Language :: Python :: 3.11",
|
|
23
|
+
"Programming Language :: Python :: 3.12",
|
|
24
|
+
"Programming Language :: Python :: 3.13",
|
|
25
|
+
"Operating System :: OS Independent",
|
|
26
|
+
"Intended Audience :: Science/Research",
|
|
27
|
+
"Topic :: Scientific/Engineering",
|
|
28
|
+
]
|
|
29
|
+
dependencies = ["numpy>=1.22", "pandas>=1.4", "matplotlib>=3.5", "plotly>=5.0"]
|
|
30
|
+
|
|
31
|
+
[project.optional-dependencies]
|
|
32
|
+
dev = ["pytest>=7", "pytest-cov>=4", "ruff>=0.6", "mypy>=1.10"]
|
|
33
|
+
docs = ["sphinx>=7", "sphinx-rtd-theme>=2", "myst-parser>=2"]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/LeoSanta15/walopy"
|
|
37
|
+
Issues = "https://github.com/LeoSanta15/walopy/issues"
|
|
38
|
+
Changelog = "https://github.com/LeoSanta15/walopy/blob/main/CHANGELOG.md"
|
|
39
|
+
|
|
40
|
+
[tool.setuptools.packages.find]
|
|
41
|
+
where = ["src"]
|
|
42
|
+
|
|
43
|
+
[tool.pytest.ini_options]
|
|
44
|
+
testpaths = ["tests"]
|
|
45
|
+
addopts = "-q"
|
|
46
|
+
|
|
47
|
+
[tool.mypy]
|
|
48
|
+
ignore_missing_imports = true
|
|
49
|
+
|
|
50
|
+
[tool.ruff]
|
|
51
|
+
line-length = 110
|
|
52
|
+
target-version = "py39"
|
walopy-0.2.1/setup.cfg
ADDED
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
"""walopy — Queuing theory, operations analysis and KPI trees for Python."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
# Queuing
|
|
5
|
+
from .queuing import (
|
|
6
|
+
QueueResult,
|
|
7
|
+
littles_law,
|
|
8
|
+
mm1,
|
|
9
|
+
mmc,
|
|
10
|
+
md1,
|
|
11
|
+
kingman,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
# Operations
|
|
15
|
+
from .operations import (
|
|
16
|
+
OEEResult,
|
|
17
|
+
UtilizationResult,
|
|
18
|
+
UnitCostResult,
|
|
19
|
+
oee,
|
|
20
|
+
utilization_efficiency,
|
|
21
|
+
unit_cost,
|
|
22
|
+
)
|
|
23
|
+
|
|
24
|
+
# Bottleneck
|
|
25
|
+
from .bottleneck import (
|
|
26
|
+
BottleneckResult,
|
|
27
|
+
StationResult,
|
|
28
|
+
bottleneck_analysis,
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
# KPI trees
|
|
32
|
+
from .kpi import (
|
|
33
|
+
KPINode,
|
|
34
|
+
oee_kpi_tree,
|
|
35
|
+
throughput_kpi_tree,
|
|
36
|
+
roi_kpi_tree,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
# Solvers
|
|
40
|
+
from .solver import (
|
|
41
|
+
SolverResult,
|
|
42
|
+
OptimizeResult,
|
|
43
|
+
solve_lam,
|
|
44
|
+
solve_mu,
|
|
45
|
+
solve_servers,
|
|
46
|
+
optimize_servers,
|
|
47
|
+
sensitivity,
|
|
48
|
+
batch_model,
|
|
49
|
+
compare,
|
|
50
|
+
)
|
|
51
|
+
|
|
52
|
+
# Advanced models
|
|
53
|
+
from .advanced import (
|
|
54
|
+
SimulationResult,
|
|
55
|
+
LineBalanceResult,
|
|
56
|
+
BreakEvenResult,
|
|
57
|
+
PriorityQueueResult,
|
|
58
|
+
erlang_b,
|
|
59
|
+
mm1k,
|
|
60
|
+
mmck,
|
|
61
|
+
mm1_priority,
|
|
62
|
+
monte_carlo_gg1,
|
|
63
|
+
takt_time,
|
|
64
|
+
line_balance,
|
|
65
|
+
break_even,
|
|
66
|
+
queue_length_pmf,
|
|
67
|
+
sojourn_cdf,
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
# Fitting
|
|
71
|
+
from .fitting import (
|
|
72
|
+
FitResult,
|
|
73
|
+
fit_from_data,
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
# Inventory
|
|
77
|
+
from .inventory import (
|
|
78
|
+
EOQResult,
|
|
79
|
+
ReorderResult,
|
|
80
|
+
NewsvendorResult,
|
|
81
|
+
eoq,
|
|
82
|
+
reorder_point,
|
|
83
|
+
newsvendor,
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
# Network
|
|
87
|
+
from .network import (
|
|
88
|
+
StationMetrics,
|
|
89
|
+
JacksonResult,
|
|
90
|
+
jackson_network,
|
|
91
|
+
)
|
|
92
|
+
|
|
93
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
94
|
+
try:
|
|
95
|
+
__version__: str = version("walopy")
|
|
96
|
+
except PackageNotFoundError:
|
|
97
|
+
__version__ = "0.2.0" # fallback when running from source without install
|
|
98
|
+
|
|
99
|
+
__all__ = [
|
|
100
|
+
# queuing
|
|
101
|
+
"QueueResult",
|
|
102
|
+
"littles_law",
|
|
103
|
+
"mm1",
|
|
104
|
+
"mmc",
|
|
105
|
+
"md1",
|
|
106
|
+
"kingman",
|
|
107
|
+
# operations
|
|
108
|
+
"OEEResult",
|
|
109
|
+
"UtilizationResult",
|
|
110
|
+
"UnitCostResult",
|
|
111
|
+
"oee",
|
|
112
|
+
"utilization_efficiency",
|
|
113
|
+
"unit_cost",
|
|
114
|
+
# bottleneck
|
|
115
|
+
"BottleneckResult",
|
|
116
|
+
"StationResult",
|
|
117
|
+
"bottleneck_analysis",
|
|
118
|
+
# kpi
|
|
119
|
+
"KPINode",
|
|
120
|
+
"oee_kpi_tree",
|
|
121
|
+
"throughput_kpi_tree",
|
|
122
|
+
"roi_kpi_tree",
|
|
123
|
+
# solver
|
|
124
|
+
"SolverResult",
|
|
125
|
+
"OptimizeResult",
|
|
126
|
+
"solve_lam",
|
|
127
|
+
"solve_mu",
|
|
128
|
+
"solve_servers",
|
|
129
|
+
"optimize_servers",
|
|
130
|
+
"sensitivity",
|
|
131
|
+
"batch_model",
|
|
132
|
+
"compare",
|
|
133
|
+
# advanced
|
|
134
|
+
"SimulationResult",
|
|
135
|
+
"LineBalanceResult",
|
|
136
|
+
"BreakEvenResult",
|
|
137
|
+
"PriorityQueueResult",
|
|
138
|
+
"erlang_b",
|
|
139
|
+
"mm1k",
|
|
140
|
+
"mmck",
|
|
141
|
+
"mm1_priority",
|
|
142
|
+
"monte_carlo_gg1",
|
|
143
|
+
"takt_time",
|
|
144
|
+
"line_balance",
|
|
145
|
+
"break_even",
|
|
146
|
+
"queue_length_pmf",
|
|
147
|
+
"sojourn_cdf",
|
|
148
|
+
# fitting
|
|
149
|
+
"FitResult",
|
|
150
|
+
"fit_from_data",
|
|
151
|
+
# inventory
|
|
152
|
+
"EOQResult",
|
|
153
|
+
"ReorderResult",
|
|
154
|
+
"NewsvendorResult",
|
|
155
|
+
"eoq",
|
|
156
|
+
"reorder_point",
|
|
157
|
+
"newsvendor",
|
|
158
|
+
# network
|
|
159
|
+
"StationMetrics",
|
|
160
|
+
"JacksonResult",
|
|
161
|
+
"jackson_network",
|
|
162
|
+
]
|