Skip to main content

Utilities to install pyomo solvers in windows without anaconda

Project description

pyomo-windows

Utilities to set up a pyomo environment in Windows. Installs glpk, ipoptand cbc solvers.

Install

In your environment, install pyomo_environment with

pip install pyomo_windows

Download solvers

Before using any solver, they must be downloaded first. You can download solvers using the DownloadSolvers class:

from pyomo_windows.solvers import DownloadSolvers
downloader = DownloadSolvers()
downloader.download_glpk()      # Download glpk
downloader.download_cbc()       # Download coin-cbc
downloader.download_ipopt()     # Download ipopt

Use solvers

Create your pyomo model and before executing it, call get_solver to get the desired solver. Remember that solver must be downloaded first as explained here.

Example:

# Create model normally
import pyomo.environ as pyo

model = pyo.ConcreteModel()
# Solve model
from pyomo_windows.solvers import SolverManager

solver_manager = SolverManager()
solver = "glpk"  # Or "cbc" or "ipopt"
opt = solver_manager.get_solver(solver)
res = opt.solve(model)
# Process your results...

Troubleshooting

You might face errors in the first execution. If in your install you cannot write in the default folder, try Optionally, if you want models to be downloaded in a different location, by passing folder to SolverManager. For example:

# Create model normally
import pyomo.environ as pyo

model = pyo.ConcreteModel()
# Solve model
from pyomo_windows.solvers import SolverManager

solver_manager = SolverManager('write a valid folder path here')
solver = "glpk"  # Or "cbc" or "ipopt"
opt = solver_manager.get_solver(solver)
res = opt.solve(model)
# Process your results...

Testing

Run tests in test_solvers.py. First execution will be slow as models have to be downloaded

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

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

pyomo_windows-0.0.5-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file pyomo_windows-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: pyomo_windows-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for pyomo_windows-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 e88648adec269a34fed8a6d570a34258dda3e09ebaf5ad362f96aefdf23313a5
MD5 cd2d08efb1fe7b8c1dea06b09d59095d
BLAKE2b-256 fd013ba39f2b8eb7f2cbc127859e28f46fccd30533deca10387783f1c732f7fd

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