Retrieving Variable Attribute using Var.getAttr()
回答済みHello,
I have defined below Variables in my model:
Resources=steel.addVars(res_list,time,vtype=GRB.INTEGER,name="Resources")
Tasks=steel.addVars(task_list,time,vtype= GRB.BINARY,name="Tasks")
What is the correct syntax using Var.getAttr() to check if Gurobi has picked up correct Variables?
I have tried many, but failed.
Many Thanks
-
正式なコメント
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 try Gurobot, our chatbot interface offering instant, expert-level support. -
Hi Margi,
What is the correct syntax using Var.getAttr() to check if Gurobi has picked up correct Variables?
What exactly are you trying to achieve when you say "picked up correct variables"?
You can access variable attributes after they have been processed to the model. Gurobi uses a lazy UpdateMode. To directly process the addition of new variables or a change of their attributes, you have to explicitly call model.update().
Best regards,
Jaromił0 -
" check if Gurobi has picked up correct Variables"
to check what are the variables in the model, I just write the model before optimizing it. I can see what are the variables, and what is the detail structure of the model by opening the .lp model file (which is human-readable),
model.write(f'Outputs/model_v16_{sub_index}.lp')0
投稿コメントは受け付けていません。
コメント
3件のコメント