PySp-Pyomo error: 'dict' has no attribute 'f'
<p>i am new to promo and PySP. I am trying to replicate the solutions for the Stochastic Programming tutorial under Vehicle Routing Problems from <code>https://projects.coin-or.org/Coopr/browser/pyomo.data/trunk/pyomo/data/pysp/vehicle_routing/3-7f?rev=9398&amp;order=name</code>
 But with the excerption of PS3-7b, all the other codes, once i replicate in their respective folders and run the command </p>

<pre><code>`pyomo solve --solver=glpk ReferenceModel.py ReferenceModel.dat` 
</code></pre>

<p>throws the following errors</p>

<pre><code>[    0.00] Setting up Pyomo environment
[    0.00] Applying Pyomo preprocessing actions
[    0.78] Pyomo Finished
ERROR: Unexpected exception while loading model:
    'dict' object has no attribute 'f
</code></pre>

<p>'
been bugging me for several days now. Any help as to what i am doing wrongly.</p>

<pre><code>I am running Pyomo 4.3.11388 (Python 2.7.10 on Darwin 15.6.0) on MacBook Late 2008 model.
</code></pre>

<p>Thanks</p>

<p>Try adding -c at the end of the command. It will provide you with a full stack trace showing the source of the error.</p>

<p>You should also note that the Coopr project has been renamed to Pyomo, and we are now hosted on Github. The most up to date documentation can be found at pyomo.org</p>

<p>Edit:</p>

<p>I took a closer look at that example, and fixed a few bugs. You can find the updated code here: <a href="https://github.com/Pyomo/pyomo-model-libraries/blob/master/pysp/vehicle_routing/3-7b/ReferenceModel.py" rel="nofollow">https://github.com/Pyomo/pyomo-model-libraries/blob/master/pysp/vehicle_routing/3-7b/ReferenceModel.py</a>.</p>

<p>You should note that 3-7b is set up to run as a stand-alone script. That is, you should not run it using the pyomo command, but instead run it using the python interpreter that Pyomo was installed into</p>

<pre><code>python ReferenceModel.py
</code></pre>

<p>If you look at the bottom of that file, you will see code that (1) creates a concrete instance using the .dat file, (2) creates a solver and solves the model with it, and (3) interrogates the solution by printing the value of the objective and variables on the instance. This is basically what the pyomo command does when you provide it with a model file, so you should not provide it with a model file that contains this kind of code.</p>

python python-2.7 pyomo