I am not sure is this is what you need, but you can auxiliary parameters to a Gurobi model. Here is an example (I think you can find a similar example in Gurobi example codes) of my callback function:
def mycallback(model, where):
if where == GRB.callback.MIP:
time = model.cbGet(GRB.callback.RUNTIME)
objbst = model.cbGet(GRB.callback.MIP_OBJBST)
objbnd = model.cbGet(GRB.callback.MIP_OBJBND)
mipgap = objbst - objbnd
if mipgap <= model._gap and time > model._timelimit1:
print "termination 1"
model.terminate()
elif time > model._timelimit2:
print "termination 2"
model.terminate()
There are 2 different time limits and a gap parameters that have to be added to the model.
m._timelimit1 = params1['timelimit1']
m._timelimit2 = params1['timelimit2']
m._gap = params1['mipgap']
Since I use this inside a Python function I pass the params1 dictionary to it from the outside. It is simply
params1 = {"timelimit1": 300,
"timelimit2": 600,
"mipgap": 1}
I do not see why one of the parameters cannot be a matrix.
Hope this helps,
Andy