Hello everyone,
I have a question regarding branching in CPLEX solver. Is there any way to display on which variable the algorithm used as the branching variable ?
I am working on a Branch-and-Bound problem with the CPLEX solver and below is the CPLEX.opt that I used so far:
$onecho > cplex.opt
mipdisplay 5
mipinterval 1
simdisplay 2
cutsfactor 0
preind 0
divetype 1
nodesel 0
lpmethod 1
heurfreq -1
miptrace tree.txt
$offecho
test.OptFile = 1;
However, I still could not find the option to display the branching variables. Does anyone know how to set this up?
Thank you in advance,
Kevin
Kevin,
Only Cplex B&C gives you this information. The default is “dynamic search”. If you set “mipsearch=1” then you get a log like this with variable and branching direction:
Nodes Cuts/
Node Left Objective IInf Best Integer Best Bound ItCnt Gap Variable B NodeID Parent Depth
* 0+ 0 265.2514 20.8487 92.14%
Found incumbent of value 265.251368 after 0.31 sec. (686.93 ticks)
0 0 27.0625 119 265.2514 27.0625 570 89.80%
0 0 53.4938 120 265.2514 Cuts: 36 596 79.83%
0 0 59.1553 121 265.2514 Cuts: 11 613 77.70%
0 0 59.1693 121 265.2514 Cuts: 19 617 77.69%
0 0 59.7204 121 265.2514 Cuts: 2 620 77.49%
0 0 60.4024 121 265.2514 Fract: 5 628 77.23%
* 0+ 0 257.9759 60.4024 76.59%
Found incumbent of value 257.975902 after 0.42 sec. (891.75 ticks)
0 0 -1.00000e+75 0 257.9759 60.4024 628 76.59%
0 2 60.4024 121 257.9759 67.8273 628 73.71% 0 0
Elapsed time = 0.45 sec. (971.44 ticks, tree = 0.01 MB)
1 3 70.6143 120 257.9759 70.7830 630 72.56% gamma(531) D 1 0 1
2 4 77.1493 119 257.9759 70.7830 631 72.56% gamma(496) D 2 1 2
3 5 77.8281 118 257.9759 70.9056 673 72.51% gamma(496) U 3 1 2
4 6 83.7653 118 257.9759 70.9056 674 72.51% gamma(455) D 4 2 3
5 7 84.5811 116 257.9759 70.9056 686 72.51% gamma(455) U 5 2 3
6 8 90.4617 117 257.9759 70.9056 689 72.51% gamma(475) D 6 4 4
7 9 91.3612 118 257.9759 70.9056 703 72.51% gamma(475) U 7 4 4
8 10 96.7229 115 257.9759 70.9056 711 72.51% gamma(547) U 8 7 5
9 11 102.9569 114 257.9759 70.9056 712 72.51% gamma(502) D 9 8 6
10 12 105.0166 113 257.9759 70.9056 721 72.51% gamma(502) U 10 8 6
Elapsed time = 0.45 sec. (1002.88 ticks, tree = 0.01 MB)
This log is nicely described at https://www.ibm.com/docs/en/icos/22.1.0?topic=mip-progress-reports-interpreting-node-log
-Michael
Hello bussieck,
Thank you so much this is very helpful, I have another follow-up question.
Now that it’s shown in the log, is it possible to save these values (i.e., Branching Variables, Objective function value) from each iteration into as a parameters / variables? Since I need to export these values into .csv files.
Thank you,
Kevin
No. You can redirect the log to a file (logOption=2 or 4, see https://www.gams.com/latest/docs/UG_GamsCall.html#GAMSAOlogoption) and then you have to parse this yourself. -Michael
Hello Michael,
I have another follow-up question for this topic,
I am aware that in the CPLEX log , it only shows how many integer-infeasible variables in each node (IInf column), and I tried to set the mipdisplay = 5, but it only shows the in and out variables.
Is it possible to display the candidate variables of each node (or the values of each variables in each node)?
I hope my question is clear enough.
Thank you,
Kevin
The callback programs of the BCH Facility (see https://www.gams.com/latest/docs/UG_SolverUsage.html#ADVANCED_USAGE_BCHFacility) get the fractional and integral solution of a node as GDX input files. You need to convince GAMS/Cplex with options to call these programs all the time and save away the inputs as part of your callback program. This way you get all the values of the variables as part of the B&C tree. Be aware that BCH “cripples” Cplex by preventing certain presolve options and parallel processing.
Hope this helps,
-Michael