Skip to content

Commit 79072bd

Browse files
committed
added a demonstration and some documentation.
1 parent ed4be65 commit 79072bd

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

Diff for: doc/src/agnostic.rst

+8
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@ option. Note
2121
that at the time of this writing, the number of scenarios is obtained
2222
by counting the mps files in the directory given.
2323

24+
The file ``examples.sizes.mps_demo.txt`` has two commands. The second illustrates
25+
how to instruction ``MPI-SPPY`` to read mps/json file pairs for each scenario from a
26+
directory. The first command illustrates how to use ``MPI-SPPY`` to write
27+
them in the first place (but if ``MPI-SPPY`` can get your scenarios, there
28+
is probably no reason to write them and then read them again!). This
29+
functionality is intended to be used by users of other AMLs or other
30+
scenario-based stochastic programming applications.
31+
2432

2533
Tight integration
2634
^^^^^^^^^^^^^^^^^

Diff for: examples/sizes/mps_demo.bash

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
# This is mainly to demonstrate what loose agnostic files look like and
3+
# how to use them with agnostic_cylinders.py.
4+
# To do that, we write the files based on a Pyomo model, then
5+
# read them in.
6+
# Note: if you actually have a Pyomo model, you probably don't want to do
7+
# it this way since you would have had to have written most of the
8+
# functions (e.g. scenario_creator) anyway.
9+
# If you are using some other AML, then you migth want to use the second
10+
# command line to read the files you wrote with your AML and
11+
# you can use the first command to write files as an example of the format
12+
# for the json files.
13+
14+
set -e
15+
16+
SOLVER=cplex
17+
18+
# assumes we are in the sizes directory and don't mind polluting it with 6 files
19+
python ../../mpisppy/generic_cylinders.py --module-name sizes_expression --num-scens 3 --default-rho 1 --solver-name ${SOLVER} --max-iterations 0 --scenario-lp-mps-files
20+
21+
# By specifying the module to be mps_module we will read files for the problem
22+
# from the specified mps-files-directory.
23+
mpiexec -np 3 python -m mpi4py ../../mpisppy/generic_cylinders.py --module-name ../../mpisppy/utils/mps_module --xhatshuffle --lagrangian --default-rho 1 --solver-name ${SOLVER} --max-iterations 10 --mps-files-directory=.

0 commit comments

Comments
 (0)