Execute PySP with ConcreteModel within Python?

115 views
Skip to first unread message

Hongwei Jin

unread,
Jun 26, 2015, 1:05:46 PM6/26/15
to pyomo...@googlegroups.com
According to the thread topic here: https://groups.google.com/forum/#!topic/pyomo-forum/jaVCW2JQafs

The PySP supports creating ConcreteModel by suing pysp_instance_creation_callback.

And I saw some examples in the source code, but it seems it will apply the command line to run it instead of running it inside the python script.

I build a gist (https://gist.github.com/jinhw1989/d1f5cd5459dc1635ce08) based on concretemodel running inside python. But I am pretty sure it is not the way to do so.

Is there anyone could tell me, how to call the callback function, and where to call it.

Thanks in advance.

Gabe Hackebeil

unread,
Jun 26, 2015, 1:42:12 PM6/26/15
to pyomo...@googlegroups.com
We're working on getting a scripting interface setup for PySP tools. It exists, but it's not documented and still very much in flux as we integrate more applications. There's plenty of example code if your comfortable digging into the source code for the command-line tools (e.g., phinit.py, benders.py, run_ef_script.py).

I plan to make more headway on this over the summer and would very much welcome your input. If you want to share more about what your trying accomplish (off of the forum), it could be beneficial for us to collaborate as I develop the API. 

Regards,
Gabe
--
You received this message because you are subscribed to the Google Groups "Pyomo Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pyomo-forum...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hongwei Jin

unread,
Jun 26, 2015, 2:03:44 PM6/26/15
to pyomo...@googlegroups.com
Hi Gabe,
Thanks for your reply.
The project I am working on is related to optimizing the energy flow in the real world, which contains a lot variable and constraints (more than 20000). However, we already build the ConcreteModel to get the optimal solution based on the python script run using SolverFactory, solve and load results.
While I want to build SP model based on our current model. Essentially, I will refactor our current code and apply the feature of PySP. I just couldn't any example to run PySP example by using python script instead of using runph
I have already explored the latest source code a bit, and it was a bit hard for me to understand all of them. 

Hope to see those kinds of example will release soon.

Hongwei Jin

unread,
Jul 9, 2015, 6:25:29 PM7/9/15
to pyomo...@googlegroups.com
I would like to add one example of using pyomo solving a stochastic problem in ConcreteModel. Here is the example:
Again, I would like to see how to using PySP to build a ConcreteModel without using callback functions, if possible.
Reply all
Reply to author
Forward
0 new messages