Can Cplex prioritize a variable over the others when branching?

134 Views Asked by At

Using C++, I have two sets of binary decision variables, y[i] and x[i][j]:

    IloNumVarArray y = CreateNumVarArray(env, int1, "y", 0, 1, ILOINT); 
    NumVarMatrix x(env, int1);
    for (IloInt i = 0; i < int1; ++s) {
        x[i] = IloNumVarArray(env, int2, 0, 1, ILOINT);
    }

When branching, I want y[i] variables to be branched first.

I looked for "strong branching" related topics in CPLEX Parameters Reference Manual, but could not find anything useful.

1

There are 1 best solutions below

4
Alex Fleischer On

You can rely on priorities within cplex.

See OPL example https://github.com/AlexFleischerParis/zooopl/blob/master/zoopriorities.mod

int nbKids=300;
float costBus40=500;
float costBus30=400;
 
dvar int+ nbBus40;
dvar int+ nbBus30;

execute
{
  nbBus40.priority=100;
  nbBus30.priority=0;
}
 
minimize
 costBus40*nbBus40  +nbBus30*costBus30;
 
subject to
{
 40*nbBus40+nbBus30*30>=nbKids;
} 

You can do the same with all CPLEX apis