Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
5902bc5
the loose AMPL writer, now writes mps
DLWoodruff Oct 14, 2025
a3158a2
farmer_writer now writes the json
DLWoodruff Oct 15, 2025
9c8ab00
farmer_writer.py is ready for testing
DLWoodruff Oct 15, 2025
7179e19
the writer now goes to a given directory; ready to test reading
DLWoodruff Oct 15, 2025
11a1831
bash to drive example
DLWoodruff Oct 16, 2025
94f9ea3
Merge branch 'main' into looseAMPL
DLWoodruff Oct 16, 2025
dc4bbaa
[WIP] farmer_writer seems to write an OK mps file, but the json file …
DLWoodruff Oct 17, 2025
470bb42
the writer might be working correctly with fixed columns
DLWoodruff Oct 18, 2025
84bffce
add a loose coupling test for the AMPL example
DLWoodruff Oct 18, 2025
c6379e0
add some documentation for the loose AMPL example
DLWoodruff Oct 18, 2025
6fbd4a3
add a script to convert C names in the MPS files to ampl names
DLWoodruff Oct 20, 2025
749d8af
remove a stray space from test_pr_and_main.yml
DLWoodruff Oct 20, 2025
5e446cb
run ruff locally
DLWoodruff Oct 20, 2025
f9ba0bf
add headers to new .py files and pip install mip in test yml
DLWoodruff Oct 20, 2025
1e50ad4
add another mps file for testing
DLWoodruff Oct 20, 2025
e16ead3
need a different solver for the new test
DLWoodruff Oct 20, 2025
2ec5bdd
need a solver that works in the test environment
DLWoodruff Oct 20, 2025
8c907dc
correct location of col file
DLWoodruff Oct 20, 2025
b9a4981
trying python 3.11 for the schurr test (3.9 doesn't work with the pyomo)
DLWoodruff Oct 20, 2025
4678738
dropping the use of nose for Schurr
DLWoodruff Oct 21, 2025
bed49ea
changing all tests from 3.9 to 3.11
DLWoodruff Oct 21, 2025
9648e4b
trying to fix yaml syntax error
DLWoodruff Oct 21, 2025
b30cf0a
trying to correct the indentation in the yaml file
DLWoodruff Oct 21, 2025
e4f5691
I let chatgpt edit the yaml so that we won't get hung up waiting for …
DLWoodruff Oct 21, 2025
1b5d7b1
trying to get more test jobs to run in parallel
DLWoodruff Oct 21, 2025
5cfd3ef
I am having a heck of a time getting tests to run on github
DLWoodruff Oct 21, 2025
35959dc
a GAMS example (that has a lot of machinery to hunt for files)
DLWoodruff Oct 23, 2025
c883c6f
a test and a tiny bit of documentation for the GAMS example
DLWoodruff Oct 23, 2025
34c64d9
Delete examples/loose_agnostic/AMPL/farmer_free_writer.py
bknueven Oct 24, 2025
a4db135
fixup GHA yaml
bknueven Oct 24, 2025
f4a2837
fixup GHA yaml 2
bknueven Oct 24, 2025
0e72b0d
remove optional imports
bknueven Oct 24, 2025
f82d96b
NFC: header for colmap.py
bknueven Oct 24, 2025
3acd9be
gms file needed for example/test
DLWoodruff Oct 25, 2025
1bb07a4
drop the test for loose gams example because I don't want to deal wit…
DLWoodruff Oct 25, 2025
f6ee4a5
remove a tab from the yml file
DLWoodruff Oct 26, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
130 changes: 65 additions & 65 deletions .github/workflows/test_pr_and_main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ concurrency:
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}
run:
shell: bash -l {0}

jobs:
ruff:
Expand All @@ -33,7 +33,7 @@ jobs:
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -49,12 +49,10 @@ jobs:
cd mpisppy/tests
python test_ef_ph.py


regression:
name: Basic regression tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -98,11 +96,8 @@ jobs:
runall_persistent:
name: run_all.py persistent solver
runs-on: ubuntu-latest
needs: [ruff]
timeout-minutes: 15
# this takes the most time, so we'll start it
# without waiting on the linting and other checks
# needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -134,10 +129,6 @@ jobs:
name: run_all.py direct solver
runs-on: ubuntu-latest
timeout-minutes: 15
# this takes the most time, so we'll start it
# without waiting on the linting and other checks
# needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -168,51 +159,63 @@ jobs:
schur-complement:
name: schur-complement
runs-on: ubuntu-latest
needs: [ruff]
strategy:
matrix:
python-version: [3.9]
python-version: [3.11]
steps:
- uses: actions/checkout@v3
- name: setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: anaconda, conda-forge
activate-environment: test_env
auto-activate-base: false
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install nose pybind11
conda install conda-forge::libstdcxx-ng
conda install openmpi pymumps --no-update-deps
pip install mpi4py pandas
pip install git+https://github.com/pyutilib/pyutilib.git
git clone https://github.com/pyomo/pyomo.git
cd pyomo/
pip install -e .
pyomo download-extensions
pyomo build-extensions
cd ../
pip install git+https://github.com/parapint/parapint.git
pip install -e .
- name: Test with nose
run: |
nosetests -v mpisppy/tests/test_sc.py
mpirun -np 3 -oversubscribe nosetests mpisppy/tests/test_sc.py
- uses: actions/checkout@v3

- name: setup conda
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
channels: anaconda, conda-forge
activate-environment: test_env
auto-activate-base: false

- name: Install dependencies
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
# Test tooling
pip install pytest pytest-cov
# Core build/test deps
pip install pybind11
conda install -y conda-forge::libstdcxx-ng
conda install -y openmpi pymumps --no-update-deps
pip install mpi4py pandas
# pyutilib / pyomo / parapint
pip install git+https://github.com/pyutilib/pyutilib.git
git clone https://github.com/pyomo/pyomo.git
cd pyomo/
pip install -e .
pyomo download-extensions
pyomo build-extensions
cd ../
pip install git+https://github.com/parapint/parapint.git
# Install this repo (editable)
pip install -e .

- name: Test with pytest (serial)
shell: bash -l {0}
run: |
pytest -q -vv mpisppy/tests/test_sc.py

- name: Test with pytest under MPI
shell: bash -l {0}
run: |
mpirun -np 3 -oversubscribe python -m pytest -q -vv mpisppy/tests/test_sc.py

straight-tests:
name: straight_tests.py
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -232,13 +235,12 @@ jobs:
name: admm wrapper tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -262,13 +264,12 @@ jobs:
name: aph tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -290,13 +291,12 @@ jobs:
name: pickled bundles tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -313,12 +313,10 @@ jobs:
cd mpisppy/tests
python test_pickle_bundle.py


mps:
name: MPS tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -341,18 +339,16 @@ jobs:
cd mpisppy/tests
python test_mps.py


confidence-intervals:
name: confidence intervals tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand Down Expand Up @@ -380,7 +376,6 @@ jobs:
runs-on: ubuntu-latest
needs: [ruff]
timeout-minutes: 15

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand Down Expand Up @@ -411,7 +406,6 @@ jobs:
name: gradient and rho tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v3
Expand Down Expand Up @@ -439,13 +433,12 @@ jobs:
test-headers:
name: header test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -466,13 +459,12 @@ jobs:
name: pysp tests
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand Down Expand Up @@ -500,13 +492,12 @@ jobs:
name: tests on some cylinders
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
with:
activate-environment: test_env
python-version: 3.9
python-version: 3.11
auto-activate-base: false
- name: Install dependencies
run: |
Expand All @@ -527,7 +518,6 @@ jobs:
name: tests on agnostic
runs-on: ubuntu-latest
needs: [ruff]

steps:
- uses: actions/checkout@v3
- uses: conda-incubator/setup-miniconda@v2
Expand All @@ -543,6 +533,7 @@ jobs:
python -m pip install amplpy --upgrade
python -m amplpy.modules install highs cbc gurobi
python -m pip install gamspy
python -m pip install mip
# license?

- name: setup the program
Expand All @@ -560,3 +551,12 @@ jobs:
run: |
cd mpisppy/agnostic/examples
python afew_agnostic.py

- name: run loose AMPL
timeout-minutes: 10
run: |
cd examples/loose_agnostic/AMPL
bash farmer_example.bash
# GAMS is not tested because I don't want to deal with the license
#cd ../GAMS
#bash farmer_example.bash
36 changes: 28 additions & 8 deletions doc/src/agnostic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,38 @@ Code for creating a
Pyomo model from an mps file is in ``mpisppy.utils.mps_reader.py``,
but you can also just use ``generic_cylinders.py`` and give
it the module ``mpisppy.utils.mps_module`` (you will need to specify
that path to this module) and the ``--mps-files-directory``
the path to this module) and the ``--mps-files-directory``
option. Note
that at the time of this writing, the number of scenarios is obtained
by counting the mps files in the directory given.

The file ``examples.sizes.mps_demo.bash`` has two commands. The second illustrates
how to instruction ``MPI-SPPY`` to read mps/json file pairs for each scenario from a
directory. The first command illustrates how to use ``MPI-SPPY`` to write
them in the first place (but if ``MPI-SPPY`` can get your scenarios, there
is probably no reason to write them and then read them again!). This
functionality is intended to be used by users of other AMLs or other
scenario-based stochastic programming applications.
The file ``examples.loose_agnostic.AMPL.farmer_example.bash`` has three
commands. The second illustrates how to instruct ``MPI-SPPY`` to read
mps/json file pairs for each scenario from a directory. The first runs
an `AMPLpy` program that creates the scenario files. This program is
in ``examples.loose_agnostic.AMPL.farmer_writer.py`` and, apart from
the `scenario_creator` function, is pretty general for two-stage
problems. You be able to copy the program and
write a `scenario_creator` function for your two-stage problem.
The third command runs a script that illustrates how to map column
names created by the MPS writer back to AMPL variable names.

The file ``examples.loose_agnostic.GAMS.farmer_example.bash`` has
three commands that mimic the commands for AMPL. The GAMS bash script
is not part of the automated tests because I don't want to deal with
the license.

A somewhat strange example is in the file
``examples.sizes.mps_demo.bash`` has two commands. The second
illustrates how to instruct ``MPI-SPPY`` to read mps/json file pairs
for each scenario from a directory. The first command illustrates how
to use ``MPI-SPPY`` to write them in the first place (but if
``MPI-SPPY`` can get your scenarios, there is probably no reason to
write them and then read them again!). This functionality is intended
to be used by users of other AMLs or other scenario-based stochastic
programming applications.

There is low-level support for `.lp` files instead of `.mps` files.

JSON file format
----------------
Expand Down
Loading
Loading