netoptim 0.1__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.1 → netoptim-0.3}/.github/workflows/ci.bak +1 -1
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/multi-platforms.yml +7 -6
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/python-app.yml +2 -2
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/python-package.yml +3 -3
- {netoptim-0.1 → netoptim-0.3}/.gitignore +4 -0
- {netoptim-0.1 → netoptim-0.3}/.pre-commit-config.yaml +2 -0
- {netoptim-0.1 → netoptim-0.3}/.readthedocs.yml +1 -1
- netoptim-0.3/.vscode/settings.json +4 -0
- netoptim-0.3/CHANGELOG.md +22 -0
- {netoptim-0.1 → netoptim-0.3}/CONTRIBUTING.md +20 -18
- netoptim-0.3/GEMINI.md +64 -0
- {netoptim-0.1 → netoptim-0.3}/LICENSE.txt +1 -1
- {netoptim-0.1/src/netoptim.egg-info → netoptim-0.3}/PKG-INFO +12 -5
- {netoptim-0.1 → netoptim-0.3}/README.md +2 -2
- {netoptim-0.1 → netoptim-0.3}/docs/api/netoptim.rst +2 -10
- {netoptim-0.1 → netoptim-0.3}/docs/conf.py +16 -27
- 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.1 → netoptim-0.3}/docs/index.md +1 -0
- {netoptim-0.1 → netoptim-0.3}/docs/requirements.txt +4 -0
- {netoptim-0.1 → netoptim-0.3}/environment.yml +1 -0
- {netoptim-0.1 → netoptim-0.3}/mypy.ini +0 -5
- {netoptim-0.1 → netoptim-0.3}/requirements/default.txt +1 -0
- {netoptim-0.1 → netoptim-0.3}/requirements/doc.txt +1 -0
- {netoptim-0.1 → netoptim-0.3}/setup.cfg +9 -4
- netoptim-0.3/src/netoptim/__init__.py +16 -0
- netoptim-0.3/src/netoptim/network_oracle.py +115 -0
- netoptim-0.3/src/netoptim/optscaling_oracle.py +160 -0
- {netoptim-0.1 → netoptim-0.3/src/netoptim.egg-info}/PKG-INFO +12 -5
- {netoptim-0.1 → netoptim-0.3}/src/netoptim.egg-info/SOURCES.txt +16 -8
- {netoptim-0.1 → netoptim-0.3}/src/netoptim.egg-info/requires.txt +4 -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.3/tests/__init__.py +0 -0
- netoptim-0.3/tests/test_cycle_finder.py +141 -0
- netoptim-0.3/tests/test_cycle_finder2.py +178 -0
- netoptim-0.3/tests/test_delay_padding.py +142 -0
- netoptim-0.3/tests/test_network_oracle.py +68 -0
- netoptim-0.3/tests/test_network_oracle2.py +96 -0
- netoptim-0.3/tests/test_optscaling.py +157 -0
- netoptim-0.3/tests/test_ratio.py +83 -0
- netoptim-0.3/tests/test_stress_network_oracle.py +70 -0
- netoptim-0.3/tests/test_stress_optscaling.py +112 -0
- netoptim-0.1/CHANGELOG.md +0 -7
- netoptim-0.1/LICENSE +0 -21
- netoptim-0.1/docs/authors.rst +0 -2
- netoptim-0.1/docs/changelog.rst +0 -2
- netoptim-0.1/docs/index.rst +0 -59
- netoptim-0.1/docs/license.rst +0 -7
- netoptim-0.1/src/netoptim/__init__.py +0 -16
- netoptim-0.1/src/netoptim/network_oracle.py +0 -72
- netoptim-0.1/src/netoptim/optscaling_oracle.py +0 -90
- netoptim-0.1/src/netoptim/skeleton.py +0 -149
- netoptim-0.1/tests/test_optscaling.py +0 -128
- netoptim-0.1/tests/test_optscaling_raw.py +0 -130
- netoptim-0.1/tests/test_skeleton.py +0 -25
- {netoptim-0.1 → netoptim-0.3}/.coveragerc +0 -0
- {netoptim-0.1 → netoptim-0.3}/.flake8 +0 -0
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/jekyll-gh-pages.yml +0 -0
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/multi-platforms.bak +0 -0
- {netoptim-0.1 → netoptim-0.3}/.github/workflows/python-publish.yml +0 -0
- {netoptim-0.1 → netoptim-0.3}/.gitpod.yml +0 -0
- {netoptim-0.1 → netoptim-0.3}/.isort.cfg +0 -0
- {netoptim-0.1 → netoptim-0.3}/.markdownlint.json +0 -0
- {netoptim-0.1 → netoptim-0.3}/.shellcheckrc +0 -0
- {netoptim-0.1 → netoptim-0.3}/AUTHORS.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/AUTHORS.rst +0 -0
- {netoptim-0.1 → netoptim-0.3}/CHANGELOG.rst +0 -0
- {netoptim-0.1 → netoptim-0.3}/README.rst +0 -0
- {netoptim-0.1 → netoptim-0.3}/_config.yml +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/Makefile +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/_static/.gitignore +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/api/modules.rst +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/authors.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/changelog.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/contributing.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/license.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/docs/readme.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/experiments/plot_node_colormap.ipynb +0 -0
- {netoptim-0.1 → netoptim-0.3}/experiments/plot_node_colormap.py +0 -0
- {netoptim-0.1 → netoptim-0.3}/note.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/pyproject.toml +0 -0
- {netoptim-0.1 → netoptim-0.3}/requirements/README.md +0 -0
- {netoptim-0.1 → netoptim-0.3}/requirements/test.txt +0 -0
- {netoptim-0.1 → netoptim-0.3}/requirements.txt +0 -0
- {netoptim-0.1 → netoptim-0.3}/setup.py +0 -0
- /netoptim-0.1/tests/__init__.py → /netoptim-0.3/src/netoptim/py.typed +0 -0
- {netoptim-0.1 → netoptim-0.3}/src/netoptim.egg-info/dependency_links.txt +0 -0
- {netoptim-0.1 → netoptim-0.3}/src/netoptim.egg-info/not-zip-safe +0 -0
- {netoptim-0.1 → netoptim-0.3}/src/netoptim.egg-info/top_level.txt +0 -0
- {netoptim-0.1 → netoptim-0.3}/tests/conftest.py +0 -0
- {netoptim-0.1 → netoptim-0.3}/tox.ini +0 -0
|
@@ -8,7 +8,7 @@ on:
|
|
|
8
8
|
push:
|
|
9
9
|
# Avoid using all the resources/limits available by checking only
|
|
10
10
|
# relevant branches and tags. Other branches can be checked via PRs.
|
|
11
|
-
branches: [master]
|
|
11
|
+
branches: [ master, dev ]
|
|
12
12
|
tags: ['v[0-9]*', '[0-9]+.[0-9]+*'] # Match tags that resemble a version
|
|
13
13
|
pull_request: # Run in every PR
|
|
14
14
|
workflow_dispatch: # Allow manually triggering the workflow
|
|
@@ -8,10 +8,10 @@ jobs:
|
|
|
8
8
|
strategy:
|
|
9
9
|
matrix:
|
|
10
10
|
os: ["ubuntu-latest", "windows-latest"]
|
|
11
|
-
version: ["3.9", "3.
|
|
11
|
+
version: ["3.9", "3.11"]
|
|
12
12
|
steps:
|
|
13
|
-
- uses: actions/checkout@
|
|
14
|
-
- uses: conda-incubator/setup-miniconda@
|
|
13
|
+
- uses: actions/checkout@v3
|
|
14
|
+
- uses: conda-incubator/setup-miniconda@v3
|
|
15
15
|
with:
|
|
16
16
|
activate-environment: test
|
|
17
17
|
environment-file: environment.yml
|
|
@@ -31,10 +31,11 @@ jobs:
|
|
|
31
31
|
shell: bash -l {0}
|
|
32
32
|
run: |
|
|
33
33
|
conda install pytest
|
|
34
|
-
|
|
34
|
+
conda install pip
|
|
35
|
+
conda install setuptools wheel setuptools_scm
|
|
35
36
|
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
|
|
36
|
-
pip install git+https://github.com/luk036/mywheel.git
|
|
37
37
|
pip install git+https://github.com/luk036/ellalgo.git
|
|
38
|
+
pip install git+https://github.com/luk036/mywheel.git
|
|
38
39
|
pip install git+https://github.com/luk036/digraphx.git
|
|
39
|
-
|
|
40
|
+
pip install -e .
|
|
40
41
|
pytest
|
|
@@ -5,9 +5,9 @@ name: Python package
|
|
|
5
5
|
|
|
6
6
|
on:
|
|
7
7
|
push:
|
|
8
|
-
branches: [master]
|
|
8
|
+
branches: [ master, dev ]
|
|
9
9
|
pull_request:
|
|
10
|
-
branches: [master]
|
|
10
|
+
branches: [ master, dev ]
|
|
11
11
|
|
|
12
12
|
jobs:
|
|
13
13
|
build:
|
|
@@ -15,7 +15,7 @@ jobs:
|
|
|
15
15
|
strategy:
|
|
16
16
|
fail-fast: false
|
|
17
17
|
matrix:
|
|
18
|
-
python-version: ["3.9", "3.
|
|
18
|
+
python-version: ["3.9", "3.11"]
|
|
19
19
|
|
|
20
20
|
steps:
|
|
21
21
|
- uses: actions/checkout@v2
|
|
@@ -14,8 +14,10 @@ repos:
|
|
|
14
14
|
- id: debug-statements
|
|
15
15
|
- id: end-of-file-fixer
|
|
16
16
|
- id: requirements-txt-fixer
|
|
17
|
+
exclude: "requirements[.]txt$"
|
|
17
18
|
- id: mixed-line-ending
|
|
18
19
|
args: ["--fix=auto"] # replace 'auto' with 'lf' to enforce Linux/Mac line endings or 'crlf' for Windows
|
|
20
|
+
exclude: "requirements[.]txt$"
|
|
19
21
|
|
|
20
22
|
## If you want to automatically "modernize" your Python code:
|
|
21
23
|
# - repo: https://github.com/asottile/pyupgrade
|
|
@@ -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)
|
|
@@ -69,27 +69,29 @@ by adding missing information and correcting mistakes.
|
|
|
69
69
|
This means that the docs are kept in the same repository as the project code, and
|
|
70
70
|
that any documentation update is done in the same way was a code contribution.
|
|
71
71
|
|
|
72
|
-
```{todo}
|
|
72
|
+
```{todo}
|
|
73
|
+
Don't forget to mention which markup language you are using.
|
|
73
74
|
|
|
74
|
-
|
|
75
|
+
e.g., [reStructuredText] or [CommonMark] with [MyST] extensions.
|
|
75
76
|
```
|
|
76
77
|
|
|
77
|
-
```{todo}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
78
|
+
```{todo}
|
|
79
|
+
If your project is hosted on GitHub, you can also mention the following tip:
|
|
80
|
+
|
|
81
|
+
:::{tip}
|
|
82
|
+
Please notice that the [GitHub web interface] provides a quick way of
|
|
83
|
+
propose changes in `netoptim`'s files. While this mechanism can
|
|
84
|
+
be tricky for normal code contributions, it works perfectly fine for
|
|
85
|
+
contributing to the docs, and can be quite handy.
|
|
86
|
+
|
|
87
|
+
If you are interested in trying this method out, please navigate to
|
|
88
|
+
the `docs` folder in the source [repository], find which file you
|
|
89
|
+
would like to propose changes and click in the little pencil icon at the
|
|
90
|
+
top, to open [GitHub's code editor]. Once you finish editing the file,
|
|
91
|
+
please write a message in the form at the bottom of the page describing
|
|
92
|
+
which changes have you made and what are the motivations behind them and
|
|
93
|
+
submit your proposal.
|
|
94
|
+
:::
|
|
93
95
|
```
|
|
94
96
|
|
|
95
97
|
When working on documentation changes in your local machine, you can
|
netoptim-0.3/GEMINI.md
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Gemini Code Assistant Context
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
|
|
5
|
+
This is a Python project for **Network Optimization**. It uses `networkx` for graph-related operations. The project is set up using `PyScaffold`, and the packaging is configured in `setup.cfg`.
|
|
6
|
+
|
|
7
|
+
The project's source code is located in the `src` directory, and the tests are in the `tests` directory.
|
|
8
|
+
|
|
9
|
+
## Building and Running
|
|
10
|
+
|
|
11
|
+
### Dependencies
|
|
12
|
+
|
|
13
|
+
The main dependencies are:
|
|
14
|
+
- `networkx`
|
|
15
|
+
- `ellalgo`
|
|
16
|
+
- `mywheel`
|
|
17
|
+
- `digraphx`
|
|
18
|
+
- `numpy`
|
|
19
|
+
|
|
20
|
+
To install all the necessary dependencies, you can use the `requirements.txt` file:
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install -r requirements.txt
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### Running Tests
|
|
27
|
+
|
|
28
|
+
The project uses `pytest` for testing. To run the tests, use the following command:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
pytest
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
You can also use `tox` to run the tests in an isolated environment:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
tox
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Building the Project
|
|
41
|
+
|
|
42
|
+
To build the project, you can use the `build` environment in `tox`:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
tox -e build
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
This will create a `dist` directory with the built package.
|
|
49
|
+
|
|
50
|
+
## Development Conventions
|
|
51
|
+
|
|
52
|
+
### Code Style
|
|
53
|
+
|
|
54
|
+
The project uses the following tools to maintain code quality:
|
|
55
|
+
|
|
56
|
+
- **Formatting:** `black` is used for code formatting.
|
|
57
|
+
- **Import Sorting:** `isort` is used to sort imports automatically.
|
|
58
|
+
- **Linting:** `flake8` is used for linting the code.
|
|
59
|
+
|
|
60
|
+
These tools are configured in the `.pre-commit-config.yaml` file and are run automatically before each commit.
|
|
61
|
+
|
|
62
|
+
### Contribution Guidelines
|
|
63
|
+
|
|
64
|
+
The `CONTRIBUTING.md` file provides guidelines for contributing to the project. It is recommended to read this file before making any contributions.
|
|
@@ -1,18 +1,24 @@
|
|
|
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
|
|
7
7
|
Author-email: luk036@gmail.com
|
|
8
8
|
License: MIT
|
|
9
|
-
Project-URL: Documentation, https://
|
|
9
|
+
Project-URL: Documentation, https://netoptim.readthedocs.io/
|
|
10
|
+
Project-URL: Source, https://github.com/luk036/netoptim
|
|
11
|
+
Project-URL: Changelog, https://github.com/luk036/netoptim/blob/main/CHANGELOG.md
|
|
12
|
+
Project-URL: Tracker, https://github.com/luk036/netoptim/issues
|
|
10
13
|
Platform: any
|
|
11
14
|
Classifier: Development Status :: 4 - Beta
|
|
12
15
|
Classifier: Programming Language :: Python
|
|
16
|
+
Requires-Python: >=3.9
|
|
13
17
|
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
|
|
14
18
|
License-File: LICENSE.txt
|
|
15
|
-
Requires-Dist:
|
|
19
|
+
Requires-Dist: digraphx>=0.3
|
|
20
|
+
Requires-Dist: ellalgo>=0.4
|
|
21
|
+
Requires-Dist: mywheel>=0.3
|
|
16
22
|
Requires-Dist: networkx
|
|
17
23
|
Provides-Extra: testing
|
|
18
24
|
Requires-Dist: setuptools; extra == "testing"
|
|
@@ -20,6 +26,7 @@ Requires-Dist: pytest; extra == "testing"
|
|
|
20
26
|
Requires-Dist: pytest-cov; extra == "testing"
|
|
21
27
|
Requires-Dist: networkx; extra == "testing"
|
|
22
28
|
Requires-Dist: numpy; extra == "testing"
|
|
29
|
+
Requires-Dist: icecream; extra == "testing"
|
|
23
30
|
Dynamic: license-file
|
|
24
31
|
|
|
25
32
|
<!-- These are examples of badges you might want to add to your README:
|
|
@@ -38,9 +45,9 @@ Dynamic: license-file
|
|
|
38
45
|
[](https://netoptim.readthedocs.io/en/latest/?badge=latest)
|
|
39
46
|
[](https://codecov.io/gh/luk036/netoptim)
|
|
40
47
|
|
|
41
|
-
#
|
|
48
|
+
# 🌊 netoptim
|
|
42
49
|
|
|
43
|
-
> Network Optimization Python Code
|
|
50
|
+
> Network Flow Optimization Python Code
|
|
44
51
|
|
|
45
52
|
A longer description of your project goes here...
|
|
46
53
|
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
[](https://netoptim.readthedocs.io/en/latest/?badge=latest)
|
|
15
15
|
[](https://codecov.io/gh/luk036/netoptim)
|
|
16
16
|
|
|
17
|
-
#
|
|
17
|
+
# 🌊 netoptim
|
|
18
18
|
|
|
19
|
-
> Network Optimization Python Code
|
|
19
|
+
> Network Flow Optimization Python Code
|
|
20
20
|
|
|
21
21
|
A longer description of your project goes here...
|
|
22
22
|
|
|
@@ -9,29 +9,21 @@ netoptim.network\_oracle module
|
|
|
9
9
|
|
|
10
10
|
.. automodule:: netoptim.network_oracle
|
|
11
11
|
:members:
|
|
12
|
-
:undoc-members:
|
|
13
12
|
:show-inheritance:
|
|
13
|
+
:undoc-members:
|
|
14
14
|
|
|
15
15
|
netoptim.optscaling\_oracle module
|
|
16
16
|
----------------------------------
|
|
17
17
|
|
|
18
18
|
.. automodule:: netoptim.optscaling_oracle
|
|
19
19
|
:members:
|
|
20
|
-
:undoc-members:
|
|
21
20
|
:show-inheritance:
|
|
22
|
-
|
|
23
|
-
netoptim.skeleton module
|
|
24
|
-
------------------------
|
|
25
|
-
|
|
26
|
-
.. automodule:: netoptim.skeleton
|
|
27
|
-
:members:
|
|
28
21
|
:undoc-members:
|
|
29
|
-
:show-inheritance:
|
|
30
22
|
|
|
31
23
|
Module contents
|
|
32
24
|
---------------
|
|
33
25
|
|
|
34
26
|
.. automodule:: netoptim
|
|
35
27
|
:members:
|
|
36
|
-
:undoc-members:
|
|
37
28
|
:show-inheritance:
|
|
29
|
+
:undoc-members:
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
|
|
10
10
|
import os
|
|
11
11
|
import sys
|
|
12
|
-
import shutil
|
|
13
12
|
|
|
14
13
|
# -- Path setup --------------------------------------------------------------
|
|
15
14
|
|
|
@@ -28,31 +27,6 @@ sys.path.insert(0, os.path.join(__location__, "../src"))
|
|
|
28
27
|
# setup.py install" in the RTD Advanced Settings.
|
|
29
28
|
# Additionally it helps us to avoid running apidoc manually
|
|
30
29
|
|
|
31
|
-
try: # for Sphinx >= 1.7
|
|
32
|
-
from sphinx.ext import apidoc
|
|
33
|
-
except ImportError:
|
|
34
|
-
from sphinx import apidoc
|
|
35
|
-
|
|
36
|
-
output_dir = os.path.join(__location__, "api")
|
|
37
|
-
module_dir = os.path.join(__location__, "../src/netoptim")
|
|
38
|
-
try:
|
|
39
|
-
shutil.rmtree(output_dir)
|
|
40
|
-
except FileNotFoundError:
|
|
41
|
-
pass
|
|
42
|
-
|
|
43
|
-
try:
|
|
44
|
-
import sphinx
|
|
45
|
-
|
|
46
|
-
cmd_line = f"sphinx-apidoc --implicit-namespaces -f -o {output_dir} {module_dir}"
|
|
47
|
-
|
|
48
|
-
args = cmd_line.split(" ")
|
|
49
|
-
if tuple(sphinx.__version__.split(".")) >= ("1", "7"):
|
|
50
|
-
# This is a rudimentary parse_version to avoid external dependencies
|
|
51
|
-
args = args[1:]
|
|
52
|
-
|
|
53
|
-
apidoc.main(args)
|
|
54
|
-
except Exception as e:
|
|
55
|
-
print("Running `sphinx-apidoc` failed!\n{}".format(e))
|
|
56
30
|
|
|
57
31
|
# -- General configuration ---------------------------------------------------
|
|
58
32
|
|
|
@@ -62,6 +36,7 @@ except Exception as e:
|
|
|
62
36
|
# Add any Sphinx extension module names here, as strings. They can be extensions
|
|
63
37
|
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
|
64
38
|
extensions = [
|
|
39
|
+
"sphinx.ext.apidoc",
|
|
65
40
|
"sphinx.ext.autodoc",
|
|
66
41
|
"sphinx.ext.intersphinx",
|
|
67
42
|
"sphinx.ext.todo",
|
|
@@ -72,6 +47,20 @@ extensions = [
|
|
|
72
47
|
"sphinx.ext.ifconfig",
|
|
73
48
|
"sphinx.ext.mathjax",
|
|
74
49
|
"sphinx.ext.napoleon",
|
|
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",
|
|
75
64
|
]
|
|
76
65
|
|
|
77
66
|
# Add any paths that contain templates here, relative to this directory.
|
|
@@ -249,7 +238,7 @@ htmlhelp_basename = "netoptim-doc"
|
|
|
249
238
|
|
|
250
239
|
# -- Options for LaTeX output ------------------------------------------------
|
|
251
240
|
|
|
252
|
-
latex_elements = {
|
|
241
|
+
latex_elements: dict[str, str] = {
|
|
253
242
|
# The paper size ("letterpaper" or "a4paper").
|
|
254
243
|
# "papersize": "letterpaper",
|
|
255
244
|
# The font size ("10pt", "11pt" or "12pt").
|
|
@@ -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
|
+
```
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
digraphx
|
|
2
|
+
ellalgo
|
|
1
3
|
# Requirements file for ReadTheDocs, check .readthedocs.yml.
|
|
2
4
|
# To build the module reference correctly, make sure every external package
|
|
3
5
|
# under `install_requires` in `setup.cfg` is also listed here!
|
|
4
6
|
# sphinx_rtd_theme
|
|
5
7
|
myst-parser[linkify]
|
|
8
|
+
numpy
|
|
6
9
|
sphinx>=3.2.1
|
|
10
|
+
sphinxcontrib-svgbob
|
|
@@ -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.*]
|
|
@@ -9,7 +9,10 @@ long_description = file: README.md
|
|
|
9
9
|
long_description_content_type = text/markdown; charset=UTF-8; variant=GFM
|
|
10
10
|
url = https://github.com/luk036/netoptim
|
|
11
11
|
project_urls =
|
|
12
|
-
Documentation = https://
|
|
12
|
+
Documentation = https://netoptim.readthedocs.io/
|
|
13
|
+
Source = https://github.com/luk036/netoptim
|
|
14
|
+
Changelog = https://github.com/luk036/netoptim/blob/main/CHANGELOG.md
|
|
15
|
+
Tracker = https://github.com/luk036/netoptim/issues
|
|
13
16
|
platforms = any
|
|
14
17
|
classifiers =
|
|
15
18
|
Development Status :: 4 - Beta
|
|
@@ -21,8 +24,11 @@ packages = find_namespace:
|
|
|
21
24
|
include_package_data = True
|
|
22
25
|
package_dir =
|
|
23
26
|
=src
|
|
27
|
+
python_requires = >=3.9
|
|
24
28
|
install_requires =
|
|
25
|
-
|
|
29
|
+
digraphx>=0.3
|
|
30
|
+
ellalgo>=0.4
|
|
31
|
+
mywheel>=0.3
|
|
26
32
|
networkx
|
|
27
33
|
|
|
28
34
|
[options.packages.find]
|
|
@@ -37,8 +43,7 @@ testing =
|
|
|
37
43
|
pytest-cov
|
|
38
44
|
networkx
|
|
39
45
|
numpy
|
|
40
|
-
|
|
41
|
-
[options.entry_points]
|
|
46
|
+
icecream
|
|
42
47
|
|
|
43
48
|
[tool:pytest]
|
|
44
49
|
addopts =
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Network Flow Optimization Package.
|
|
2
|
+
|
|
3
|
+
Provides tools for solving parametric network flow problems
|
|
4
|
+
using cutting-plane methods and ellipsoid algorithms.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from importlib.metadata import PackageNotFoundError, version # pragma: no cover
|
|
8
|
+
|
|
9
|
+
try:
|
|
10
|
+
# Change here if project is renamed and does not equal the package name
|
|
11
|
+
dist_name = __name__
|
|
12
|
+
__version__ = version(dist_name)
|
|
13
|
+
except PackageNotFoundError: # pragma: no cover
|
|
14
|
+
__version__ = "unknown"
|
|
15
|
+
finally:
|
|
16
|
+
del version, PackageNotFoundError
|