Hi,
If you take a look at the multiobj.py example, the way the multiple objectives are set is this:
model.setAttr(GRB.Attr.ObjN, Elem, Set[i])
In this call Elem is a tupledict and Set[i] is a list.
ObjN is a variable attribute. So the idea is to set an objective coefficient for the n-th objective for each variable. In our example we do this for all variables at once using a list of coefficients.
So what you would need to do in your code is something like this:
m.setAttr(GRB.Attr.ObjN, [x,y], [1,1])
and
m.setAttr(GRB.Attr.ObjN, [x,y], [1,-1])
Best regards,
Sonja
----
Dr. Sonja Mars
Gurobi Optimization - Technical Support