Skip to main content

A collection of tools to aid in formulating and working with Pyomo models.

Project description

PyomoTools

PyomoTools is a collection of tools to aid in formulating and working with Pyomo models.

Key functions include:

  • LoadIndexedSet: Create a dict of subsets and properly attach it to a given pyomo model. (available to environ models only)
  • Load2DIndexedSet: Similar to LoadIndexedSet but with two levels of indexing. (available to environ models only)
  • GenerateExpressionStrings: A function to create a matching pair of strings representing a given pyomo expression: One symbolic, One with all values substituted in
  • InfeasibilityReport: A class to analyze any infeasibilities found within a model in an easily readable way.
  • Formulations.DoubleSidedBigM: A function to automatically generate the constraints and variables needed to model the relation $A = B \times X + C$ in MILP form.
  • Formulations.MinOperator: A function to automatically generate the constraints and variables needed to model the relation $A = min(B,C)$ in MILP form.
  • Formulations.MaxOperator: A function to automatically generate the constraints and variables needed to model the relation $A = max(B,C)$ in MILP form.
  • Formulations.PWL: A function to automatically generate a Piecewise-Linear approximation of a general (non-linear) function (available to environ models only) (pyomo kernel already has this functionality)
  • IO.ModelToExcel: A function to write the solution of a model to an easily readable excel file. (available to environ models only)
  • IO.LoadModelSolutionFromExcel: A function to load a solution from an excel file into a pyomo model. (available to environ models only)
  • IO.ModelToYaml: A function to write the solution of a model to a yaml file. (available to kernel models only)
  • IO.LoadSolutionFromYaml: A function to load a solution from a yaml file into a pyomo model. (available to kernel models only)
  • FindLeastInfeasibleSolution: A tool for finding the least infeasible solution of a (presumably infeasible) model.
  • VectorRepresentation: A tool to convert a (Mixed-Integer) Linear model into it's vector/matrix representation.
  • Polytope: A class to facilitate the plotting and vertex calculation of a sub-polytope of a model.

Each function is available (or will soon be available) for both pyomo.environ modeling as well as pyomo.kernel modeling. To access each one, please import them from PyomoTools.environ or PyomoTools.kernel

Installation

From PyPi

1.1. Enter the command pip install PyomoTools in your Python terminal.

From GitHub

1.1. Download or clone this repository.
1.2. In your Python terminal, navigate to the repository you downloaded.
1.3. Enter the command pip install .

  1. By default, the example/testing code used into this package uses the SCIP solver, Gurobi Solver, and ipopt Solver. Please either
    A) ensure that these solvers are installed and accessible to Pyomo or
    B) call PyomoTools.base.Solvers.DefaultSolver.EditDefaultSolver(problemType,solverName,**defaultKwargs) where
    problemType is MILP, NLP, MIQCP, etc,\ solverName is the name of the solver you'd like to use (e.g. "gurobi", "ipopt"), and\ defaultKwargs are any necessary key-word arguments for pyomo to utilize (e.g. executable=path/to/executable)

  2. To make sure everything was correctly installed, Enter the command pytest PyomoTools/

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

pyomotools-0.3.1.tar.gz (85.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyomotools-0.3.1-py3-none-any.whl (125.1 kB view details)

Uploaded Python 3

File details

Details for the file pyomotools-0.3.1.tar.gz.

File metadata

  • Download URL: pyomotools-0.3.1.tar.gz
  • Upload date:
  • Size: 85.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pyomotools-0.3.1.tar.gz
Algorithm Hash digest
SHA256 198e098097725bca60de1952da88c3ceb35ff32d175dce1450ea9e33c670860b
MD5 67c0ed63465b07c49ca920bd6fae979c
BLAKE2b-256 bb39e9c2dfa36ae3c4b2c0977b23e72bd92c5dde094db9c19ecc707555beed97

See more details on using hashes here.

File details

Details for the file pyomotools-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: pyomotools-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 125.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.12

File hashes

Hashes for pyomotools-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7c2a9b9da4e4cab1d8a7a19e600be32f8fcb7f113c20e8550df45f7f9dd21e7b
MD5 add6d337cba2bfff8bfe64e04801cf29
BLAKE2b-256 90eb5d95aa3aebb5c7af6a8c145e516c1fcaf74501ee6a14df6e718c18b95554

See more details on using hashes here.

Supported by

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