Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
62 commits
Select commit Hold shift + click to select a range
20a18d0
start gha ci
Robbybp May 4, 2026
b92166c
install dependencies from requirements.txt
Robbybp May 4, 2026
d7c59d2
install extensions
Robbybp May 4, 2026
6e76a46
typo
Robbybp May 4, 2026
3441c7b
update readme
Robbybp May 4, 2026
b638d51
Merge branch 'main' into gha
Robbybp Jul 11, 2026
22abae2
install pybind11 in CI
Robbybp Jul 11, 2026
9a47127
install pyomo and idaes in CI
Robbybp Jul 11, 2026
e004f6f
download extensions before building
Robbybp Jul 11, 2026
181276e
set PKG_CONFIG_PATH
Robbybp Jul 11, 2026
e7fa94e
debugging
Robbybp Jul 11, 2026
1bbd6e6
set PKG_CONFIG_PATH?
Robbybp Jul 11, 2026
6d29b77
bug
Robbybp Jul 11, 2026
6d82ddc
debug
Robbybp Jul 11, 2026
7e05ff8
unpack idaes-lib tar.gz
Robbybp Jul 11, 2026
8aee0bc
only run on pull request
Robbybp Jul 11, 2026
8bb00e7
verbose tar
Robbybp Jul 11, 2026
ea9cfed
unpack idaes-solvers tar.gz ...
Robbybp Jul 11, 2026
030db2c
maybe idaes-local is the right tar.gz to unpack...
Robbybp Jul 11, 2026
abe34a8
on workflow_dispatch
Robbybp Jul 11, 2026
4dc914e
add dependencies to pyproject.toml
Robbybp Jul 11, 2026
cf3e50a
install test dependencies
Robbybp Jul 11, 2026
0a0403e
more concise output
Robbybp Jul 11, 2026
7256909
just set pkgconfig path with export
Robbybp Jul 11, 2026
1f25b1a
pip list
Robbybp Jul 11, 2026
851a4e3
remove pip list
Robbybp Jul 11, 2026
e6d32c7
add .idaes/bin to path
Robbybp Jul 11, 2026
6ecd3aa
tree idaes dir
Robbybp Jul 11, 2026
0010c5f
check if ipopt is on path
Robbybp Jul 11, 2026
f31c0b7
export PATH
Robbybp Jul 11, 2026
d3cbd16
dont use which
Robbybp Jul 11, 2026
754b363
set LD_LIBRARY_PATH
Robbybp Jul 11, 2026
3613ea0
install libraries, e.g., lapack
Robbybp Jul 11, 2026
ecee872
sudo for installing system packages
Robbybp Jul 11, 2026
fb57d8d
append to path, dont replace
Robbybp Jul 11, 2026
8f3ddf5
start python script to reproduce results
Robbybp Jul 12, 2026
4ca65a2
add solvetime subcommand to reproduce.py
Robbybp Jul 12, 2026
267b7d7
structural analysis smoketest in CI
Robbybp Jul 12, 2026
f402998
install tex
Robbybp Jul 12, 2026
cca075b
try texlive-latex-extra
Robbybp Jul 12, 2026
e6c46fb
typo
Robbybp Jul 12, 2026
71d99be
solvetime smoketest in CI
Robbybp Jul 12, 2026
6a86b4e
set LD_LIBRARY_PATH
Robbybp Jul 12, 2026
5a65710
maybe we need to set pkgcconfig path?
Robbybp Jul 12, 2026
f8e904a
was it the library path or the pkgconfig path
Robbybp Jul 12, 2026
e2d3749
pkgconfig path
Robbybp Jul 12, 2026
118a7d3
pkgconfig path and library path
Robbybp Jul 12, 2026
a06e9ec
uncomment library path
Robbybp Jul 12, 2026
fb72df4
uncomment library path
Robbybp Jul 12, 2026
702bab9
convergence smoketest in CI
Robbybp Jul 12, 2026
38de6be
test that expected files exist
Robbybp Jul 12, 2026
379b00a
was appending to GITHUB_PATH necessary?
Robbybp Jul 18, 2026
3067ce2
move header.txt to copyright.txt
Robbybp Jul 18, 2026
a2f4845
start updating readme
Robbybp Jul 18, 2026
8615c7b
more readme
Robbybp Jul 18, 2026
a5ab8b0
correct IPOPT version
Robbybp Jul 18, 2026
4c8844f
typo
Robbybp Jul 18, 2026
c1c9577
update
Robbybp Jul 18, 2026
e7084ce
remove superfluous commands from makefile
Robbybp Jul 18, 2026
3cfdbe0
Merge branch 'gha' of https://github.com/Robbybp/variable-elimination…
Robbybp Jul 18, 2026
df4f3a5
add full sweep files to readme
Robbybp Jul 18, 2026
807561f
Merge branch 'gha' of https://github.com/Robbybp/variable-elimination…
Robbybp Jul 18, 2026
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
88 changes: 88 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: Tests

on:
pull_request:
workflow_dispatch:

jobs:
tests:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11.5"

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y liblapack3 libblas3 gfortran

- name: Install latex

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary for our matplotlib plotting scripts. The particular subpackages were chosen by trial-and-error as I didn't want to install an entire texlive distribution...

run: |
sudo apt-get install -y \
texlive-latex-base \
texlive-latex-recommended \
texlive-latex-extra \
texlive-fonts-recommended \
dvipng \
cm-super

- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pybind11 setuptools pyomo idaes-pse
pyomo download-extensions
pyomo build-extensions
idaes get-extensions --to $GITHUB_WORKSPACE/.idaes
Comment on lines +38 to +41

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pyomo extensions are for libpynumeroASL and IDAES extensions are for libipopt. We install to a specific directory so we know where to set pkg-config and linker paths for CyIpopt later

pushd $GITHUB_WORKSPACE/.idaes
tar -xf idaes-local-ubuntu*-x86_64.tar.gz
popd
tree $GITHUB_WORKSPACE/.idaes
export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/.idaes/lib/pkgconfig:$PKG_CONFIG_PATH"
python -m pip install ".[test]"

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here we are installing with latest dependency versions, per pyproject.toml. Alternatively, we could use the frozen environment from requirements.txt. I think I prefer using latest versions. If something starts failing, we can pin dependencies as necessary.


- name: Run tests
run: |
export PATH="$PATH:$GITHUB_WORKSPACE/.idaes"
ipopt --version
python -m pytest \
var_elim/algorithms/tests \
var_elim/heuristics/tests \
var_elim/mip_formulations/tests

- name: Run structural analysis
run: |
export PATH="$PATH:$GITHUB_WORKSPACE/.idaes"
python reproduce.py structure --smoke --run-dir=.
test -s results/structure-distill.csv
test -s results/structure-distill.txt
test -s results/structure-distill-matching.txt
test -s images/fraction-elim.pdf
test -s images/nnz-per-con.pdf

- name: Run solvetime analysis
run: |
export PATH="$PATH:$GITHUB_WORKSPACE/.idaes"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/.idaes/lib"
export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/.idaes/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --libs --cflags ipopt
python reproduce.py solvetime --smoke --run-dir=.
test -s results/solvetime-distill-matching.csv
test -s results/solvetime-distill-matching.txt
test -s images/fraction-solvetime.pdf

- name: Run convergence analysis
run: |
export PATH="$PATH:$GITHUB_WORKSPACE/.idaes"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$GITHUB_WORKSPACE/.idaes/lib"
export PKG_CONFIG_PATH="$GITHUB_WORKSPACE/.idaes/lib/pkgconfig:$PKG_CONFIG_PATH"
pkg-config --libs --cflags ipopt
python reproduce.py convergence --smoke --run-dir=.
test -s results/sweep/distill-matching-sweep.csv
test -s results/sweep/distill-matching-sweep-summary.csv
test -s images/distill-matching-sweep-convergence.pdf
19 changes: 19 additions & 0 deletions COPYRIGHT.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
___________________________________________________________________________

Variable Elimination: Research code for variable elimination in NLPs

Copyright (c) 2023. Triad National Security, LLC. All rights reserved.

This program was produced under U.S. Government contract 89233218CNA000001
for Los Alamos National Laboratory (LANL), which is operated by Triad
National Security, LLC for the U.S. Department of Energy/National Nuclear
Security Administration. All rights in the program are reserved by Triad
National Security, LLC, and the U.S. Department of Energy/National Nuclear
Security Administration. The Government is granted for itself and others
acting on its behalf a nonexclusive, paid-up, irrevocable worldwide license
in this material to reproduce, prepare derivative works, distribute copies
to the public, perform publicly and display publicly, and to permit others
to do so.

This software is distributed under the 3-clause BSD license.
___________________________________________________________________________
59 changes: 3 additions & 56 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,64 +1,8 @@
# TODO: Variable for results dir and/or suffix
DIR=var_elim/scripts
COMDIR=commands
RESDIR=results
IMDIR=images

all:
echo "WARNING: Reproducing all results in serial via `make all` is time-consuming."
echo "We recommend reproducing these results in an HPC environment with a resource"
echo "manager like Slurm, if available."
# Generate results for Table 3, Table 4, Figure 5, Figure 6, and Figure 7
python $(DIR)/analyze_structure.py
# Table 3
python $(DIR)/write_latex_table.py results/structure.csv
# Table 4
python $(DIR)/write_latex_table.py results/structure.csv --which=matching-bounds
# Figures 5 and 7
python $(DIR)/plot_structure_bargraphs.py results/structure.csv --image-dir=$(IMDIR)
# Figure 6
python $(DIR)/plot_sparsity.py --model=mb-steady --image-dir=$(IMDIR)
# Generate results for Figure 8 and Table 5
python $(DIR)/analyze_solvetime.py
# Table 5
python $(DIR)/write_latex_table.py results/solvetime.csv
# Figure 8
python $(DIR)/plot_timing_bargraphs.py results/solvetime.csv --image-dir=$(IMDIR)
# Generate results for Table 6 and Figures 9, 10, 11, and 12
python $(DIR)/run_param_sweep.py --model=distill
python $(DIR)/run_param_sweep.py --model=mb-steady
python $(DIR)/run_param_sweep.py --model=pipeline
# Table 6
python $(DIR)/summarize_sweep_results.py --model=distill
python $(DIR)/summarize_sweep_results.py --model=mb-steady
python $(DIR)/summarize_sweep_results.py --model=pipeline
#
# Each parameter sweep plot is produced individually...
# Figure 9
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-no-elim-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-d1-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-trivial-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-linear-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-ampl-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/distill-matching-sweep.csv
# Figure 10
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-no-elim-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-d1-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-trivial-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-linear-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-ampl-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/mb-steady-matching-sweep.csv
# Figure 11
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-no-elim-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-d1-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-trivial-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-linear-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-d2-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-ampl-sweep.csv
python $(DIR)/plot_sweep_results.py $(DIR)/results/sweep/pipeline-matching-sweep.csv

structure-parallel:
mkdir -p $(RESDIR)/structure # Letting this get created by the parallel scripts below leads to a race condition
python $(DIR)/write_command_lines.py structure --results-dir=$(RESDIR) --commands-dir=$(COMDIR)
Expand All @@ -81,15 +25,18 @@ solvetime-collect:
python $(DIR)/plot_timing_bargraphs.py $(RESDIR)/solvetime.csv --image-dir=$(IMDIR)

sweep-batch:
mkdir -p $(COMDIR)
mkdir -p $(RESDIR)/sweep
python $(DIR)/write_sweep_command_lines.py --results-dir=$(RESDIR)/sweep --commands-dir=$(COMDIR) --image-dir=$(IMDIR)
# This is a custom command I use to submit batch jobs on multiple HPC nodes
submit-batch.sh $(COMDIR)/parallel-sweep-commands.txt

sweep-collect:
mkdir -p $(IMDIR)
parallel -a $(COMDIR)/collect-sweep-commands.txt
parallel -a $(COMDIR)/plot-sweep-commands.txt
python $(DIR)/summarize_sweep_results.py --results-dir=$(RESDIR)/sweep --model=distill
python $(DIR)/summarize_sweep_results.py --results-dir=$(RESDIR)/sweep --model=mb-steady
python $(DIR)/summarize_sweep_results.py --results-dir=$(RESDIR)/sweep --model=pipeline
python $(DIR)/summarize_sweep_results.py --results-dir=$(RESDIR)/sweep
python $(DIR)/write_latex_table.py $(RESDIR)/sweep-summary.csv --results-dir=$(RESDIR)
Loading
Loading