[Coin-discuss] debug printf left in CglKnapsackCover.cpp?
Kish Shen
kish.shen at crosscoreop.com
Fri Nov 10 21:58:09 EST 2006
Hi,
I was running some code using Cbc, and some extra output was produced:
At one 1
88 21 1.48197
frac 2
23 2.0833 0.746648
94 0.6667 0.373324
These look like some sort of debugging output, and after some checking, I found that they
came from CglKnapsackCover.cpp, in the function liftUpDownAndUncomplementAndAdd():
if (unsatRhs<=0.0&&fabs(xstar[firstFrac])>epsilon2_) {
printf("At one %d\n",atOne.getNumElements());
for (i=0; i<atOne.getNumElements(); i++){
int iColumn = atOne.getIndices()[i];
printf("%d %g %g\n",atOne.getIndices()[i],atOne.getElements()[i],
xstar[iColumn]);
}
printf("frac %d\n",fracCover.getNumElements());
for (i=0; i<fracCover.getNumElements(); i++){
int iColumn = fracCover.getIndices()[i];
printf("%d %g %g\n",fracCover.getIndices()[i],fracCover.getElements()[i],
xstar[iColumn]);
}
I assume these should only be printed if debugging, so I have put a #ifdef PRINT_DEBUG
around this code.
However, should my code have reached here under normal circumstances, or are the printf's
here to show the user an error condition?
I am using the trunk branch, but I checked the stable branch, and the above code is also there.
Looking at CglKnapsackCover.cpp, I found another printf that is not enclosed by ifdefs, in
deriveAKnapsack(), around line 928 in my copy of the file:
printf("*** Doubleton Row is ");
for(i=0; i<2; i++){
int iColumn = indices[i];
sum += elements[i]*xstar[iColumn];
printf("%d (coeff = %g, value = %g} ",indices[i],
elements[i],xstar[iColumn]);
}
printf("<= %g - go for it\n",b);
Should there be an ifdef around this as well?
--Kish Shen
More information about the Coin-discuss
mailing list