Fw: [Coin-discuss] debug printf left in CglKnapsackCover.cpp? (fwd)

Robin Lougee-Heimer robinlh at us.ibm.com
Fri Nov 17 15:39:36 EST 2006


Kish:

> However, should my code have reached here under normal circumstances, or
> are the printf's
> here to show the user an error condition?

Yes - your code should have reached there under normal circumstances.  I'm 
not sure how those printf's sneaked in there. Francois Margot (thank you!) 
has fixed the code in svn (both trunk and stable). 

Robin



> ---------- Forwarded message ----------
> Date: Sat, 11 Nov 2006 02:58:09 +0000
> From: Kish Shen <kish.shen at crosscoreop.com>
> Reply-To: Discussions about open source software for Operations Research
>     <coin-discuss at list.coin-or.org>
> To: coin-discuss at list.coin-or.org
> Subject: [Coin-discuss] debug printf left in CglKnapsackCover.cpp?
>
> 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
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://list.coin-or.org/pipermail/coin-discuss/attachments/20061117/955799a1/attachment.html>


More information about the Coin-discuss mailing list