Branching priority for a sub-set of variables in Gurobipy
AnsweredHey
I am using Gurobipy and I would like to use the BranchPriorit attribute to set a branching priority for a specific set of variables.
I have defined the following variables:
for t in T:
for f in F:
for n in CAREGIVERS:
if y_[t, f, n] == 1:
for i in PATIENTS:
if u_[t, f, i, n] == 1:
if S[(t, i)] >= 1:
for s in range(1, (S[(t, i)] + 1)):
for j in PATIENTS:
if u_[t, f, j, n] == 1:
if S[(t, j)] >= 1:
for z in range(1, (S[(t, j)] + 1)):
if i != j or s != z:
Xcc[t, f, i, s, j, z, n] = r.addVar(
vtype=GRB.BINARY,
name="Xcc[%d,%d,%s,%d,%s,%d,%s]"
% (t, f, i, s, j, z, n),
)
I would like to set a branching priority for Xcc only when the parameters H[t,f,i,s] = 1.
0
-
Hi,
You can use the BranchPriority attribute to define a branching priority for the subset of variables you are interested in. The variables with larger branching priority values will take priority over variables with smaller values.
Best regards,
Maliheh
0
Please sign in to leave a comment.
Comments
1 comment