[Help-glpk] LPX_E_SING Error on 64bit Platform

2010-05-07 Thread Volkan YAZICI
Hi,

While trying to solve attached ILP problem as below:

  int
  main(void)
  {
  glp_prob *lp;
  
  lp = glp_create_prob();
  assert(!glp_read_lp(lp, NULL, repl-ilp-xXNtiz));
  
  assert(!glp_simplex(lp, NULL)  glp_get_status(lp) == GLP_OPT);
  lpx_set_int_parm(lp, LPX_K_USECUTS, LPX_C_ALL);
  lpx_set_real_parm(lp, LPX_K_TMLIM, 1);
  lpx_adv_basis(lp);
  {
  int ret = lpx_intopt(lp);
  assert(ret == LPX_E_OK || ret == LPX_E_TMLIM);
  }
  
  return 0;
  }

The final assertion fails with ret set to 211 (LPX_E_SING). Below is
the program output:

  glp_read_lp: reading problem data from `repl-ilp-xXNtiz'...
  glp_read_lp: 101 rows, 166 columns, 531 non-zeros
  glp_read_lp: 166 integer columns, all of which are binary
  glp_read_lp: 272 lines were read
  * 0:   objval =   0.0e+00   infeas =   0.0e+00 (0)
  *   124:   objval =   3.702857143e+01   infeas =   8.881784197e-16 (0)
  OPTIMAL SOLUTION FOUND
  lpx_adv_basis: size of triangular part = 101
  ipp_basic_tech:  0 row(s) and 0 column(s) removed
  ipp_reduce_bnds: 1 pass(es) made, 0 bound(s) reduced
  ipp_basic_tech:  0 row(s) and 0 column(s) removed
  ipp_reduce_coef: 1 pass(es) made, 0 coefficient(s) reduced
  lpx_intopt: presolved MIP has 101 rows, 166 columns, 531 non-zeros
  lpx_intopt: 166 integer columns, all of which are binary
  lpx_adv_basis: size of triangular part = 101
  Solving LP relaxation...
  *   124:   objval =   0.0e+00   infeas =   0.0e+00 (0)
  *   134:   objval =   3.702857143e+01   infeas =   0.0e+00 (0)
  OPTIMAL SOLUTION FOUND
  Creating the conflict graph...
  The conflict graph has 2*166 vertices and 535 edges
  Generating cutting planes...
 134: obj =   3.702857143e+01   frac =33   cuts = 0 (0)
 331: obj =   2.8e+01   frac =18   cuts =81 (162)
  81 mixed cover cut(s) added
  Integer optimization begins...
  +   331: mip = not found yet =  +inf(1; 0)
  Gomory's cuts enabled
  MIR cuts enabled
  +   394:2.7e+01 =   2.8e+01   3.7% (4; 0)
  spx_invert: the basis matrix is singular
  spx_simplex: numerical problems with basis matrix
  spx_simplex: sorry, basis recovery procedure not implemented yet
  ios_driver: unable to solve current LP relaxation; glp_simplex returned 5
  +  1719: mip =   2.7e+01 =   2.8e+01   3.7% (83; 31)
  glp_intopt: cannot solve current LP relaxation
  repl-k: src/ilp.c:153: solve_ilp: Assertion `ret == 200' failed.

The strange thing is, while above codes works perfectly on my notebook
(32bit), it fails to run on a remote server (64bit). Below are system
specifications of both machines.

  REMOTE-SERVER
  -
  $ gcc -v
  Using built-in specs.
  Target: x86_64-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' 
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-objc-gc --enable-mpfr --enable-cld --enable-checking=release 
--build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
  Thread model: posix
  gcc version 4.3.2 (Debian 4.3.2-1.1)
  $ glpsol -v
  GLPSOL: GLPK LP/MIP Solver 4.29

  NOTEBOOK
  
  $ gcc -v
  Using built-in specs.
  Target: i486-linux-gnu
  Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1.1' 
--with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs 
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared 
--with-system-zlib --libexecdir=/usr/lib --without-included-gettext 
--enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 
--program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug 
--enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld 
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu 
--target=i486-linux-gnu
  Thread model: posix
  gcc version 4.3.2 (Debian 4.3.2-1.1)
  You have new mail in /var/mail/vy
  $ glpsol -v
  GLPSOL: GLPK LP/MIP Solver 4.29

What might I be missing? Any ideas?


Regards.



repl-ilp-xXNtiz
Description: Binary data
___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


[Help-glpk] Rounding Problem

2010-04-28 Thread Volkan YAZICI
Hi,

I get below solutions

  (gdb) p glp_get_col_val(lp, 'n', 7)
  $4 = 0
  (gdb) p glp_get_col_val(lp, 'c', 0)
  $5 = 1
  (gdb) p glp_get_col_val(lp, 'c', 1)
  $6 = 1
  (gdb) p glp_get_col_val(lp, 'c', 2)
  $7 = 1
  (gdb) p glp_get_col_val(lp, 'c', 4)
  $8 = 1.0002

for the following constraint.

  n7 - c0 - c1 - c2 - c4 = -4

n7 should be greater than 0, but because of rounding errors it passes
the constraint check.

  (gdb) p (0 - 1 - 1 - 1 - 1.0002) = -4
  1

What's the recommended way of solving such problems? I looked at ml
archives and found out that people use glp_scale_prob() method. But for
my particular case -- where I just check if (nx == 0.0) and if (cx ==
1.0) -- I couldn't figure out which option to use with glp_scale_prob()
method. Any ideas?


Regards.


___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk


Re: [Help-glpk] glp_get_col_prim() problem

2010-04-22 Thread Volkan YAZICI
Hi,

On Thu, 22 Apr 2010, Andrew Makhorin m...@gnu.org writes:
 Most likely your instance has multiple optima, so your program finds
 one optimal solution while glpsol finds another. As you can see the
 optimal objective value is the same in both cases.

 Note that to solve mip you need to call glp_simplex (to find optimal
 solution to lp relaxation) and *then* call glp_intopt (to find integer
 optimal solution), in which case the column values should be obtained
 with glp_mip_col_val, not with glp_get_col_prim. It happened that for
 your particular instance optimal solution to lp relaxation is integer
 feasible and therefore integer optimal; however, in a general case
 glp_intopt should be used. For details please see the glpk reference
 manual.

I incorporated glp_mip_col_val() and glp_intopt() into the code, and it
works like a charm. OTOH, please excuse my ignorance, but assuming all
my variables are marked as binary in CPLEX LP file, do I really need to
call glp_intopt() after glp_simplex() even if glp_get_status(lp) ==
GLP_OPT assertion holds?


Regards.


___
Help-glpk mailing list
Help-glpk@gnu.org
http://lists.gnu.org/mailman/listinfo/help-glpk