mosox 0.7.0__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.
Files changed (84) hide show
  1. mosox-0.7.0/.github/workflows/draft-pdf.yml +34 -0
  2. mosox-0.7.0/.github/workflows/release.yml +147 -0
  3. mosox-0.7.0/.github/workflows/test.yml +17 -0
  4. mosox-0.7.0/.gitignore +83 -0
  5. mosox-0.7.0/AGENTS.md +33 -0
  6. mosox-0.7.0/CITATION.cff +18 -0
  7. mosox-0.7.0/CONTRIBUTING.md +14 -0
  8. mosox-0.7.0/Cargo.lock +1599 -0
  9. mosox-0.7.0/Cargo.toml +53 -0
  10. mosox-0.7.0/LICENSE +21 -0
  11. mosox-0.7.0/Makefile.toml +83 -0
  12. mosox-0.7.0/PKG-INFO +217 -0
  13. mosox-0.7.0/README.md +198 -0
  14. mosox-0.7.0/docs/future-plan.md +565 -0
  15. mosox-0.7.0/docs/gmpl.pdf +0 -0
  16. mosox-0.7.0/examples/2d_params/matrix.mps +35 -0
  17. mosox-0.7.0/examples/2d_params/model.mod +20 -0
  18. mosox-0.7.0/examples/README.md +7 -0
  19. mosox-0.7.0/examples/ampl/matrix.mps +35 -0
  20. mosox-0.7.0/examples/ampl/model.mod +54 -0
  21. mosox-0.7.0/examples/basic/matrix.mps +17 -0
  22. mosox-0.7.0/examples/basic/model.mod +39 -0
  23. mosox-0.7.0/examples/gmpl/matrix.mps +35 -0
  24. mosox-0.7.0/examples/gmpl/model.mod +88 -0
  25. mosox-0.7.0/examples/milp/matrix.mps +22 -0
  26. mosox-0.7.0/examples/milp/model.mod +10 -0
  27. mosox-0.7.0/examples/osemosys_atlantis/atlantis.dat +596 -0
  28. mosox-0.7.0/examples/osemosys_atlantis/osemosys.mod +1428 -0
  29. mosox-0.7.0/examples/osemosys_small/matrix.mps +20951 -0
  30. mosox-0.7.0/examples/osemosys_small/ose_small.dat +540 -0
  31. mosox-0.7.0/examples/osemosys_small/osemosys.mod +1428 -0
  32. mosox-0.7.0/examples/prune/matrix.mps +24 -0
  33. mosox-0.7.0/examples/prune/model.mod +26 -0
  34. mosox-0.7.0/examples/set_from_domain/matrix.mps +31 -0
  35. mosox-0.7.0/examples/set_from_domain/model.mod +23 -0
  36. mosox-0.7.0/examples/sets/data.dat +4 -0
  37. mosox-0.7.0/examples/sets/matrix.mps +15 -0
  38. mosox-0.7.0/examples/sets/model.mod +6 -0
  39. mosox-0.7.0/grammars/gmpl.pest +295 -0
  40. mosox-0.7.0/paper.bib +161 -0
  41. mosox-0.7.0/paper.md +215 -0
  42. mosox-0.7.0/pyproject.toml +68 -0
  43. mosox-0.7.0/python/mosox/__init__.py +86 -0
  44. mosox-0.7.0/python/mosox/_mosox.pyi +19 -0
  45. mosox-0.7.0/python/mosox/py.typed +0 -0
  46. mosox-0.7.0/python/tests/test_basic.py +68 -0
  47. mosox-0.7.0/site/index.html +126 -0
  48. mosox-0.7.0/src/data/dat.rs +260 -0
  49. mosox-0.7.0/src/data/equivalence_test.rs +223 -0
  50. mosox-0.7.0/src/data/mod.rs +94 -0
  51. mosox-0.7.0/src/data/table.rs +229 -0
  52. mosox-0.7.0/src/gmpl/grammar.rs +5 -0
  53. mosox-0.7.0/src/gmpl/loader.rs +91 -0
  54. mosox-0.7.0/src/gmpl/mod.rs +2 -0
  55. mosox-0.7.0/src/highs/config.rs +210 -0
  56. mosox-0.7.0/src/highs/format.rs +16 -0
  57. mosox-0.7.0/src/highs/mod.rs +142 -0
  58. mosox-0.7.0/src/highs/output.rs +88 -0
  59. mosox-0.7.0/src/ir/interner.rs +19 -0
  60. mosox-0.7.0/src/ir/mod.rs +1908 -0
  61. mosox-0.7.0/src/ir/model.rs +136 -0
  62. mosox-0.7.0/src/ir/op.rs +91 -0
  63. mosox-0.7.0/src/lib.rs +118 -0
  64. mosox-0.7.0/src/main.rs +179 -0
  65. mosox-0.7.0/src/matrix/constraint.rs +603 -0
  66. mosox-0.7.0/src/matrix/lookup.rs +81 -0
  67. mosox-0.7.0/src/matrix/mod.rs +172 -0
  68. mosox-0.7.0/src/matrix/param.rs +40 -0
  69. mosox-0.7.0/src/matrix/set.rs +507 -0
  70. mosox-0.7.0/src/matrix/validate.rs +400 -0
  71. mosox-0.7.0/src/mps/mod.rs +2 -0
  72. mosox-0.7.0/src/mps/output.rs +151 -0
  73. mosox-0.7.0/src/mps/utils.rs +31 -0
  74. mosox-0.7.0/src/normalize.rs +195 -0
  75. mosox-0.7.0/src/python.rs +191 -0
  76. mosox-0.7.0/tests/bench_perf.rs +220 -0
  77. mosox-0.7.0/tests/cli_test.rs +46 -0
  78. mosox-0.7.0/tests/fixtures/validate/data.dat +15 -0
  79. mosox-0.7.0/tests/fixtures/validate/model.mod +19 -0
  80. mosox-0.7.0/tests/integration_test.rs +6 -0
  81. mosox-0.7.0/tests/regression_test.rs +114 -0
  82. mosox-0.7.0/tests/table_test.rs +142 -0
  83. mosox-0.7.0/tests/validate_test.rs +123 -0
  84. mosox-0.7.0/uv.lock +514 -0
@@ -0,0 +1,34 @@
1
+ name: JOSS paper PDF
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ paths:
7
+ - paper.md
8
+ - paper.bib
9
+ - .github/workflows/draft-pdf.yml
10
+ pull_request:
11
+ paths:
12
+ - paper.md
13
+ - paper.bib
14
+ - .github/workflows/draft-pdf.yml
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ paper:
21
+ runs-on: ubuntu-latest
22
+ steps:
23
+ - uses: actions/checkout@v6
24
+ - name: Build JOSS PDF
25
+ uses: openjournals/openjournals-draft-action@master
26
+ with:
27
+ journal: joss
28
+ paper-path: paper.md
29
+ - uses: actions/upload-artifact@v7
30
+ with:
31
+ name: joss-paper
32
+ path: paper.pdf
33
+ if-no-files-found: error
34
+ archive: false
@@ -0,0 +1,147 @@
1
+ name: release
2
+
3
+ on:
4
+ push:
5
+ tags: ["v*"]
6
+
7
+ concurrency:
8
+ group: "pages"
9
+ cancel-in-progress: false
10
+
11
+ env:
12
+ CARGO_TERM_COLOR: always
13
+
14
+ jobs:
15
+ create-release:
16
+ runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: write
19
+ outputs:
20
+ version: ${{ steps.version.outputs.version }}
21
+ steps:
22
+ - uses: actions/checkout@v6
23
+
24
+ - name: Extract version from tag
25
+ id: version
26
+ run: echo "version=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
27
+
28
+ - name: Create or update release
29
+ uses: softprops/action-gh-release@v2
30
+ with:
31
+ generate_release_notes: true
32
+ draft: false
33
+
34
+ build:
35
+ needs: create-release
36
+ permissions:
37
+ contents: write
38
+ strategy:
39
+ fail-fast: false
40
+ matrix:
41
+ include:
42
+ - target: aarch64-apple-darwin
43
+ os: macos-latest
44
+ archive: tar.gz
45
+
46
+ - target: x86_64-pc-windows-msvc
47
+ os: windows-latest
48
+ archive: zip
49
+
50
+ - target: x86_64-unknown-linux-gnu
51
+ os: ubuntu-latest
52
+ archive: tar.gz
53
+
54
+ runs-on: ${{ matrix.os }}
55
+ env:
56
+ VERSION: ${{ needs.create-release.outputs.version }}
57
+ TARGET: ${{ matrix.target }}
58
+ steps:
59
+ - uses: actions/checkout@v6
60
+
61
+ - name: Set version in Cargo files
62
+ shell: bash
63
+ run: |
64
+ if [[ "$RUNNER_OS" == "macOS" ]]; then
65
+ sed -i '' "s/0\.0\.999/$VERSION/" Cargo.toml Cargo.lock
66
+ else
67
+ sed -i "s/0\.0\.999/$VERSION/" Cargo.toml Cargo.lock
68
+ fi
69
+
70
+ - name: Setup Rust
71
+ uses: dtolnay/rust-toolchain@stable
72
+ with:
73
+ targets: ${{ matrix.target }}
74
+
75
+ - name: Cache cargo
76
+ uses: Swatinem/rust-cache@v2
77
+ with:
78
+ key: ${{ matrix.target }}
79
+
80
+ - name: Build release binary
81
+ run: cargo build --release --target ${{ matrix.target }}
82
+
83
+ - name: Create tar.gz archive
84
+ if: matrix.archive == 'tar.gz'
85
+ shell: bash
86
+ run: |
87
+ cd target/$TARGET/release
88
+ tar -czvf ../../../mosox-$VERSION-$TARGET.tar.gz mosox
89
+
90
+ - name: Create zip archive
91
+ if: matrix.archive == 'zip'
92
+ shell: pwsh
93
+ run: |
94
+ Compress-Archive -Path "target/$env:TARGET/release/mosox.exe" -DestinationPath "mosox-$env:VERSION-$env:TARGET.zip"
95
+
96
+ - name: Upload release assets
97
+ uses: softprops/action-gh-release@v2
98
+ with:
99
+ files: mosox-${{ env.VERSION }}-${{ matrix.target }}.${{ matrix.archive }}
100
+
101
+ publish:
102
+ needs: [create-release, build]
103
+ runs-on: ubuntu-latest
104
+ environment: release
105
+ permissions:
106
+ contents: write
107
+ id-token: write
108
+ steps:
109
+ - uses: actions/checkout@v6
110
+
111
+ - name: Set version in Cargo files
112
+ run: |
113
+ sed -i "s/0\.0\.999/${{ needs.create-release.outputs.version }}/" Cargo.toml Cargo.lock
114
+
115
+ - uses: rust-lang/crates-io-auth-action@v1
116
+ id: auth
117
+
118
+ - run: cargo publish --allow-dirty
119
+ env:
120
+ CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}
121
+
122
+ pages:
123
+ needs: [create-release, build]
124
+ runs-on: ubuntu-latest
125
+ permissions:
126
+ pages: write
127
+ id-token: write
128
+ environment:
129
+ name: github-pages
130
+ url: ${{ steps.deployment.outputs.page_url }}
131
+ steps:
132
+ - uses: actions/checkout@v6
133
+ - name: Interpolate version into HTML
134
+ env:
135
+ VERSION: ${{ needs.create-release.outputs.version }}
136
+ run: |
137
+ sed -i "s|__VERSION__|$VERSION|g" site/index.html
138
+ sed -i "s|__MACOS_URL__|https://github.com/carderne/mosox/releases/download/v$VERSION/mosox-$VERSION-aarch64-apple-darwin.tar.gz|g" site/index.html
139
+ sed -i "s|__WINDOWS_URL__|https://github.com/carderne/mosox/releases/download/v$VERSION/mosox-$VERSION-x86_64-pc-windows-msvc.zip|g" site/index.html
140
+ sed -i "s|__LINUX_URL__|https://github.com/carderne/mosox/releases/download/v$VERSION/mosox-$VERSION-x86_64-unknown-linux-gnu.tar.gz|g" site/index.html
141
+ - uses: actions/configure-pages@v5
142
+ - uses: actions/upload-pages-artifact@v3
143
+ with:
144
+ path: site
145
+ - name: Deploy to GitHub Pages
146
+ id: deployment
147
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,17 @@
1
+ name: test
2
+
3
+ on:
4
+ push:
5
+ branches: [ "main" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+ - uses: dtolnay/rust-toolchain@stable
15
+ - run: cargo fmt --check
16
+ - run: cargo clippy --locked --all-targets --all-features -- -D warnings
17
+ - run: cargo test --locked --all-features
mosox-0.7.0/.gitignore ADDED
@@ -0,0 +1,83 @@
1
+ .claude
2
+ /target
3
+
4
+ /notes
5
+
6
+ /examples/osemosys_large/**
7
+ /examples/clews/**
8
+ /examples/muio
9
+ /examples/ceron
10
+ /examples/ved
11
+ /examples/muio_features
12
+
13
+ # Byte-compiled / optimized / DLL files
14
+ __pycache__/
15
+ .pytest_cache/
16
+ *.py[cod]
17
+
18
+ # C extensions
19
+ *.so
20
+
21
+ # Distribution / packaging
22
+ .Python
23
+ .venv/
24
+ env/
25
+ bin/
26
+ build/
27
+ develop-eggs/
28
+ dist/
29
+ eggs/
30
+ lib/
31
+ lib64/
32
+ parts/
33
+ sdist/
34
+ var/
35
+ include/
36
+ man/
37
+ venv/
38
+ *.egg-info/
39
+ .installed.cfg
40
+ *.egg
41
+
42
+ # Installer logs
43
+ pip-log.txt
44
+ pip-delete-this-directory.txt
45
+ pip-selfcheck.json
46
+
47
+ # Unit test / coverage reports
48
+ htmlcov/
49
+ .tox/
50
+ .coverage
51
+ .cache
52
+ nosetests.xml
53
+ coverage.xml
54
+
55
+ # Translations
56
+ *.mo
57
+
58
+ # Mr Developer
59
+ .mr.developer.cfg
60
+ .project
61
+ .pydevproject
62
+
63
+ # Rope
64
+ .ropeproject
65
+
66
+ # Django stuff:
67
+ *.log
68
+ *.pot
69
+
70
+ .DS_Store
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyCharm
76
+ .idea/
77
+
78
+ # VSCode
79
+ .vscode/
80
+
81
+
82
+ # Python extension build output
83
+ python/mosox/*.so
mosox-0.7.0/AGENTS.md ADDED
@@ -0,0 +1,33 @@
1
+ # mosox
2
+
3
+ An LP matrix generator for GMPL (subset of AMPL).
4
+
5
+ Written in Rust.
6
+
7
+ Supports two features:
8
+ - compile a matrix (can be output to MPS)
9
+ - solve directly using HiGHS
10
+
11
+ ## Commands
12
+ ```bash
13
+ cargo make fmt
14
+ cargo make lint
15
+ cargo make test
16
+ cargo make testlarge # slow
17
+ ```
18
+
19
+ mosox usage:
20
+ ```bash
21
+ > cargo run
22
+
23
+ LP matrix generator for GMPL
24
+
25
+ Usage: mosox <COMMAND>
26
+
27
+ Commands:
28
+ compile Load and output to MPS
29
+ solve Solve with HiGHS
30
+ normalize Normalize an MPS file for diffing
31
+ compare Compare two normalized MPS files with epsilon tolerance
32
+ help Print this message or the help of the given subcommand(s)
33
+ ```
@@ -0,0 +1,18 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use MOSOX, please cite this software release."
3
+ type: software
4
+ title: "MOSOX: LP matrix generator for GMPL"
5
+ authors:
6
+ - given-names: Chris
7
+ family-names: Arderne
8
+ orcid: "https://orcid.org/0000-0002-7904-2216"
9
+ version: 0.6.3
10
+ date-released: 2026-09-26
11
+ license: MIT
12
+ repository-code: "https://github.com/carderne/mosox"
13
+ url: "https://rdrn.me/mosox/"
14
+ keywords:
15
+ - optimisation
16
+ - GMPL
17
+ - linear programming
18
+ - mixed-integer programming
@@ -0,0 +1,14 @@
1
+ # Contributing to MOSOX
2
+
3
+ MOSOX welcomes bug reports, examples, documentation improvements and code contributions. Please use [GitHub Issues](https://github.com/carderne/mosox/issues) for questions, reproducible bug reports and feature proposals.
4
+
5
+ For a bug report, include the MOSOX version, operating system, command, expected result and actual output. Adding small `.mod` and/or `.dat` files will make problems much easier to reproduce.
6
+
7
+ To contribute code, fork the repository and create a branch from `main`. Build with a current stable Rust toolchain. The HiGHS dependency also needs a working native C/C++ build environment and CMake. Then run:
8
+
9
+ ```sh
10
+ cargo build --locked
11
+ cargo fmt --check
12
+ cargo clippy --locked --all-targets --all-features
13
+ cargo test --locked --all-features
14
+ ```