AttributeError: 'int' object has no attribute 'addVars'

453 views
Skip to first unread message

n.zi...@gmail.com

unread,
Sep 21, 2018, 4:09:50 PM9/21/18
to Gurobi Optimization
I am trying to add variables and I get this error

costs = {}
for carrier in carriers:
    for row in df_merged.to_dict('records'):
        key = (row['Ship_Dt'],row['Client_Code'],row['Ship_loc'],row['Service'],row['Bill Weight'],row['Zone'],row['Resi'],carrier)
        costs[key] = row[carrier]
                

m = Model('rate_shop_holiday')

assign=tupledict()
for i,j,k,l,m,n,o,p in costs.keys():
    assign[i,j,k,l,m,n,o,p] = m.addVar(vtype=GRB.BINARY )

Dr Michael F

unread,
Sep 25, 2018, 12:33:04 AM9/25/18
to Gurobi Optimization
You are using m as the name of the model as as one of your loop variables in the for loop!
Reply all
Reply to author
Forward
0 new messages