Gurobi OverflowError error

51 views
Skip to first unread message

Amogu Ukairo

unread,
May 25, 2017, 2:36:45 PM5/25/17
to Gurobi Optimization
When I run the following code, Gurobi reports an OverflowError: value too large to convert to char message.

I resolved this by removing the arrow in the lanes items. Is this a 'normal' behavior and where can I learn more about it?
m = Model()
lanes = ['A→B', 'B→C', 'C→A', 'C→B']
carriers = ['hier', 'cony']
flows = m.addVars(l, c, vtype=GRB.CONTINUOUS, name = 'flow')


Daniel Espinoza

unread,
May 25, 2017, 3:34:50 PM5/25/17
to Gurobi Optimization
Hi Amogu

The issue is that all variable and constraint names are internally represented as regular chars; unfortunately the arrow is an extended character, and not representable as a regular char, thus the overflow.
In your case, m.addVars will create variables named 'flow[a,b]' where a is the string version if lanes, and b a string version of carriers, but the string version of lanes has that extended character in the middle.
If you use 
lanes = ['A->B', 'B->C', 'C->A', 'C->B']
instead, everything will work as expected.

Let me know if this is helpful.
Best
Daniel
Reply all
Reply to author
Forward
0 new messages