help-glpk
[Top][All Lists]
Advanced

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

glpsol: Adding tol_bnd, tol_dj, tol_piv options


From: Hartmut Henkel
Subject: glpsol: Adding tol_bnd, tol_dj, tol_piv options
Date: Sun, 4 Jul 2021 11:39:07 +0200 (CEST)

Hi Andrew,

when using glpsol for optimization of a row- and column-dense problem
written in GNU MathProg, the default tolerances preset in glpsol are not
sufficient for finding the optimum. But, when using the C API with
setting lower/tighter tolerances (e. g. factor 1e-4) in the smcp
structure, the maximum is found.

These three tolerance options are currently missing in glpsol, and it
would be nice to have them included. They also let solve the problem
above. I would be glad if you could apply the two trivial patches below
to the sources.

Best Regards, Hartmut

Hartmut Henkel, Zellhausen, Germany


--- orig/examples/glpsol.c      2021-07-04 10:57:19.718164980 +0200
+++ glpsol.c    2021-07-03 12:32:22.216853938 +0200
@@ -331,6 +331,11 @@
          "fault)\n");
       xprintf("   --norelax         use standard \"textbook\" ratio tes"
          "t\n");
+#if 1 /* 2021-07-03 */
+      xprintf("   --tolbnd tol      set tol_bnd tolerance to tol\n");
+      xprintf("   --toldj tol       set tol_dj tolerance to tol\n");
+      xprintf("   --tolpiv tol      set tol_piv tolerance to tol\n");
+#endif
 #if 0 /* 23/VI-2017 */
 #if 1 /* 28/III-2016 */
       xprintf("   --flip            use flip-flop ratio test (assumes -"
@@ -787,6 +792,50 @@
             csa->smcp.r_test = GLP_RT_HAR;
          else if (p("--norelax"))
             csa->smcp.r_test = GLP_RT_STD;
+#if 1 /* 2021-07-03 */
+         else if (p("--tolbnd"))
+         {  double tol_bnd;
+            k++;
+            if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-')
+            {  xprintf("No tol_bnd tolerance specified\n");
+               return 1;
+            }
+            if (str2num(argv[k], &tol_bnd) || tol_bnd < 0.0)
+            {  xprintf("Invalid tol_bnd tolerance '%s'\n",
+                  argv[k]);
+               return 1;
+            }
+            csa->smcp.tol_bnd = tol_bnd;
+         }
+         else if (p("--toldj"))
+         {  double tol_dj;
+            k++;
+            if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-')
+            {  xprintf("No tol_dj tolerance specified\n");
+               return 1;
+            }
+            if (str2num(argv[k], &tol_dj) || tol_dj < 0.0)
+            {  xprintf("Invalid tol_dj tolerance '%s'\n",
+                  argv[k]);
+               return 1;
+            }
+            csa->smcp.tol_dj = tol_dj;
+         }
+         else if (p("--tolpiv"))
+         {  double tol_piv;
+            k++;
+            if (k == argc || argv[k][0] == '\0' || argv[k][0] == '-')
+            {  xprintf("No tol_piv tolerance specified\n");
+               return 1;
+            }
+            if (str2num(argv[k], &tol_piv) || tol_piv < 0.0)
+            {  xprintf("Invalid tol_piv tolerance '%s'\n",
+                  argv[k]);
+               return 1;
+            }
+            csa->smcp.tol_piv = tol_piv;
+         }
+#endif
 #if 1 /* 28/III-2016 */
          else if (p("--flip"))
 #if 0 /* 23/VI-2017 */


--- orig/doc/glpk10.tex 2021-07-04 11:08:45.443664879 +0200
+++ glpk10.tex  2021-07-04 11:10:26.475813095 +0200
@@ -91,6 +91,9 @@
    --nosteep         use standard "textbook" pricing
    --relax           use Harris' two-pass ratio test (default)
    --norelax         use standard "textbook" ratio test
+   --tolbnd tol      set tol_bnd tolerance to tol
+   --toldj tol       set tol_dj tolerance to tol
+   --tolpiv tol      set tol_piv tolerance to tol
    --presol          use presolver (default; assumes --scale and --adv)
    --nopresol        do not use presolver
    --exact           use simplex method based on exact arithmetic



reply via email to

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