Confusion with variable indices with JuMP/CPLEX

I try to set branching priorities on variables using CPXcopyorder(env, lp, cnt, indices, priority, direction). Particlularly I want to get the indices of the varialbes of the JuMP model in the CPLEX model. I tried:

index = model[:x].index.value - 1

and

index = CPLEX.column(backend(model), index(model[:x]))- 1

both returning the same values for each variable. Are the above statements equivalent or is this just a coincidence? Which one is correct (if any)?

1 Like

Accessing the fields of the variable struct directly is most certainly breaching the interface. You should probably be using JuMP.index, i.e., the second option.

2 Likes