bug-glpk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-glpk] GLP_MSG_OFF ignored


From: xypron
Subject: [Bug-glpk] GLP_MSG_OFF ignored
Date: Sun, 21 Dec 2008 20:07:35 -0800 (PST)

Hello Andrew,

I am using the COIN-OR Osi Interface to GLPK 4.32. Hence here I am sticking
to the old lpx interface.

I called
lpx_set_int_parm(lp,LPX_K_MSGLEV,GLP_MSG_OFF) ;

Integer optimization still created the following output:

Creating the conflict graph...
The conflict graph has 2*240 vertices and 3600 edges

The error is in file glpios.c (of GLPK 4.34) in function lpx_create_cog.

Please, check the patch below.

Best regard

Xypron


--- glpk/glpk/trunk/glpk-4.34/src/glpios08.c    2008/11/23 10:54:02     335
+++ glpk/glpk/branches/glpk-4.34-dot/src/glpios08.c     2008/12/22 03:33:07     
366
@@ -366,7 +366,9 @@
 {     struct COG *cog = NULL;
       int m, n, nb, i, j, p, q, len, *ind, *vert, *orig;
       double L, U, lf_min, lf_max, *val;
-      xprintf("Creating the conflict graph...\n");
+      int msg_level = lpx_get_int_parm(lp, LPX_K_MSGLEV);
+      if (msg_level >= GLP_MSG_ON)
+         xprintf("Creating the conflict graph...\n");
       m = lpx_get_num_rows(lp);
       n = lpx_get_num_cols(lp);
       /* determine which binary variables should be included in the
@@ -405,7 +407,9 @@
       /* if the graph is either empty or has too many vertices, do not
          create it */
       if (nb == 0 || nb > MAX_NB)
-      {  xprintf("The conflict graph is either empty or too big\n");
+      {  
+         if (msg_level >= GLP_MSG_ON)
+            xprintf("The conflict graph is either empty or too big\n");
          xfree(vert);
          xfree(orig);
          goto done;
@@ -473,8 +477,9 @@
             }
          }
       }
-      xprintf("The conflict graph has 2*%d vertices and %d edges\n",
-         cog->nb, cog->ne);
+      if (msg_level >= GLP_MSG_ON)
+         xprintf("The conflict graph has 2*%d vertices and %d edges\n",
+            cog->nb, cog->ne);
 done: xfree(ind);
       xfree(val);
       return cog;
@@ -643,7 +648,7 @@
       return;
 }
 
-static int wclique(int _n, int w[], unsigned char _a[], int sol[])
+static int wclique(LPX *lp, int _n, int w[], unsigned char _a[], int sol[])
 {     struct dsa _dsa, *dsa = &_dsa;
       int i, j, p, max_wt, max_nwt, wth, *used, *nwt, *pos;
       xlong_t timer;
@@ -697,7 +702,9 @@
          if (xdifftime(xtime(), timer) >= 5.0 - 0.001)
 #endif
          {  /* print current record and reset timer */
-            xprintf("level = %d (%d); best = %d\n", i+1, n, record);
+            int msg_level = lpx_get_int_parm(lp, LPX_K_MSGLEV);
+            if (msg_level >= GLP_MSG_ON)
+               xprintf("level = %d (%d); best = %d\n", i+1, n, record);
 #if 0
             timer = utime();
 #else
@@ -772,7 +779,7 @@
          w[cog->nb + t] = 100 - temp;
       }
       /* find a clique of maximum weight */
-      card = wclique(2 * cog->nb, w, cog->a, sol);
+      card = wclique(lp, 2 * cog->nb, w, cog->a, sol);
       /* compute the clique weight for unscaled values */
       sum = 0.0;
       for ( t = 1; t <= card; t++)

-- 
View this message in context: 
http://www.nabble.com/GLP_MSG_OFF-ignored-tp21122577p21122577.html
Sent from the Gnu - GLPK - Bugs mailing list archive at Nabble.com.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]