[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-glpk] row deletion bug
From: |
Balazs DEZSO |
Subject: |
[Bug-glpk] row deletion bug |
Date: |
Wed, 14 Feb 2007 16:19:27 +0300 |
Dear GLPK Developers,
The row and column deletion does not work properly. The attached example shows
that the second solution could not be calculated with glpk. I debugged the
library and I found out that the row and the col "stat"s was not reset (so
the stat stayed LPX_BS) when I erase a row or col from the problem. And in
the next lpx_warm_up one more or less basis will be in the matrix and it will
cause a failure in the library. Proper solution could be the resetting the
stats by the row/col type or the proper decreasing of the initial basis.
Best, Balazs
#include <stdio.h>
#include <stdlib.h>
#include <glpk.h>
#define NI 0
#define NV 0.0
#define NC 6
int ia[] = { NI,
1, 1,
2, 2,
3, 3
};
int ja[] = { NI,
1, 2,
1, 2,
1, 2
};
double va[] = { NV,
2, 1,
1, 2,
2, 2
};
double rub[] = { NV,
3,
3,
2
};
int rea[] = { NV, 3 };
int main() {
LPX* lp;
lp = lpx_create_prob();
lpx_add_cols(lp, 2);
lpx_set_col_bnds(lp, 1, LPX_LO, 0.0, NV);
lpx_set_col_bnds(lp, 2, LPX_LO, 0.0, NV);
lpx_set_col_name(lp, 1, "x1");
lpx_set_col_name(lp, 2, "x2");
lpx_set_col_bnds(lp, 1, LPX_LO, 0.0, NV);
lpx_set_col_bnds(lp, 2, LPX_LO, 0.0, NV);
lpx_set_obj_coef(lp, 1, 1.0);
lpx_set_obj_coef(lp, 2, 1.0);
lpx_set_obj_dir(lp, LPX_MAX);
lpx_add_rows(lp, 3);
lpx_set_row_bnds(lp, 1, LPX_UP, NV, rub[1]);
lpx_set_row_bnds(lp, 2, LPX_UP, NV, rub[2]);
lpx_set_row_bnds(lp, 3, LPX_UP, NV, rub[3]);
lpx_load_matrix(lp, NC, ia, ja, va);
lpx_simplex(lp);
lpx_print_prob(lp, "prob1");
lpx_print_sol(lp, "sol1");
lpx_del_rows(lp, 1, rea);
lpx_simplex(lp);
lpx_print_prob(lp, "prob2");
lpx_print_sol(lp, "sol2");
lpx_delete_prob(lp);
return 0;
}
glpk_test.c
Description: Text Data
- [Bug-glpk] row deletion bug,
Balazs DEZSO <=