GurobiError: Unsupported type (<class 'list'>) for LinExpr addition argument
AnsweredHi,
I run 'diet2.py' in Anaconda 4.2.0, Python 3.5.6 and met this problem.
Python 3.5.6 |Anaconda 4.2.0 (64-bit)| (default, Aug 26 2018, 16:05:27) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.
IPython 6.2.1 -- An enhanced Interactive Python.
runfile('D:/Program Files/gurobi751/win64/examples/python/diet2.py', wdir='D:/Program Files/gurobi751/win64/examples/python')
Traceback (most recent call last):
File "<ipython-input-1-2ae817e615ea>", line 1, in <module>
runfile('D:/Program Files/gurobi751/win64/examples/python/diet2.py', wdir='D:/Program Files/gurobi751/win64/examples/python')
File "D:\Program Files\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 678, in runfile
execfile(filename, namespace)
File "D:\Program Files\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 106, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "D:/Program Files/gurobi751/win64/examples/python/diet2.py", line 72, in <module>
foods, cost, nutritionValues)
File "D:\Program Files\gurobi751\win64\examples\python\dietmodel.py", line 29, in solve
for c in categories), "_")
File "model.pxi", line 2552, in gurobipy.Model.addConstrs (../../src/python/gurobipy.c:78637)
File "model.pxi", line 2464, in gurobipy.Model.addConstr (../../src/python/gurobipy.c:77389)
File "linexpr.pxi", line 429, in gurobipy.LinExpr.__sub__ (../../src/python/gurobipy.c:32252)
File "linexpr.pxi", line 408, in gurobipy.LinExpr.__add__ (../../src/python/gurobipy.c:31857)
File "linexpr.pxi", line 153, in gurobipy.LinExpr.add (../../src/python/gurobipy.c:29245)
GurobiError: Unsupported type (<class 'list'>) for LinExpr addition argument
I had no idea. A Gurobi provided example should not have a problem like this. Can anyone help me?
Thanks,
Larry
-
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?. -
Gurobi Optimizer 7.5 is not compatible with Python 3.5. Can you try again with Python 3.6?
0
Post is closed for comments.
Comments
2 comments