bug-glpk
[Top][All Lists]
Advanced

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

glp_interior() failing with GLP_EFAIL on trivial but non-empty original


From: Stéphane Soppera
Subject: glp_interior() failing with GLP_EFAIL on trivial but non-empty original problem.
Date: Mon, 24 Jan 2022 21:35:25 +0100

Hi,

I noticed that with a simple non-empty problem, glp_interior() can return GLP_EFAIL. For example:
  glp_prob* const prob = glp_create_prob();

  const int x = 1;
  glp_add_cols(prob, 1);
  glp_set_col_name(prob, x, "x");
  glp_set_col_bnds(prob, x, GLP_FX, 0.0, 0.0);

  glp_set_obj_coef(prob, x, 2.0);
  glp_set_obj_coef(prob, 0, 4.0);
  glp_set_obj_dir(prob, GLP_MAX);

  glp_iptcp parameters;
  glp_init_iptcp(&parameters);
  parameters.msg_lev = GLP_MSG_ALL;

  const int rc = glp_interior(prob, &parameters);
  switch (rc) {
    case 0:
      printf("glp_interior() succeeded\n");
      break;
    case GLP_EFAIL:
      printf("glp_interior() failed with GLP_EFAIL\n");
      break;
    default:
      printf("glp_interior() failed with %d\n", rc);
      break;
  }

  glp_delete_prob(prob);

The logs explains why I think:
> Original LP has 0 row(s), 1 column(s), and 0 non-zero(s)
> Working LP has 0 row(s), 0 column(s), and 0 non-zero(s)
> glp_interior: unable to solve empty problem
> glp_interior() failed with GLP_EFAIL

If the problem is changed to something less trivial by changing the bounds:
  glp_set_col_bnds(prob, x, GLP_DB, -1.0, 2.0);

Then glp_interior() does not fail:
> Original LP has 0 row(s), 1 column(s), and 0 non-zero(s)
> Working LP has 1 row(s), 2 column(s), and 2 non-zero(s)
> Matrix A has 2 non-zeros
> Matrix S = A*A' has 1 non-zeros (upper triangle)
> Approximate minimum degree ordering (AMD)...
> Computing Cholesky factorization S = L*L'...
> Matrix L has 1 non-zeros
> Guessing initial point...
> Optimization begins...
>   0: obj =  -1.100000000e+01; rpi =  1.5e+00; rdi =  1.1e+00; gap =  6.0e-01
>   1: obj =  -7.120987654e+00; rpi =  1.5e-01; rdi =  1.1e-01; gap =  2.3e-01
>   2: obj =  -7.863749904e+00; rpi =  1.5e-02; rdi =  1.5e-02; gap =  2.3e-02
>   3: obj =  -7.986378558e+00; rpi =  1.5e-03; rdi =  1.5e-03; gap =  2.2e-03
>   4: obj =  -7.998637862e+00; rpi =  1.5e-04; rdi =  1.5e-04; gap =  2.2e-04
>   5: obj =  -7.999863786e+00; rpi =  1.5e-05; rdi =  1.5e-05; gap =  2.2e-05
>   6: obj =  -7.999986379e+00; rpi =  1.5e-06; rdi =  1.5e-06; gap =  2.2e-06
>   7: obj =  -7.999998638e+00; rpi =  1.5e-07; rdi =  1.5e-07; gap =  2.2e-07
>   8: obj =  -7.999999864e+00; rpi =  1.5e-08; rdi =  1.5e-08; gap =  2.2e-08
>   9: obj =  -7.999999986e+00; rpi =  1.5e-09; rdi =  1.5e-09; gap =  2.2e-09
> OPTIMAL SOLUTION FOUND
> glp_interior() succeeded

Is this a bug though? Or is this intended?
The documentation of glp_interior() only mentions:
> GLP_EFAIL The problem has no rows/columns.
but this is not the original problem that has no rows/columns here, but the pre-processed one.

Thanks,
--
Stéphane SOPPERA

reply via email to

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