I am trying to print out variable names and their reliable pseudocost scores. This is because I am trying an experiment of using the reliable pseudocost scores of all the candidate variables as an initialisation of another algorithm. My input is a .cnf file and I use the default settings of SCIP such that reliable pseudocost branching is called.
In the block of code from lines 1113 to 1121 of branch_relpscost.c, I tried adding
printf("Candidate %i has score of %f \n", c, pscostscore);
after pscostscore = SCIPgetVarPseudocostScore(scip, branchcands[c], branchcandssol[c]);
This prints successfully, however I think this does not give me the candidate name, but only the counter c used to iterate through the data.
My understanding of the reliable pseudocost code in SCIP is that in line 1012, a search for the best pseudo cost candidate is done after that, while remembering unreliable candidates in a sorted buffer. Therefore the printout saying Candidate 1 has a score of 0.11342
does not necessarily mean the variable x1 has a score of 0.11342.
Next, I tried adding
printf("Candidate %i has score of %f \n", branchcands[c], pscostscore);
but the code does not compile.
I have also tried to use SCIPdebugMsg
instead of printf
but it does not work either.
Is there a correct command or method to do this? Thank you for your help.
You can do this really easily:
- get the variable name with SCIPvarGetName
- print it with %s in your format string.
You can find things like this on your own. All public functions that involve variables are found in pub_var.h
or scip_var.h
. The same applies to all other SCIP data structures.