gurobipy.Model object has no attribute 'addVars'

1,712 views
Skip to first unread message

luukve

unread,
Feb 6, 2017, 11:26:47 AM2/6/17
to Gurobi Optimization
Hi,

I'm trying to get more familiar with the Gurobi interface in Python. I'm at a total loss why I get an error.

I have tried running some of the example files which are given in the <installation_path>/examples/python/ folder, without any problems, which leads me to think my installation was succesful.

However, as I try the following Python script:

from gurobipy import *
m
= Model("Feasible schedule")
x
= m.addVars(2,3)


I get the following error message:
AttributeError: 'gurobipy.Model' object has no attribute 'addVars'. 

However, changing the code to:


from gurobipy import *
m
= Model("Feasible schedule")
x
= m.addVar(1)


gives me no issues whatsoever. What's happening?

Renan Garcia

unread,
Feb 6, 2017, 11:29:46 AM2/6/17
to gur...@googlegroups.com
Sounds like you need to upgrade to the latest version of Gurobi, which is currently v7.0.2.

--

---
You received this message because you are subscribed to the Google Groups "Gurobi Optimization" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gurobi+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

David Nehme

unread,
Feb 7, 2017, 1:19:21 AM2/7/17
to Gurobi Optimization
To verify your gurobi version, you can use the "version" method on the "gurobi" object 

from __future__ import print_function
import gurobipy as grb
print(grb.gurobi.version())


grb.gurobi.version() returns a tuple, (7, 0, 2) at this time.  The addVars function was introduced in version (7, 0, 0)

luukve

unread,
Feb 7, 2017, 5:08:05 AM2/7/17
to Gurobi Optimization
Thanks, that did the job!

Op maandag 6 februari 2017 17:29:46 UTC+1 schreef Renan Garcia:
Reply all
Reply to author
Forward
0 new messages