Skip to main content

Special Structure Detection for Pyomo

Project description

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

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 (
        set_pyomo4_expression_tree,
        detect_special_structure,
)
import pyomo.environ as aml


set_pyomo4_expression_tree()


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)

info = detect_special_structure(model)

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

License

Copyright 2018 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.

Changelog

1.0.4

  • First public release. Yay!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cog-suspect-1.0.5.tar.gz (61.2 kB view details)

Uploaded Source

Built Distribution

cog_suspect-1.0.5-py3-none-any.whl (89.8 kB view details)

Uploaded Python 3

File details

Details for the file cog-suspect-1.0.5.tar.gz.

File metadata

  • Download URL: cog-suspect-1.0.5.tar.gz
  • Upload date:
  • Size: 61.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for cog-suspect-1.0.5.tar.gz
Algorithm Hash digest
SHA256 55981845d253aa186a40e9f16e45ab6e84f49c2f686cb335e55b7e2a2f49d42b
MD5 db1f76aeb4d227097dbdd9b36c0b9279
BLAKE2b-256 c59e010e263c48539739eae23802c8003328fabea028ef1ad7d1cd61dc620306

See more details on using hashes here.

File details

Details for the file cog_suspect-1.0.5-py3-none-any.whl.

File metadata

File hashes

Hashes for cog_suspect-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 558d213e0baf009fe44b844de90552a909da4abab2c939fb24f6a7b18355d23d
MD5 60aaaf85b8859fc874306c8ae322cfaa
BLAKE2b-256 542972f416e2389e2225b42ce2541ce4b925c30557455df9f240cc8e0da78d7f

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page