help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Re: Simplex method infeasible, IP method feasible


From: Andrew Makhorin
Subject: [Help-glpk] Re: Simplex method infeasible, IP method feasible
Date: Thu, 11 Sep 2003 23:46:21 +0400

>>
>> Why infeasible? I tried your example with both simplex and interior.
>> Here are the results below.
> 
> Ok, but If you check the constraints, A*xmin -b <= 0, you'll find that
> some constraints are violated:

Please pull the model from my previous message, name it infeas.mod,
and run the following program:

------------------------------------------------------------------------
#include <stdlib.h>
#include "glpk.h"

int main(void)
{     LPX *lp; int j; double x[1+3];
      lp = lpx_read_model("infeas.mod", NULL, NULL);
      insist(lp != NULL);
      insist(lpx_get_num_cols(lp) == 3);
      lpx_simplex(lp);
      for (j = 1; j <= 3; j++)
      {  lpx_get_col_info(lp, j, NULL, &x[j], NULL);
         print("x[%d] = %22.15e", j, x[j]);
      }
      print("a[1] * x - b[1] = %22.15e",
         -1*x[1] + 1*x[2] + 1*x[3] - 0);
      print("a[2] * x - b[2] = %22.15e",
         1*x[1] + 0*x[2] + 0*x[3] - 68.855);
      print("a[3] * x - b[3] = %22.15e",
         0*x[1] -0.22252*x[2] + 0.97493*x[3] - 39.483);
      print("a[4] * x - b[4] = %22.15e",
         0*x[1] -0.90097*x[2] + 0.43388*x[3] - 5.2338);
      print("a[5] * x - b[5] = %22.15e",
         0*x[1] -0.90097*x[2] -0.43388*x[3] - (-73.042));
      print("a[6] * x - b[6] = %22.15e",
         0*x[1] + 0.62349*x[2] -0.78183*x[3] - 76.044);
      lpx_delete_prob(lp);
      return 0;
}
------------------------------------------------------------------------

You will see the following:

Reading model section from infeas.mod...
Reading data section from infeas.mod...
31 lines were read
Generating Z...
Generating row...
Model has been successfully generated
      0:   objval =  -1.000000000e+06   infeas =   1.000000000e+00 (0)
      4:   objval =   6.885450326e+01   infeas =   0.000000000e+00 (0)
OPTIMAL SOLUTION FOUND
x[1] =  6.885450325591295e+01
x[2] =  9.241775273999546e+01
x[3] = -2.356324948408252e+01
a[1] * x - b[1] =  0.000000000000000e+00
a[2] * x - b[2] = -4.967440870586870e-04
a[3] * x - b[3] = -8.302031715922035e+01
a[4] * x - b[4] = -9.872304537230744e+01
a[5] * x - b[5] =  6.765421556309548e-15
a[6] * x - b[6] =  1.025568518997488e-14


Best regards,

Andrew Makhorin






reply via email to

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