netoptim 0.2__tar.gz → 0.3__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.
- {netoptim-0.2 → netoptim-0.3}/.gitignore +4 -0
- netoptim-0.3/.vscode/settings.json +4 -0
- netoptim-0.3/CHANGELOG.md +22 -0
- {netoptim-0.2/src/netoptim.egg-info → netoptim-0.3}/PKG-INFO +4 -2
- {netoptim-0.2 → netoptim-0.3}/docs/conf.py +13 -0
- netoptim-0.3/docs/examples/plot_network_flow.py +36 -0
- netoptim-0.3/docs/examples/plot_network_oracle.py +35 -0
- netoptim-0.3/docs/figures_demo.md +25 -0
- {netoptim-0.2 → netoptim-0.3}/docs/index.md +1 -0
- {netoptim-0.2 → netoptim-0.3}/mypy.ini +0 -5
- {netoptim-0.2 → netoptim-0.3}/setup.cfg +3 -3
- {netoptim-0.2 → netoptim-0.3}/src/netoptim/network_oracle.py +3 -3
- {netoptim-0.2 → netoptim-0.3/src/netoptim.egg-info}/PKG-INFO +4 -2
- {netoptim-0.2 → netoptim-0.3}/src/netoptim.egg-info/SOURCES.txt +6 -2
- {netoptim-0.2 → netoptim-0.3}/src/netoptim.egg-info/requires.txt +3 -3
- netoptim-0.3/src/netoptim.egg-info/scm_file_list.json +75 -0
- netoptim-0.3/src/netoptim.egg-info/scm_version.json +8 -0
- {netoptim-0.2 → netoptim-0.3}/tests/test_cycle_finder.py +18 -9
- {netoptim-0.2 → netoptim-0.3}/tests/test_cycle_finder2.py +30 -24
- netoptim-0.3/tests/test_delay_padding.py +142 -0
- {netoptim-0.2 → netoptim-0.3}/tests/test_network_oracle.py +3 -3
- {netoptim-0.2 → netoptim-0.3}/tests/test_network_oracle2.py +4 -4
- {netoptim-0.2 → netoptim-0.3}/tests/test_ratio.py +9 -9
- {netoptim-0.2 → netoptim-0.3}/tests/test_stress_network_oracle.py +2 -2
- {netoptim-0.2 → netoptim-0.3}/tests/test_stress_optscaling.py +1 -1
- netoptim-0.2/CHANGELOG.md +0 -7
- netoptim-0.2/IFLOW.md +0 -85
- netoptim-0.2/LICENSE +0 -21
- netoptim-0.2/tests/test_delay_padding.py +0 -133
- {netoptim-0.2 → netoptim-0.3}/.coveragerc +0 -0
- {netoptim-0.2 → netoptim-0.3}/.flake8 +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/ci.bak +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/jekyll-gh-pages.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/multi-platforms.bak +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/multi-platforms.yml +1 -1
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/python-app.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/python-package.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.github/workflows/python-publish.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.gitpod.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.isort.cfg +0 -0
- {netoptim-0.2 → netoptim-0.3}/.markdownlint.json +0 -0
- {netoptim-0.2 → netoptim-0.3}/.pre-commit-config.yaml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.readthedocs.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/.shellcheckrc +0 -0
- {netoptim-0.2 → netoptim-0.3}/AUTHORS.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/AUTHORS.rst +0 -0
- {netoptim-0.2 → netoptim-0.3}/CHANGELOG.rst +0 -0
- {netoptim-0.2 → netoptim-0.3}/CONTRIBUTING.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/GEMINI.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/LICENSE.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/README.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/README.rst +0 -0
- {netoptim-0.2 → netoptim-0.3}/_config.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/Makefile +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/_static/.gitignore +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/api/modules.rst +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/api/netoptim.rst +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/authors.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/changelog.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/contributing.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/license.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/readme.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/docs/requirements.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/environment.yml +0 -0
- {netoptim-0.2 → netoptim-0.3}/experiments/plot_node_colormap.ipynb +0 -0
- {netoptim-0.2 → netoptim-0.3}/experiments/plot_node_colormap.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/note.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/pyproject.toml +0 -0
- {netoptim-0.2 → netoptim-0.3}/requirements/README.md +0 -0
- {netoptim-0.2 → netoptim-0.3}/requirements/default.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/requirements/doc.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/requirements/test.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/requirements.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/setup.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim/__init__.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim/optscaling_oracle.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim/py.typed +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim.egg-info/dependency_links.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim.egg-info/not-zip-safe +0 -0
- {netoptim-0.2 → netoptim-0.3}/src/netoptim.egg-info/top_level.txt +0 -0
- {netoptim-0.2 → netoptim-0.3}/tests/__init__.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/tests/conftest.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/tests/test_optscaling.py +0 -0
- {netoptim-0.2 → netoptim-0.3}/tox.ini +0 -0
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## Version 0.3 (2026-07-16)
|
|
4
|
+
|
|
5
|
+
### Documentation
|
|
6
|
+
- **plot_directive with network flow examples**: Enabled matplotlib plot_directive for auto-generated figures. Added network flow and network oracle example plots. (#4ae94a8)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
- **mypy type annotation fixes**: Annotated `NegCycleFinder` with `float Domain` to prevent `int` default. Fixed `NetworkOracle.__init__` parameter types to `Dict[Any, float]`. (#336ef29)
|
|
10
|
+
- **Float literal normalization**: Normalized integer literals to float in test graph data across cycle_finder, ratio, and stress_optscaling tests for type consistency. (#30f5d7a)
|
|
11
|
+
- **Re-enabled disabled tests**: Fixed type annotations in `test_delay_padding` and re-enabled `test_maximize_slack`, `test_maximize_effective_slack`. (#8a76500)
|
|
12
|
+
|
|
13
|
+
### Testing & Code Quality
|
|
14
|
+
- **Delay padding implementation**: Added delay padding with enhanced cycle finder test cases. (#9df6788)
|
|
15
|
+
- **Additional cycle finder tests**: Added extra test cases for cycle finder algorithms. (#9df6788)
|
|
16
|
+
|
|
17
|
+
### Code Cleanup
|
|
18
|
+
- **Removed PyScaffold boilerplate**: Deleted `skeleton.py`/`test_skeleton.py`, removed Python < 3.9 compat, dead entry points, stale `IFLOW.md`, duplicate `LICENSE`. (#4cd5756)
|
|
19
|
+
|
|
20
|
+
### Build & CI
|
|
21
|
+
- **CI repair**: Fixed broken entry_points and remaining skeleton imports. (#c2bf0d3)
|
|
22
|
+
- **Dependency fixes**: Added explicit `mywheel` dep, PyPI-compatible version pins, removed redundant git+https installs. (#81b59c8, #2d232b7, #f07e1bf)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netoptim
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3
|
|
4
4
|
Summary: Network Optimization Python Code
|
|
5
5
|
Home-page: https://github.com/luk036/netoptim
|
|
6
6
|
Author: Wai-Shing Luk
|
|
@@ -16,7 +16,9 @@ Classifier: Programming Language :: Python
|
|
|
16
16
|
Requires-Python: >=3.9
|
|
17
17
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
18
|
License-File: LICENSE.txt
|
|
19
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: digraphx>=0.3
|
|
20
|
+
Requires-Dist: ellalgo>=0.4
|
|
21
|
+
Requires-Dist: mywheel>=0.3
|
|
20
22
|
Requires-Dist: networkx
|
|
21
23
|
Provides-Extra: testing
|
|
22
24
|
Requires-Dist: setuptools; extra == "testing"
|
|
@@ -48,6 +48,19 @@ extensions = [
|
|
|
48
48
|
"sphinx.ext.mathjax",
|
|
49
49
|
"sphinx.ext.napoleon",
|
|
50
50
|
"sphinxcontrib.svgbob",
|
|
51
|
+
"matplotlib.sphinxext.plot_directive",
|
|
52
|
+
]
|
|
53
|
+
|
|
54
|
+
# -- matplotlib.sphinxext.plot_directive configuration -----------------------
|
|
55
|
+
plot_html_show_source_link = True
|
|
56
|
+
plot_html_show_formats = False
|
|
57
|
+
plot_include_source = True
|
|
58
|
+
plot_working_directory = os.path.join(__location__, "examples")
|
|
59
|
+
plot_pre_code = [
|
|
60
|
+
"import matplotlib.pyplot as plt",
|
|
61
|
+
"import networkx as nx",
|
|
62
|
+
"import numpy as np",
|
|
63
|
+
"plt.rcParams['figure.dpi'] = 100",
|
|
51
64
|
]
|
|
52
65
|
|
|
53
66
|
# Add any paths that contain templates here, relative to this directory.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Network Flow Graph
|
|
3
|
+
==================
|
|
4
|
+
|
|
5
|
+
Visualization of a directed flow network with edge capacities.
|
|
6
|
+
"""
|
|
7
|
+
import matplotlib.pyplot as plt
|
|
8
|
+
import networkx as nx
|
|
9
|
+
|
|
10
|
+
g = nx.DiGraph()
|
|
11
|
+
edges = [
|
|
12
|
+
("s", "a", 10),
|
|
13
|
+
("s", "b", 5),
|
|
14
|
+
("a", "b", 15),
|
|
15
|
+
("a", "t", 10),
|
|
16
|
+
("b", "t", 10),
|
|
17
|
+
]
|
|
18
|
+
for u, v, c in edges:
|
|
19
|
+
g.add_edge(u, v, capacity=c)
|
|
20
|
+
|
|
21
|
+
plt.figure(figsize=(7, 5))
|
|
22
|
+
pos = nx.spring_layout(g, seed=42)
|
|
23
|
+
nx.draw(
|
|
24
|
+
g,
|
|
25
|
+
pos,
|
|
26
|
+
with_labels=True,
|
|
27
|
+
node_color="lightgreen",
|
|
28
|
+
node_size=800,
|
|
29
|
+
arrowsize=25,
|
|
30
|
+
font_weight="bold",
|
|
31
|
+
font_size=14,
|
|
32
|
+
)
|
|
33
|
+
edge_labels = {(u, v): f'cap={d["capacity"]}' for u, v, d in g.edges(data=True)}
|
|
34
|
+
nx.draw_networkx_edge_labels(g, pos, edge_labels=edge_labels, font_size=11)
|
|
35
|
+
plt.title("Flow Network with Edge Capacities")
|
|
36
|
+
plt.grid(True, alpha=0.3)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Network Oracle Example
|
|
3
|
+
======================
|
|
4
|
+
|
|
5
|
+
Demonstrates a parametric network with an oracle for cutting-plane optimization.
|
|
6
|
+
"""
|
|
7
|
+
import matplotlib.pyplot as plt
|
|
8
|
+
import networkx as nx
|
|
9
|
+
|
|
10
|
+
gra = {
|
|
11
|
+
"v1": {"v2": {"w": 3}, "v3": {"w": 4}},
|
|
12
|
+
"v2": {"v1": {"w": -2}, "v3": {"w": 1}},
|
|
13
|
+
"v3": {"v1": {"w": -3}, "v2": {"w": -2}},
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
g = nx.DiGraph()
|
|
17
|
+
for u, neighbors in gra.items():
|
|
18
|
+
for v, attr in neighbors.items():
|
|
19
|
+
g.add_edge(u, v, w=attr["w"])
|
|
20
|
+
|
|
21
|
+
plt.figure(figsize=(7, 5))
|
|
22
|
+
pos = nx.spring_layout(g, seed=42)
|
|
23
|
+
nx.draw(
|
|
24
|
+
g,
|
|
25
|
+
pos,
|
|
26
|
+
with_labels=True,
|
|
27
|
+
node_color="lightblue",
|
|
28
|
+
node_size=800,
|
|
29
|
+
arrowsize=25,
|
|
30
|
+
font_weight="bold",
|
|
31
|
+
)
|
|
32
|
+
edge_labels = {(u, v): f"w={d['w']}" for u, v, d in g.edges(data=True)}
|
|
33
|
+
nx.draw_networkx_edge_labels(g, pos, edge_labels=edge_labels)
|
|
34
|
+
plt.title("Parametric Network Oracle Graph")
|
|
35
|
+
plt.grid(True, alpha=0.3)
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Figures Demo
|
|
2
|
+
|
|
3
|
+
Auto-generated figures demonstrating netoptim functionality.
|
|
4
|
+
|
|
5
|
+
## Network Flow Graph
|
|
6
|
+
|
|
7
|
+
```{plot} examples/plot_network_flow.py
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Network Oracle Example
|
|
11
|
+
|
|
12
|
+
```{plot} examples/plot_network_oracle.py
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
### Inline Plot Example
|
|
16
|
+
|
|
17
|
+
```{plot}
|
|
18
|
+
import matplotlib.pyplot as plt
|
|
19
|
+
import numpy as np
|
|
20
|
+
|
|
21
|
+
x = np.linspace(0, 2 * np.pi, 100)
|
|
22
|
+
plt.plot(x, np.sin(x))
|
|
23
|
+
plt.title("Simple Sine Wave")
|
|
24
|
+
plt.grid(True, alpha=0.3)
|
|
25
|
+
```
|
|
@@ -5,19 +5,14 @@ warn_unused_configs = True
|
|
|
5
5
|
[mypy-setuptools.*]
|
|
6
6
|
ignore_missing_imports = True
|
|
7
7
|
|
|
8
|
-
[mypy-networkx.*]
|
|
9
8
|
ignore_missing_imports = True
|
|
10
9
|
|
|
11
|
-
[mypy-numpy.*]
|
|
12
10
|
ignore_missing_imports = True
|
|
13
11
|
|
|
14
|
-
[mypy-scipy.*]
|
|
15
12
|
ignore_missing_imports = True
|
|
16
13
|
|
|
17
|
-
[mypy-Cython.*]
|
|
18
14
|
ignore_missing_imports = True
|
|
19
15
|
|
|
20
|
-
[mypy-json.*]
|
|
21
16
|
ignore_missing_imports = True
|
|
22
17
|
|
|
23
18
|
[mypy-matplotlib.*]
|
|
@@ -26,7 +26,9 @@ package_dir =
|
|
|
26
26
|
=src
|
|
27
27
|
python_requires = >=3.9
|
|
28
28
|
install_requires =
|
|
29
|
-
|
|
29
|
+
digraphx>=0.3
|
|
30
|
+
ellalgo>=0.4
|
|
31
|
+
mywheel>=0.3
|
|
30
32
|
networkx
|
|
31
33
|
|
|
32
34
|
[options.packages.find]
|
|
@@ -43,8 +45,6 @@ testing =
|
|
|
43
45
|
numpy
|
|
44
46
|
icecream
|
|
45
47
|
|
|
46
|
-
[options.entry_points]
|
|
47
|
-
|
|
48
48
|
[tool:pytest]
|
|
49
49
|
addopts =
|
|
50
50
|
--cov netoptim --cov-report term-missing
|
|
@@ -42,7 +42,7 @@ class NetworkOracle:
|
|
|
42
42
|
... "v2": {"v1": {"w": -2}, "v3": {"w": 1}},
|
|
43
43
|
... "v3": {"v1": {"w": -3}, "v2": {"w": -2}},
|
|
44
44
|
... }
|
|
45
|
-
>>> u = {"v1": 0, "v2": 0, "v3": 0}
|
|
45
|
+
>>> u = {"v1": 0.0, "v2": 0.0, "v3": 0.0}
|
|
46
46
|
>>> oracle = Mock()
|
|
47
47
|
>>> oracle.eval.side_effect = lambda e, x: e["w"] - x
|
|
48
48
|
>>> oracle.grad.side_effect = lambda e, x: -1
|
|
@@ -51,7 +51,7 @@ class NetworkOracle:
|
|
|
51
51
|
(2, 3)
|
|
52
52
|
"""
|
|
53
53
|
|
|
54
|
-
def __init__(self, gra: Graph, u: Dict[Any,
|
|
54
|
+
def __init__(self, gra: Graph, u: Dict[Any, float], oracle: Any) -> None:
|
|
55
55
|
"""
|
|
56
56
|
Initialize the network oracle with a graph, node potentials, and an edge oracle.
|
|
57
57
|
|
|
@@ -66,7 +66,7 @@ class NetworkOracle:
|
|
|
66
66
|
self._gra = gra
|
|
67
67
|
self._potential = u
|
|
68
68
|
self._oracle = oracle
|
|
69
|
-
self._ncf = NegCycleFinder(gra)
|
|
69
|
+
self._ncf: NegCycleFinder[Any, Any, float] = NegCycleFinder(gra)
|
|
70
70
|
|
|
71
71
|
def update(self, t: float) -> None:
|
|
72
72
|
"""Update the oracle with the best-so-far optimal value.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: netoptim
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3
|
|
4
4
|
Summary: Network Optimization Python Code
|
|
5
5
|
Home-page: https://github.com/luk036/netoptim
|
|
6
6
|
Author: Wai-Shing Luk
|
|
@@ -16,7 +16,9 @@ Classifier: Programming Language :: Python
|
|
|
16
16
|
Requires-Python: >=3.9
|
|
17
17
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
18
18
|
License-File: LICENSE.txt
|
|
19
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: digraphx>=0.3
|
|
20
|
+
Requires-Dist: ellalgo>=0.4
|
|
21
|
+
Requires-Dist: mywheel>=0.3
|
|
20
22
|
Requires-Dist: networkx
|
|
21
23
|
Provides-Extra: testing
|
|
22
24
|
Requires-Dist: setuptools; extra == "testing"
|
|
@@ -13,8 +13,6 @@ CHANGELOG.md
|
|
|
13
13
|
CHANGELOG.rst
|
|
14
14
|
CONTRIBUTING.md
|
|
15
15
|
GEMINI.md
|
|
16
|
-
IFLOW.md
|
|
17
|
-
LICENSE
|
|
18
16
|
LICENSE.txt
|
|
19
17
|
README.md
|
|
20
18
|
README.rst
|
|
@@ -34,11 +32,13 @@ tox.ini
|
|
|
34
32
|
.github/workflows/python-app.yml
|
|
35
33
|
.github/workflows/python-package.yml
|
|
36
34
|
.github/workflows/python-publish.yml
|
|
35
|
+
.vscode/settings.json
|
|
37
36
|
docs/Makefile
|
|
38
37
|
docs/authors.md
|
|
39
38
|
docs/changelog.md
|
|
40
39
|
docs/conf.py
|
|
41
40
|
docs/contributing.md
|
|
41
|
+
docs/figures_demo.md
|
|
42
42
|
docs/index.md
|
|
43
43
|
docs/license.md
|
|
44
44
|
docs/readme.md
|
|
@@ -46,6 +46,8 @@ docs/requirements.txt
|
|
|
46
46
|
docs/_static/.gitignore
|
|
47
47
|
docs/api/modules.rst
|
|
48
48
|
docs/api/netoptim.rst
|
|
49
|
+
docs/examples/plot_network_flow.py
|
|
50
|
+
docs/examples/plot_network_oracle.py
|
|
49
51
|
experiments/plot_node_colormap.ipynb
|
|
50
52
|
experiments/plot_node_colormap.py
|
|
51
53
|
requirements/README.md
|
|
@@ -61,6 +63,8 @@ src/netoptim.egg-info/SOURCES.txt
|
|
|
61
63
|
src/netoptim.egg-info/dependency_links.txt
|
|
62
64
|
src/netoptim.egg-info/not-zip-safe
|
|
63
65
|
src/netoptim.egg-info/requires.txt
|
|
66
|
+
src/netoptim.egg-info/scm_file_list.json
|
|
67
|
+
src/netoptim.egg-info/scm_version.json
|
|
64
68
|
src/netoptim.egg-info/top_level.txt
|
|
65
69
|
tests/__init__.py
|
|
66
70
|
tests/conftest.py
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"files": [
|
|
3
|
+
".coveragerc",
|
|
4
|
+
".pre-commit-config.yaml",
|
|
5
|
+
"mypy.ini",
|
|
6
|
+
".markdownlint.json",
|
|
7
|
+
"README.md",
|
|
8
|
+
"environment.yml",
|
|
9
|
+
"setup.cfg",
|
|
10
|
+
"tox.ini",
|
|
11
|
+
"LICENSE.txt",
|
|
12
|
+
"setup.py",
|
|
13
|
+
"pyproject.toml",
|
|
14
|
+
"CHANGELOG.rst",
|
|
15
|
+
"requirements.txt",
|
|
16
|
+
"CHANGELOG.md",
|
|
17
|
+
"CONTRIBUTING.md",
|
|
18
|
+
"README.rst",
|
|
19
|
+
".isort.cfg",
|
|
20
|
+
"AUTHORS.md",
|
|
21
|
+
"note.md",
|
|
22
|
+
".gitpod.yml",
|
|
23
|
+
".readthedocs.yml",
|
|
24
|
+
"_config.yml",
|
|
25
|
+
".gitignore",
|
|
26
|
+
".flake8",
|
|
27
|
+
"AUTHORS.rst",
|
|
28
|
+
".shellcheckrc",
|
|
29
|
+
"GEMINI.md",
|
|
30
|
+
".vscode/settings.json",
|
|
31
|
+
"docs/figures_demo.md",
|
|
32
|
+
"docs/readme.md",
|
|
33
|
+
"docs/Makefile",
|
|
34
|
+
"docs/authors.md",
|
|
35
|
+
"docs/requirements.txt",
|
|
36
|
+
"docs/contributing.md",
|
|
37
|
+
"docs/license.md",
|
|
38
|
+
"docs/changelog.md",
|
|
39
|
+
"docs/conf.py",
|
|
40
|
+
"docs/index.md",
|
|
41
|
+
"docs/api/modules.rst",
|
|
42
|
+
"docs/api/netoptim.rst",
|
|
43
|
+
"docs/_static/.gitignore",
|
|
44
|
+
"docs/examples/plot_network_flow.py",
|
|
45
|
+
"docs/examples/plot_network_oracle.py",
|
|
46
|
+
"src/netoptim/py.typed",
|
|
47
|
+
"src/netoptim/__init__.py",
|
|
48
|
+
"src/netoptim/optscaling_oracle.py",
|
|
49
|
+
"src/netoptim/network_oracle.py",
|
|
50
|
+
"tests/test_cycle_finder.py",
|
|
51
|
+
"tests/test_delay_padding.py",
|
|
52
|
+
"tests/test_network_oracle2.py",
|
|
53
|
+
"tests/test_stress_network_oracle.py",
|
|
54
|
+
"tests/test_optscaling.py",
|
|
55
|
+
"tests/test_network_oracle.py",
|
|
56
|
+
"tests/__init__.py",
|
|
57
|
+
"tests/test_ratio.py",
|
|
58
|
+
"tests/test_cycle_finder2.py",
|
|
59
|
+
"tests/test_stress_optscaling.py",
|
|
60
|
+
"tests/conftest.py",
|
|
61
|
+
"requirements/doc.txt",
|
|
62
|
+
"requirements/README.md",
|
|
63
|
+
"requirements/default.txt",
|
|
64
|
+
"requirements/test.txt",
|
|
65
|
+
"experiments/plot_node_colormap.py",
|
|
66
|
+
"experiments/plot_node_colormap.ipynb",
|
|
67
|
+
".github/workflows/python-publish.yml",
|
|
68
|
+
".github/workflows/ci.bak",
|
|
69
|
+
".github/workflows/multi-platforms.yml",
|
|
70
|
+
".github/workflows/jekyll-gh-pages.yml",
|
|
71
|
+
".github/workflows/python-app.yml",
|
|
72
|
+
".github/workflows/multi-platforms.bak",
|
|
73
|
+
".github/workflows/python-package.yml"
|
|
74
|
+
]
|
|
75
|
+
}
|
|
@@ -56,9 +56,9 @@ def run_lawler_prop(finder: Any, dist: Dict[str, float], beta: float) -> bool:
|
|
|
56
56
|
def test_minimize_TCP(finder_class: Any) -> None:
|
|
57
57
|
dist: Dict[str, float] = {"v1": 0.0, "v2": 0.0, "v3": 0.0}
|
|
58
58
|
Digraph: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
59
|
-
"v1": {"v2": {"type": "s", "delay": 2}, "v3": {"type": "h", "delay": 1.5}},
|
|
60
|
-
"v2": {"v3": {"type": "s", "delay": 3}, "v1": {"type": "h", "delay": 2.0}},
|
|
61
|
-
"v3": {"v1": {"type": "s", "delay": 4}, "v2": {"type": "h", "delay": 3.0}},
|
|
59
|
+
"v1": {"v2": {"type": "s", "delay": 2.0}, "v3": {"type": "h", "delay": 1.5}},
|
|
60
|
+
"v2": {"v3": {"type": "s", "delay": 3.0}, "v1": {"type": "h", "delay": 2.0}},
|
|
61
|
+
"v3": {"v1": {"type": "s", "delay": 4.0}, "v2": {"type": "h", "delay": 3.0}},
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
def has_negative_cycle(TCP: float, dist: Dict[str, float]) -> bool:
|
|
@@ -83,9 +83,9 @@ def test_maximize_slack(finder_class: Any) -> None:
|
|
|
83
83
|
dist: Dict[str, float] = {"v1": 0.0, "v2": 0.0, "v3": 0.0}
|
|
84
84
|
TCP = 4.5
|
|
85
85
|
Digraph: Dict[str, Dict[str, float]] = {
|
|
86
|
-
"v1": {"v2": TCP - 2, "v3": 1.5},
|
|
87
|
-
"v2": {"v3": TCP - 3, "v1": 2.0},
|
|
88
|
-
"v3": {"v1": TCP - 4, "v2": 3.0},
|
|
86
|
+
"v1": {"v2": TCP - 2.0, "v3": 1.5},
|
|
87
|
+
"v2": {"v3": TCP - 3.0, "v1": 2.0},
|
|
88
|
+
"v3": {"v1": TCP - 4.0, "v2": 3.0},
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
def has_negative_cycle_EVEN(beta: float, dist: Dict[str, float]) -> bool:
|
|
@@ -110,9 +110,18 @@ def test_maximize_effective_slack(finder_class: Any) -> None:
|
|
|
110
110
|
dist: Dict[str, float] = {"v1": 0.0, "v2": 0.0, "v3": 0.0}
|
|
111
111
|
TCP = 4.5
|
|
112
112
|
Digraph: Dict[str, Dict[str, Dict[str, float]]] = {
|
|
113
|
-
"v1": {
|
|
114
|
-
|
|
115
|
-
|
|
113
|
+
"v1": {
|
|
114
|
+
"v2": {"cost": TCP - 2.0, "time": 3.1},
|
|
115
|
+
"v3": {"cost": 1.5, "time": 0.7},
|
|
116
|
+
},
|
|
117
|
+
"v2": {
|
|
118
|
+
"v3": {"cost": TCP - 3.0, "time": 4.1},
|
|
119
|
+
"v1": {"cost": 2.0, "time": 2.2},
|
|
120
|
+
},
|
|
121
|
+
"v3": {
|
|
122
|
+
"v1": {"cost": TCP - 4.0, "time": 5.1},
|
|
123
|
+
"v2": {"cost": 3.0, "time": 1.5},
|
|
124
|
+
},
|
|
116
125
|
}
|
|
117
126
|
|
|
118
127
|
def has_negative_cycle_PROP(beta: float, dist: Dict[str, float]) -> bool:
|
|
@@ -82,19 +82,19 @@ class MyBSOracle(OracleBS):
|
|
|
82
82
|
@pytest.mark.parametrize("finder_class", Finders)
|
|
83
83
|
def test_minimize_TCP2(finder_class: Any, dist: Dict[str, float]) -> None:
|
|
84
84
|
Digraph: Dict[str, Dict[str, Dict[str, Any]]] = {
|
|
85
|
-
"v0": {"v3": {"type": "s", "delay": 6}, "v2": {"type": "s", "delay": 7}},
|
|
86
|
-
"v1": {"v2": {"type": "s", "delay": 9}, "v4": {"type": "h", "delay": 3}},
|
|
85
|
+
"v0": {"v3": {"type": "s", "delay": 6.0}, "v2": {"type": "s", "delay": 7.0}},
|
|
86
|
+
"v1": {"v2": {"type": "s", "delay": 9.0}, "v4": {"type": "h", "delay": 3.0}},
|
|
87
87
|
"v2": {
|
|
88
|
-
"v0": {"type": "h", "delay": 6},
|
|
89
|
-
"v1": {"type": "h", "delay": 6},
|
|
90
|
-
"v3": {"type": "s", "delay": 6},
|
|
88
|
+
"v0": {"type": "h", "delay": 6.0},
|
|
89
|
+
"v1": {"type": "h", "delay": 6.0},
|
|
90
|
+
"v3": {"type": "s", "delay": 6.0},
|
|
91
91
|
},
|
|
92
92
|
"v3": {
|
|
93
|
-
"v4": {"type": "s", "delay": 8},
|
|
94
|
-
"v0": {"type": "h", "delay": 6},
|
|
95
|
-
"v2": {"type": "h", "delay": 6},
|
|
93
|
+
"v4": {"type": "s", "delay": 8.0},
|
|
94
|
+
"v0": {"type": "h", "delay": 6.0},
|
|
95
|
+
"v2": {"type": "h", "delay": 6.0},
|
|
96
96
|
},
|
|
97
|
-
"v4": {"v1": {"type": "s", "delay": 3}, "v3": {"type": "h", "delay": 8}},
|
|
97
|
+
"v4": {"v1": {"type": "s", "delay": 3.0}, "v3": {"type": "h", "delay": 8.0}},
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
def has_negative_cycle(TCP: float, dist: Dict[str, float]) -> bool:
|
|
@@ -117,11 +117,11 @@ def test_minimize_TCP2(finder_class: Any, dist: Dict[str, float]) -> None:
|
|
|
117
117
|
def test_maximize_slack(finder_class: Any, dist: Dict[str, float]) -> None:
|
|
118
118
|
TCP = 7.5
|
|
119
119
|
Digraph: Dict[str, Dict[str, float]] = {
|
|
120
|
-
"v0": {"v3": TCP - 6, "v2": TCP - 7},
|
|
121
|
-
"v1": {"v2": TCP - 9, "v4": 3},
|
|
122
|
-
"v2": {"v0": 6, "v1": 6, "v3": TCP - 6},
|
|
123
|
-
"v3": {"v4": TCP - 8, "v0": 6, "v2": 6},
|
|
124
|
-
"v4": {"v1": TCP - 3, "v3": 8},
|
|
120
|
+
"v0": {"v3": TCP - 6.0, "v2": TCP - 7.0},
|
|
121
|
+
"v1": {"v2": TCP - 9.0, "v4": 3.0},
|
|
122
|
+
"v2": {"v0": 6.0, "v1": 6.0, "v3": TCP - 6.0},
|
|
123
|
+
"v3": {"v4": TCP - 8.0, "v0": 6.0, "v2": 6.0},
|
|
124
|
+
"v4": {"v1": TCP - 3.0, "v3": 8.0},
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
def has_negative_cycle_EVEN(beta: float, dist: Dict[str, float]) -> bool:
|
|
@@ -142,21 +142,27 @@ def test_maximize_effective_slack(finder_class: Any, dist: Dict[str, float]) ->
|
|
|
142
142
|
TCP = 7.5
|
|
143
143
|
Digraph: Dict[str, Dict[str, Dict[str, float]]] = {
|
|
144
144
|
"v0": {
|
|
145
|
-
"v3": {"cost": TCP - 6, "time": 3.1},
|
|
146
|
-
"v2": {"cost": TCP - 7, "time": 1.5},
|
|
145
|
+
"v3": {"cost": TCP - 6.0, "time": 3.1},
|
|
146
|
+
"v2": {"cost": TCP - 7.0, "time": 1.5},
|
|
147
|
+
},
|
|
148
|
+
"v1": {
|
|
149
|
+
"v2": {"cost": TCP - 9.0, "time": 4.1},
|
|
150
|
+
"v4": {"cost": 3.0, "time": 1.0},
|
|
147
151
|
},
|
|
148
|
-
"v1": {"v2": {"cost": TCP - 9, "time": 4.1}, "v4": {"cost": 3, "time": 1.0}},
|
|
149
152
|
"v2": {
|
|
150
|
-
"v0": {"cost": 6, "time": 3.1},
|
|
151
|
-
"v1": {"cost": 6, "time": 2.5},
|
|
152
|
-
"v3": {"cost": TCP - 6, "time": 3.1},
|
|
153
|
+
"v0": {"cost": 6.0, "time": 3.1},
|
|
154
|
+
"v1": {"cost": 6.0, "time": 2.5},
|
|
155
|
+
"v3": {"cost": TCP - 6.0, "time": 3.1},
|
|
153
156
|
},
|
|
154
157
|
"v3": {
|
|
155
|
-
"v4": {"cost": TCP - 8, "time": 4.1},
|
|
156
|
-
"v0": {"cost": 6, "time": 2.5},
|
|
157
|
-
"v2": {"cost": 6, "time": 2.5},
|
|
158
|
+
"v4": {"cost": TCP - 8.0, "time": 4.1},
|
|
159
|
+
"v0": {"cost": 6.0, "time": 2.5},
|
|
160
|
+
"v2": {"cost": 6.0, "time": 2.5},
|
|
161
|
+
},
|
|
162
|
+
"v4": {
|
|
163
|
+
"v1": {"cost": TCP - 3.0, "time": 1.1},
|
|
164
|
+
"v3": {"cost": 8.0, "time": 1.5},
|
|
158
165
|
},
|
|
159
|
-
"v4": {"v1": {"cost": TCP - 3, "time": 1.1}, "v3": {"cost": 8, "time": 1.5}},
|
|
160
166
|
}
|
|
161
167
|
|
|
162
168
|
def has_negative_cycle_PROP(beta: float, dist: Dict[str, float]) -> bool:
|