mode attribute
Greeting,
I create a model as follow,
m = Model('my_LP_model', sense='MINIMIZE')
But when I run the following lines, I faced with the error: AttributeError: 'Model' object has no attribute
'getVars'
for v in for v in m.getVars():
print(v.varName, v.x) .getVars():
print( v.varName, v.x)
Appreciate for your guidance.
0
-
Official comment
This post is more than three years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum. Or why not try our AI Gurobot?. -
Hi,
I can see multiple issues with your code, none related to getVars.
- Model takes no "sense" argument.
- It looks as though you there is some copy&paste issue in your loop. (Did you paste your loop a second time into the middle of the first one?) The keyword "for" appears twice in the same line, print also appears twice and there's a "getVars():" that does not belong there.
Could you show us you're real code and the full error message?
0
Post is closed for comments.
Comments
2 comments