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.4.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for cog-suspect-1.0.4.tar.gz
Algorithm Hash digest
SHA256 b0c3b05e7db40c936a61cbccf7f696aa5751e74428b05081cf1f381715e396a3
MD5 24d34576e0a4e08bf7d6b4ba669ae2ee
BLAKE2b-256 bc7971160091fcdee8005db5eae04e0ae48d67cbdc6d4e07093eec2376b5cb6f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for cog_suspect-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 38509e77ac64340b9de4dd62c6c719bc1ed8f8f5bb9c52e3cc85e3c881da51e2
MD5 d467f70d48eb1f7277fad7ca8228d133
BLAKE2b-256 2a950a25b293c5ca1c5062bb1b5ecd4db44e834d8c2862780b0133560d8e25c5

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