Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: ghackebeil/pybnb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 0.6.2
Choose a base ref
...
head repository: ghackebeil/pybnb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Loading
Showing with 4,416 additions and 3,990 deletions.
  1. +242 −0 .github/workflows/ci.yml
  2. +5 −0 CHANGELOG.rst
  3. +11 −9 README.rst
  4. +5 −0 example_requirements.txt
  5. +65 −78 examples/command_line_problems/bin_packing.py
  6. +38 −24 examples/command_line_problems/binary_knapsack.py
  7. +18 −26 examples/command_line_problems/lipschitz_1d.py
  8. +48 −58 examples/command_line_problems/rosenbrock_2d.py
  9. +38 −38 examples/scripts/range_reduction_pyomo.py
  10. +17 −15 examples/scripts/simple.py
  11. +39 −43 examples/scripts/tsp/tsp_byedge.py
  12. +37 −31 examples/scripts/tsp/tsp_byvertex.py
  13. +40 −38 examples/scripts/tsp/tsp_util.py
  14. +2 −2 run-mpitests.py
  15. +12 −1 setup.cfg
  16. +3 −0 setup.py
  17. +8 −17 src/pybnb/__about__.py
  18. +16 −15 src/pybnb/__init__.py
  19. +44 −30 src/pybnb/common.py
  20. +47 −26 src/pybnb/configuration.py
  21. +86 −85 src/pybnb/convergence_checker.py
  22. +423 −408 src/pybnb/dispatcher.py
  23. +93 −98 src/pybnb/dispatcher_proxy.py
  24. +36 −53 src/pybnb/futures.py
  25. +302 −200 src/pybnb/misc.py
  26. +117 −33 src/pybnb/mpi_utils.py
  27. +84 −62 src/pybnb/node.py
  28. +244 −153 src/pybnb/priority_queue.py
  29. +48 −55 src/pybnb/problem.py
  30. +22 −89 src/pybnb/pyomo/misc.py
  31. +11 −13 src/pybnb/pyomo/problem.py
  32. +69 −102 src/pybnb/pyomo/range_reduction.py
  33. +481 −434 src/pybnb/solver.py
  34. +65 −64 src/pybnb/solver_results.py
  35. +3 −2 src/tests/mpi/common.py
  36. +6 −0 src/tests/mpi/problems/delayed_unbounded_max.py
  37. +6 −0 src/tests/mpi/problems/delayed_unbounded_min.py
  38. +3 −5 src/tests/mpi/problems/infeasible_max.py
  39. +3 −5 src/tests/mpi/problems/infeasible_min.py
  40. +18 −6 src/tests/mpi/problems/root_infeasible_max.py
  41. +18 −6 src/tests/mpi/problems/root_infeasible_min.py
  42. +18 −6 src/tests/mpi/problems/unbounded_max.py
  43. +18 −6 src/tests/mpi/problems/unbounded_min.py
  44. +2 −3 src/tests/mpi/problems/zero_objective_max.py
  45. +2 −3 src/tests/mpi/problems/zero_objective_min.py
  46. 0 src/tests/mpi/pyomo/__init__.py
  47. +0 −48 src/tests/mpi/pyomo/test_misc.py
  48. +57 −35 src/tests/mpi/test_futures.py
  49. +70 −63 src/tests/mpi/test_heaps.py
  50. +101 −33 src/tests/mpi/test_misc.py
  51. +204 −327 src/tests/mpi/test_simple_problems.py
  52. +85 −69 src/tests/mpi/test_solver.py
  53. +69 −123 src/tests/pyomo/test_pyomo.py
  54. +21 −20 src/tests/test_common.py
  55. +5 −7 src/tests/test_configuration.py
  56. +76 −102 src/tests/test_convergence_checker.py
  57. +72 −73 src/tests/test_dispatcher.py
  58. +79 −81 src/tests/test_examples.py
  59. +135 −115 src/tests/test_misc.py
  60. +12 −13 src/tests/test_node.py
  61. +5 −1 src/tests/test_package.py
  62. +208 −246 src/tests/test_priority_queue.py
  63. +151 −149 src/tests/test_problem.py
  64. +63 −53 src/tests/test_solver.py
  65. +72 −68 src/tests/test_solver_results.py
  66. +18 −19 src/tests/test_tsp.py
  67. +0 −3 test_requirements.txt
242 changes: 242 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,242 @@
name: ci

on: [push]

env:
IDEAS_IPOPT: "2.4.3/idaes-solvers-ubuntu2004-64.tar.gz"

jobs:

build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
py-version:
- "2.7"
- "3.5"
- "3.6"
- "3.7"
- "3.8"
- "3.9"
- "pypy2"
- "pypy3"
py-arch:
- x86
- x64
mpi:
- mpich
- openmpi
- msmpi
os:
- ubuntu-latest
- macos-latest
- windows-latest
include:
- os: ubuntu-latest
mpicmd: "mpirun -n 4"
examples_arg: "--run-examples"
- os: macos-latest
mpicmd: "mpirun -n 4"
examples_arg: "--run-examples"
- os: windows-latest
mpicmd: "mpiexec.exe -n 4"
examples_arg: ""
exclude:
- os: ubuntu-latest
py-arch: x86
- os: ubuntu-latest
mpi: msmpi
- os: macos-latest
py-version: pypy2
- os: macos-latest
py-version: pypy3
- os: macos-latest
py-arch: x86
- os: macos-latest
mpi: msmpi
- os: windows-latest
mpi: mpich
- os: windows-latest
mpi: openmpi
- os: windows-latest
py-version: pypy2
- os: windows-latest
py-version: pypy3

steps:

- name: Configure hostname
if: runner.os == 'Linux' || runner.os == 'macOS'
run: echo 127.0.0.1 `hostname` | sudo tee -a /etc/hosts > /dev/null
- name: Checkout
uses: actions/checkout@v2
- name: Setup MPI (${{ matrix.mpi }})
uses: mpi4py/setup-mpi@v1
with:
mpi: ${{ matrix.mpi }}
- name: Use Python ${{ matrix.py-version }} ${{ matrix.py-arch }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py-version }}
architecture: ${{ matrix.py-arch }}
- name: Install packaging tools
run: python -m pip install -U setuptools pip wheel
- name: Install test dependencies
run: python -m pip install -U -r ./test_requirements.txt
- name: Install package for testing
run: |
python setup.py develop
python -m pip list
mkdir coverage_cache
- name: Install Ipopt
if: startsWith(matrix.os,'ubuntu')
run: |
ipopt_dir="${GITHUB_WORKSPACE}/ipopt"
echo "$ipopt_dir" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ipopt_dir" >> $GITHUB_ENV
mkdir -p $ipopt_dir
curl --max-time 150 --retry 8 \
-L https://github.com/IDAES/idaes-ext/releases/download/$IDEAS_IPOPT \
> $ipopt_dir/ipopt.tar.gz
cd $ipopt_dir
tar -xvf ipopt.tar.gz
- name: MPI Sanity tests
run: mpiexec python -c "import mpi4py.MPI; print(mpi4py.MPI.COMM_WORLD.rank)"
- name: Serial tests (slim)
run: |
pytest --cov=pybnb --cov=examples --cov=src/tests --cov-report="" ${{ matrix.examples_arg }} -v
mv .coverage coverage_cache/.coverage.pybnb.slim_serial
- name: Install extras
run: |
python -m pip install PyYAML || echo failed to install yaml
python -m pip install pyomo || echo failed to install pyomo
python -m pip install numpy || echo failed to install numpy
python -m pip install numba || echo failed to install numba
python -m pip install dill || echo failed to install dill
- name: Serial tests (no coverage)
run: pytest ${{ matrix.examples_arg }} -v
- name: Serial tests (coverage)
if: startsWith(matrix.py-version,'pypy') != true
run: |
pytest --cov=pybnb --cov=examples --cov=src/tests --cov-report="" ${{ matrix.examples_arg }} -v
mv .coverage coverage_cache/.coverage.pybnb.serial
- name: Parallel tests (no coverage)
run: python run-mpitests.py --mpirun="${{ matrix.mpicmd }}" --no-build -v
- name: Parallel tests (coverage)
if: matrix.os != 'windows-latest'
run: |
python run-mpitests.py --mpirun="${{ matrix.mpicmd }}" --no-build --with-coverage -v
mv .coverage coverage_cache/.coverage.pybnb.parallel.1
- name: Parallel tests with serialization config (no coverage)
env:
PYBNB_COMPRESSION: 1
PYBNB_SERIALIZER: dill
run: python run-mpitests.py --mpirun="${{ matrix.mpicmd }}" --no-build -v
- name: Parallel tests with serialization config (coverage)
if: matrix.os != 'windows-latest'
env:
PYBNB_COMPRESSION: 1
PYBNB_SERIALIZER: dill
run: |
python run-mpitests.py --mpirun="${{ matrix.mpicmd }}" --no-build --with-coverage -v
mv .coverage coverage_cache/.coverage.pybnb.parallel.2
- name: Coverage report
run: |
coverage combine coverage_cache
coverage report
- name: Coverage upload
uses: codecov/codecov-action@v1
- name: Uninstall package after testing
run: python -m pip uninstall --yes pybnb

no_mpi:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install packaging tools
run: python -m pip install -U setuptools pip wheel
- name: Install base dependencies
run: python -m pip install -U -r ./requirements.txt
- name: Install serial test dependencies
run: |
python -m pip install -U coverage pytest pytest-coverage PyYAML numba
- name: Install package
run: |
python -m pip install -e .
python -m pip list
mkdir coverage_cache
- name: Serial tests 1
run: |
pytest --cov=pybnb --cov=examples --cov=src/tests --cov-report="" --run-examples -v
mv .coverage coverage_cache/.coverage.pybnb.no_mpi.1
- name: Install more serial test dependencies
run: python -m pip install -U pyomo numpy
- name: Serial tests 2
run: |
pytest --cov=pybnb --cov=examples --cov=src/tests --cov-report="" --run-examples -v
mv .coverage coverage_cache/.coverage.pybnb.no_mpi.2
- name: Install Ipopt
run: |
ipopt_dir="${GITHUB_WORKSPACE}/ipopt"
echo "$ipopt_dir" >> $GITHUB_PATH
echo "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ipopt_dir" >> $GITHUB_ENV
mkdir -p $ipopt_dir
curl --max-time 150 --retry 8 \
-L https://github.com/IDAES/idaes-ext/releases/download/$IDEAS_IPOPT \
> $ipopt_dir/ipopt.tar.gz
cd $ipopt_dir
tar -xvf ipopt.tar.gz
- name: Serial tests 3
run: |
pytest --cov=pybnb --cov=examples --cov=src/tests --cov-report="" --run-examples -v
mv .coverage coverage_cache/.coverage.pybnb.no_mpi.3
- name: Coverage report
run: |
coverage combine coverage_cache
coverage report
- name: Coverage upload
uses: codecov/codecov-action@v1

lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Use Python
uses: actions/setup-python@v2
with:
python-version: 3
- name: Install base dependencies
run: python -m pip install -r ./requirements.txt
- name: Install package
run: python -m pip install .
- name: Install lint dependencies
run: python -m pip install
pycodestyle
pydocstyle
flake8
pylint
mypy
PyYAML
types-PyYAML
types-six
pytest
pytest-doctestplus
- name: doctest
run: pytest --doctest-plus --doctest-ignore-import-errors src/pybnb -v
- name: pycodestyle
run: pycodestyle src/pybnb
# - name: pydocstyle
# run: pydocstyle src/pybnb
- name: flake8
run: flake8 src/pybnb
# - name: pylint
# run: pylint pybnb
- name: mypy (typecheck)
run: mypy src/pybnb
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Changelog
=========

0.7.dev0 - `master`_
~~~~~~~~~~~~~~~~~~~~

* TODO

0.6.2 - 2019-12-09
~~~~~~~~~~~~~~~~~~

20 changes: 11 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pybnb
=====

|PyPI-Status| |PyPI-Versions| |Codacy-Grade|
|PyPI-Status| |PyPI-Versions| |PyPI-Downloads|

|Travis-Status| |Appveyor-Status| |Coverage-Status| |Documentation-Status|
|Testing-Status| |Coverage-Status| |Documentation-Status|

|PyPI-Downloads|
|Codacy-Grade| |Mypy| |Black|

A parallel branch-and-bound engine for Python. (https://pybnb.readthedocs.io)

@@ -119,19 +119,21 @@ Quick Start
- other: 11.31% [avg time: 15.3 us, count: 65537]
.. |Travis-Status| image:: https://travis-ci.org/ghackebeil/pybnb.svg?branch=master
:target: https://travis-ci.org/ghackebeil/pybnb
.. |Appveyor-Status| image:: https://ci.appveyor.com/api/projects/status/gfbrxja9v08rm7a2?svg=true
:target: https://ci.appveyor.com/project/ghackebeil/pybnb
.. |Testing-Status| image:: https://github.com/ghackebeil/pybnb/actions/workflows/ci.yml/badge.svg
:target: https://github.com/ghackebeil/pybnb/actions/workflows/ci.yml
.. |Coverage-Status| image:: https://codecov.io/gh/ghackebeil/pybnb/branch/master/graph/badge.svg
:target: https://codecov.io/gh/ghackebeil/pybnb
.. |Documentation-Status| image:: https://readthedocs.org/projects/pybnb/badge/?version=latest
:target: http://pybnb.readthedocs.io/en/latest/?badge=latest
.. |PyPI-Status| image:: https://img.shields.io/pypi/v/pybnb.svg
:target: https://pypi.python.org/pypi/pybnb
.. |PyPI-Versions| image:: https://img.shields.io/pypi/pyversions/pybnb.svg
:target: https://pypi.org/project/pybnb
:target: https://pypi.org/project/pybnb
.. |Codacy-Grade| image:: https://img.shields.io/lgtm/grade/python/g/ghackebeil/pybnb.svg?logo=lgtm&logoWidth=18
:target: https://lgtm.com/projects/g/ghackebeil/pybnb/context:python
:target: https://lgtm.com/projects/g/ghackebeil/pybnb/context:python
.. |PyPI-Downloads| image:: https://img.shields.io/pypi/dm/pybnb.svg
:target: https://pypistats.org/packages/pybnb
.. |Black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
.. |Mypy| image:: http://www.mypy-lang.org/static/mypy_badge.svg
:target: http://mypy-lang.org
5 changes: 5 additions & 0 deletions example_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
PyYAML
pyomo
numpy
numba
dill
Loading