Pandas_read_csv was regarded as invalid argument
回答済みDear Sir/Madam,
We are trying to use Pandas and Python to read a parameter from a csv file. In the file, for example, the parameter Betab,k,n is ‘1’ when b=9, k=10, n=2. In the optimization model, the constraint is Betab,k,n≥X b,k,n and the code in Gurobi is listed below. But an error occurs which is:
“File "src\gurobipy\model.pxi", line 3263, in gurobipy.gurobipy.Model.__addConstr.
GurobiError: Invalid argument to Model.addConstr””.
We wonder how to fix this problem. Thanks for your time.
Yang
for k in ListLiftu+ListRight:
for n in range(1,NumCaTy):
for b in ListDir:
cM.addConstr((dataBeta.loc[(dataBeta['b']==b)&(dataBeta['k']==k)&(dataBeta['n']==n),:].iloc[:,4].values) >= X[b,k,n],name="eq2")
-
正式なコメント
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 Yang,
I recommend checking the type of
dataBeta.loc[(dataBeta['b']==b)&(dataBeta['k']==k)&(dataBeta['n']==n),:].iloc[:,4].values
Gurobi is expecting a scalar number here and this would return an array, as far as I can tell. The array may only have one element but will need to be converted into a number.
If the above does not help, could you post a minimal working example to make the issue reproducible?
0
投稿コメントは受け付けていません。
コメント
2件のコメント