Wrapper for Pyomo solve method
Project description
Pyomo Solver Wrapper
Introduction
A third-party python-based solver wrapper for Pyomo.
Requirements
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.
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
Built Distribution
File details
Details for the file PyoSolveWrapper-0.3.2.tar.gz
.
File metadata
- Download URL: PyoSolveWrapper-0.3.2.tar.gz
- Upload date:
- Size: 12.0 kB
- Tags: Source
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8d1319786cff04b24f801a2d8b5f4685c96fd7dcbbab45e68bb440c37937d0d |
|
MD5 | 12235dc7ac3ab386b87f63b6f76f4dfe |
|
BLAKE2b-256 | 737f106dd0a0321d16ea64346625f6689532a7263a4f9252ebae25d60c4d536f |
File details
Details for the file PyoSolveWrapper-0.3.2-py3-none-any.whl
.
File metadata
- Download URL: PyoSolveWrapper-0.3.2-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using 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
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d355c3a85eae5ce71da4debd0f5338d43ed8c3554054439c6f791be2f16d06dd |
|
MD5 | 87072a4f966d2293bc0e7f13fb19c0de |
|
BLAKE2b-256 | 8e35521755cc3b654572ac3c5cc1e6668d846e478ccdeca33b6cb46d7395a8ef |