Pyomo NameError: name ' m' is not defined

7 views
Skip to first unread message

Hayford Adjavor

unread,
Jun 2, 2018, 1:44:40 PM6/2/18
to Pyomo Forum
Hello team Pyomo,
I would kindly like your assistance with the above-mentioned error, "Pyomo NameError: name ' m' is not defined".  I am pretty sure this might be a quick fix, but since I am still new to Pyomo, it is taking me longer than normal. I have attached both the screenshot of my code and the error for your reference. Thank you for your help.

 
code_screenshot.PNG
error_screenshot.PNG

Siirola, John D

unread,
Jun 2, 2018, 2:17:11 PM6/2/18
to pyomo...@googlegroups.com
Your Constraint rule is referring to an “m[i]” that is not declared in the global scope. Based on your console output, it looks like you are declaring a “model.m” component just above the code you posted. You probably just want to put “model.” before the “m[i]” in your rule. 

John

On Jun 2, 2018, at 11:44 AM, Hayford Adjavor <vonha...@gmail.com> wrote:

Hello team Pyomo,
I would kindly like your assistance with the above-mentioned error, "Pyomo NameError: name ' m' is not defined".  I am pretty sure this might be a quick fix, but since I am still new to Pyomo, it is taking me longer than normal. I have attached both the screenshot of my code and the error for your reference. Thank you for your help.

 

--
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.
<code_screenshot.PNG>
<error_screenshot.PNG>
Reply all
Reply to author
Forward
0 new messages