help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Print names of all rows after presolve?


From: Andrew Makhorin
Subject: Re: [Help-glpk] Print names of all rows after presolve?
Date: Sat, 21 Jun 2008 10:51:28 +0400

> I am debugging the code I plan to use to generate cplex-format
> input files.  I am comparing my generated files to my "gold standard"
> which is a MathProg model.  I provide the MathProg model to glpsol and
> write out a cplex translation to compare against my directly-generated
> cplex file.  I am at the point where I can't do much more debugging
> through text-parsing tools (sed, awk, etc.).  I would love to see a
> list of row names that glpk finds after the presolve.  Here is why:

> Output from my directly generated cplex file:

> ...
> lpx_read_cpxlp: 504148 rows, 299500 columns, 1096954 non-zeros
> lpx_read_cpxlp: 299500 integer columns, all of which are binary
> lpx_read_cpxlp: 1128550 lines were read
> glp_simplex: original LP has 504148 rows, 299500 columns, 1096954 non-zeros
> glp_simplex: presolved LP has 504148 rows, 299500 columns, 1096954 non-zeros
> lpx_adv_basis: size of triangular part = 504148
>       0:   objval =   0.000000000e+00   infeas =   1.000000000e+00 (0)
> ...


> And here is the output from my reference model:

> ...
> lpx_read_cpxlp: 547545 rows, 302843 columns, 1418415 non-zeros
> lpx_read_cpxlp: 302843 integer columns, all of which are binary
> lpx_read_cpxlp: 1851799 lines were read
> glp_simplex: original LP has 547545 rows, 302843 columns, 1418415 non-zeros
> glp_simplex: presolved LP has 504162 rows, 299500 columns, 1097272 non-zeros
> lpx_adv_basis: size of triangular part = 504162
>       0:   objval =   0.000000000e+00   infeas =   1.000000000e+00 (0)
> ...


> So for my directly generated model I am trying to do my own
> "presolving" (in a sense) by avoiding generation of trivial
> rows/cols.  You can see that I am producing 14 too few rows (504162 -
> 504148) in my directly generated cplex file.  Oh, how I'd love to know
> the names of those rows.  Any thoughts on how to tease those out?  I
> am fine using the API.  It seems that the presolver is too much of a
> "black box" to get at via the API?  Ideally before the phase I simplex
> takes over but after the presolver, I'd like to dump that column name
> info.  Will I have to hack into the source to do this?  Any
> suggestions appreciated.  I can provide more info if it's helpful.

The lp presolver keeps all necessary information in the structure
LPP declared in glplpp.h. In the resultant problem segment of the
structure there is array row_ref, and row_ref[i'] = i is the reference
number i of a row assigned to i'-th row of presolved lp. If i is in the
range 1 to m, where m is the number of rows in the original lp, i-th
original row corresponds to i'-th row in the presolved lp.

You can insert appropriate printing in internal routine simplex2
(file glpapi06.c) immediately before lines 579-580 as follows:

+     {  int i, ii;
+        for (ii = 1; ii <= lpp->m; ii++)
+        {  i = lpp->row_ref[ii];
+           if (i <= glp_get_num_rows(orig))
+              printf("i = %d; name = %s\n",
+                 i, glp_get_row_name(orig, i));
+        }
+     }
579   /* build resultant LP problem object */
580   prob = lpp_build_prob(lpp);






reply via email to

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