Pysp - Runef -Runbenders- Runph Scripting

90 views
Skip to first unread message

Juan José Torres

unread,
Mar 25, 2017, 3:26:39 PM3/25/17
to Pyomo Forum
Hi, 

I've created a SMPS to PySP parser in order to benchmark the computational performance of LP and MIP Stochastic Problems solving strategies. I'm mainly interested on use of the PH algorithmn because I have several interger recourse model libraries. However, I'd also like to test the extensive form solution and L-Shaped/ Benders algorithm on two stage continuous problems. 

I built the ReferenceModel along with the stochastic_tree_model fuctions pysp_scenario_tree_model_callback() and pysp_instance_creation_callback() inspired on the Networkx and baa99 examples. I didn't use the netoworkxScenarioTreeModel nor ConcreteTwoStageTreeModel because i wanted to provide a general way to specify the problem. It is working perfectly 
when I invoque the runph command.

Currently I'm having some issues on the problem solution when I'm trying to use the runef and runbenders commands, I've got the following error:

"Key Error
        Error accessing indexed component: cannot treat the scalar componenent '***._PYSP'_UserCostExpression as an array" 

Still I havent been able to debbug that issue

All the best,
Juan José


Siirola, John D

unread,
Mar 27, 2017, 6:59:39 PM3/27/17
to pyomo...@googlegroups.com

First, the full stack trace for that exception would help greatly in debugging things.  You can get that by specifying the “--traceback” option to runef.

 

I am going to go out on a limb and guess the following: you are using NumPy data types, either internally or by initializing immutable Params with NumPy data.  There is a particularly subtle conflict between NumPy’s operator overloading and Pyomo’s object model where NumPy tries to treat Pyomo scalars as if they were indexed.  See https://github.com/Pyomo/pyomo/issues/31 for the gory discussion.

 

If we can identify *where* that exception is being raised, we can probably exploit Option 4 from the discussion to avoid the exception.

 

john

--
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.

Juan José Torres

unread,
Mar 28, 2017, 12:59:57 AM3/28/17
to Pyomo Forum
Hi John,

You found the solution at the first glace, I was using numpy.float64 while I was estimating the Node/Scenario probability. According --traceback the error was located at the pysp/ef.py script while constructing the BindingInstance.EF_EXPECTED_COST.

If you want I can share you my SMPS/Parser Package, I created a networkx tree object to fill the pysp_scenario_tree_model_callback() fuction, that can be coupled with the ScenarioTreeFromNetworkx object. 

Sincerely,

Juan Jose
Reply all
Reply to author
Forward
0 new messages