Skip to main content

Special Structure Detection for Pyomo

DOI travis codecov

This library implements methods to:

  • Detect convex and concave expressions

  • Detect increasing and decreasing expressions

  • Detect linear, quadratic and polynomial expressions

  • Tighten expression bounds

Please reference this software as

@Article{Suspect2019,
author={Ceccon, Francesco and Siirola, John D. and Misener, Ruth},
title={{SUSPECT}: {MINLP} special structure detector for Pyomo},
journal={Optimization Letters},
year={2019},
month={Feb},
issn="1862-4480",
doi="10.1007/s11590-019-01396-y",
url="https://doi.org/10.1007/s11590-019-01396-y"
}

Documentation

Documentation is available at https://cog-imperial.github.io/suspect/

Installation

SUSPECT requires Python 3.5 or later. We recommend installing SUSPECT in a virtual environment

To create the virtual environment run:

$ python3 -m venv myenv
$ source myenv/bin/activate

Then you are ready to clone and install SUSPECT:

$ git clone https://github.com/cog-imperial/suspect.git
$ cd suspect
$ pip install -r requirements.txt
$ pip install .

Command Line Usage

The package contains an utility to display structure information about a single problem.

You can run the utility as:

model_summary.py -p /path/to/problem.osil

or, if you want to check variables bounds include the solution:

model_summary.py -p /path/to/problem.osil -s /path/to/problem.sol

The repository also includes a Dockerfile to simplify running the utility in batch mode in a cloud environment. Refer to the batch folder for more information.

Library Usage

from suspect import detect_special_structure, create_connected_model
import pyomo.environ as aml


model = aml.ConcreteModel()
model.x = aml.Var()
model.y = aml.Var()

model.obj = aml.Objective(expr=(model.y - model.x)**3)
model.c1 = aml.Constraint(expr=model.y - model.x >= 0)

connected, _ = create_connected_model(model)
info = detect_special_structure(connected)

# try info.variables, info.objectives, and info.constraints
print(info.objectives['obj'])

License

Copyright 2020 Francesco Ceccon

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Acknowledgements

This work was funded by an Engineering & Physical Sciences Research Council Research Fellowship to RM [Grant Number EP/P016871/1].

Changelog

2.1.3 (2021-08-13)

  • More robust Pyomo usage

2.1.2 (2021-02-16)

  • Make SUSPECT compatible with Pyomo 5.7.2+

2.1.1 (2020-11-13)

  • Try to compute special structure even if bounds are missing

2.1.0 (2020-09-16)

  • Add support for log10

  • Improve handling of quadratic expressions in nonlinear problems

  • Fix FBBT bug when handling some types of expressions

2.0.2 (2020-09-01)

  • Fix convexity on division

  • Handle Pyomo MonomialTermExpression

2.0.1 (2020-07-01)

  • Minor bug fixes

2.0.0 (2020-04-28)

  • Use Pyomo expressions to represent the DAG

  • Replace DAG with connected_model

1.6.0 (2019-11-15)

  • Add floating point math mode

  • Minor performance fixes

1.1.0 (2019-01-31)

  • Add Quadratic expression type

  • Add Interval special case for x*x

  • Fix Interval sin

  • Add Interval comparison with numbers

1.0.7 (2018-08-30)

  • Add Interval abs

  • Add Interval power

1.0.6 (2018-07-05)

  • Change ExpressionType and UnaryFunctionType to IntEnum

1.0.5 (2018-07-05)

  • Documentation improvements

1.0.4 (2018-07-04)

  • First public release. Yay!

Release files for cog-suspect 2.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cog-suspect 2.1.3
File Size Uploaded
cog-suspect-2.1.3.tar.gz 76.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cog-suspect 2.1.3
File Interpreter ABI Platform
cog_suspect-2.1.3-py3-none-any.whl Python 3 none any Details

Total release size: 183.9 kB

Release files / cog-suspect-2.1.3.tar.gz

Download URL cog-suspect-2.1.3.tar.gz
Size 76.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7f8bcda085fb1b7ad2989164060e2865e82758a034c8153a2d9a888ac7813200
BLAKE2b-256 checksum
How to use checksums
8bdde9fc1d0b28e314fb60a658c6473f2ce085d8e92c0cde7eb74486034bacba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

Release files / cog_suspect-2.1.3-py3-none-any.whl

Download URL cog_suspect-2.1.3-py3-none-any.whl
Size 107.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
226aafd0b22c946e62781fbdb8c01b322c8479c59a146a4b8e60a1652352724d
BLAKE2b-256 checksum
How to use checksums
53a602bb94d56538ce0944eb179a2e80df9f0b1afa316b626b6a8699d31e0738
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.60.0 CPython/3.8.8

Release history Release notifications | RSS feed

This release

2.1.3 This release

2 release files

2.1.2

1 release file

2.1.1

1 release file

2.1.0

1 release file

2.0.2

1 release file

2.0.1

2 release files

2.0.0

1 release file

1.6.5

1 release file

1.6.4

1 release file

1.6.3

1 release file

1.6.0

1 release file

1.5.7

1 release file

1.5.6

1 release file

1.5.5

1 release file

1.5.2

2 release files

1.5.1

1 release file

1.5.0

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.7

2 release files

1.0.6

2 release files

1.0.5

2 release files

1.0.4

2 release files

1.0.3

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page