Skip to main content

Pyomo Solver Wrapper

Introduction

A third-party python-based solver wrapper for Pyomo.

Requirements

  1. Python v3.5+

Installation

The package can be installed using the command:

pip install PyoSolveWrapper

Also by directly downloading an appropriate release or cloning the main development repository from GitHub:

git clone https://github.com/judejeh/PyomoSolverWrapper.git

Change into the "PyomoSolverWrapper" directory created by Git or extracted from the downloaded zip file and run:

python setup.py install

Usage

Import the solve wrapper:

import PyoSolveWrapper as slw 

This package solely aids the optimisation model solve process. Hence, having created an appropriate pyomo model object (further referred to as 'model'), an instance of the solver wrapper is first created:

Solver = slw.SolverWrapper()

Basic solver options can be changed where appropriate:

Solver.solver_name = 'cbc'
Solver.threads = 2
Solver.time_limit = 1200
Solver.rel_gap = 0.1
Solver.solver_progress = True

The package attempts to find the appropriate solver executable from the system PATH. However, should the solver path be in a different location, this path may be included as:

Solver.solver_path = '<PATH_TO_SOLVER>'

Note that whatever solver supplied should be compatible with Pyomo.

Where solvers are not locally installed, optimisation models may be solved using the NEOS server if doing so for non-commercial purposes. Note that for now, results are not post-processed.

Finally, the model can be solved as:

Solver.solve_model(model)

Results obtained from the model solution is automatically post-processed and saved with 'Solver' and can be accessed via the dictionary:

Solver.final_results[<type>][<name>]

where <type> is one of of 'sets', 'parameters' or 'variables'; and <name> is the actual model component name used in 'model'.

For e.g., a parameter and variable name 'A' and 'y' in the Pyomo model object 'model' can be accessed after successful model solution via:

Solver.final_results['parameters']['A']

and

Solver.final_results['variables']['y']

respectively.

Where parameters or variables are index of set(s), they can be accessed in the order of the sets they were declared by when creating the model component.

Disclaimer

At the time of writing, the authors of this package have no affiliation with Pyomo or NEOS server. The package was written to simplify an optimisation model solving process using Pyomo, especially relating to post-processing results and dealing with multiple solvers.

Release files for PyoSolveWrapper 0.3.2

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

Source distribution (sdist)

Source distribution for PyoSolveWrapper 0.3.2
File Size Uploaded
PyoSolveWrapper-0.3.2.tar.gz 12.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for PyoSolveWrapper 0.3.2
File Interpreter ABI Platform
PyoSolveWrapper-0.3.2-py3-none-any.whl Python 3 none any Details

Total release size: 23.1 kB

Release files / PyoSolveWrapper-0.3.2.tar.gz

Download URL PyoSolveWrapper-0.3.2.tar.gz
Size 12.0 kB
Tags Source
SHA-256 checksum
How to use checksums
f8d1319786cff04b24f801a2d8b5f4685c96fd7dcbbab45e68bb440c37937d0d
BLAKE2b-256 checksum
How to use checksums
737f106dd0a0321d16ea64346625f6689532a7263a4f9252ebae25d60c4d536f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.10

Release files / PyoSolveWrapper-0.3.2-py3-none-any.whl

Download URL PyoSolveWrapper-0.3.2-py3-none-any.whl
Size 11.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d355c3a85eae5ce71da4debd0f5338d43ed8c3554054439c6f791be2f16d06dd
BLAKE2b-256 checksum
How to use checksums
8e35521755cc3b654572ac3c5cc1e6668d846e478ccdeca33b6cb46d7395a8ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.10.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.10

Release history Release notifications | RSS feed

This release

0.3.2 This release

2 release files

0.3.1

2 release files

0.3.0

1 release file

0.0.2

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