pysp | PySP : Stochastic Programming in Python
kandi X-RAY | pysp Summary
kandi X-RAY | pysp Summary
PySP is an extension to the Pyomo optimization modeling package for formulating and solving stochastic programming optimization problems. PySP was originally developed within the Pyomo project and has subsequently been replaced by mpi-sppy as the recommended extension for optimization under uncertainty in Pyomo. We plan to make PySP available at least until some time in 2023.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Convert external setup .
- Convert an embedding model into an embedding file .
- Construct an argument parser .
- Compute the updates for each subproblems .
- Wait for all subproblems and process them .
- Run the scenario .
- Run a conf . conf .
- Convert an external setup into a single scenario .
- Create a scenario tree model from a networkx graph .
- Creates an ExpModel instance from the given scenario tree .
pysp Key Features
pysp Examples and Code Snippets
Community Discussions
Trending Discussions on pysp
QUESTION
I am using PySP (Pyomo) for one stochastic optimization problem. I created a concrete model for my problem and also defined the scenarios based on the farmer's example given in
https://github.com/Pyomo/pysp/blob/main/examples/farmer/concrete/ReferenceModel.py
In the above example a pysp_instance_creation_callback()
function is called for each of the scenarios. In the function, an instance of the model is cloned for each scenario so that the scenario variable (Yield in this case) is updated for each of the scenarios using instance.Yield.store_values(Yield[scenario_name])
.
I followed a similar approach to my problem. However, in my case, for each scenario the size of the unknown varies unlike the farmer's example, where the scenarios are for just three crops (wheat, sugar, corn). For instance, my scenarios would look like this,
...ANSWER
Answered 2021-Jul-15 at 17:19Before I get started, I should point out that PySP is no longer under active development. New development is all going on in mpi-sppy https://github.com/Pyomo/mpi-sppy
Returning to your issue: PySP assumes that the "shape" of the model is the same for each scenario so you will have to do some more coding to make that assumption valid. The same is more-or-less true for mpi-sppy, although it has mechanisms to allow for Vars that have zero probability depending on the scenario. mpi-sspy would have a little less trouble than PySP with paramaters that change size between scenarios, but it does have some components that assume that the shape of the model can be determined by an arbitrary scenario (PySP makes use of a ReferenceModel so it strongly assumes that the shape does not change).
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install pysp
You can use pysp like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page