[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AW: [Help-glpk] Same lp different results...
From: |
Stefan Herbergs |
Subject: |
AW: [Help-glpk] Same lp different results... |
Date: |
Thu, 05 Feb 2004 17:39:31 +0100 |
I found out something about my earlier problem.
I tried using the presolver, and the problem disapeared. Now all systems are
returning the right target function value.
Although this is better than before, I need to know what the problem was in
the first place, just to make sure it doesn't come back. So if you have any
ideas please help me...
Thank you
Stefan
> Quote:
Hello everyone,
I have got avery strange problem. I have to solve many similar lp systems
within a c++ program. Now I have three systems and the third is exactly the
same as the first one. The problem is, the first is solvable with an
optimium of zero. The third one says:
spx_invert: trying to factorize the basis using threshold tolerance 0.3
spx_invert: trying to factorize the basis using threshold tolerance 0.7
spx_invert: the basis matrix is singular
lpx_simplex: initial basis is singular
lpx_integer: optimal solution of LP relaxation required
lpx_write_lpt: writing problem data to `third.lpt'...
I appended the three systems as an lpt output to this mail so you can have a
look at it. If I give them to glpsol. The first.lpt and third.lpt both work
and have 0 as optimium.
Actually I am using the same LPX object to store the three systems in. What
I do is basically:
m_lp = lpx_create_prob();
lpx_set_class(m_lp, LPX_MIP);
lpx_set_prob_name(m_lp, "aName");
lpx_set_int_parm(m_lp, LPX_K_MSGLEV, 3);
//...
lpx_add_cols(m_lp,m_iNumberOfColumns);
lpx_add_rows(m_lp,m_iNumberOfRows);
//...
for(a_couple_of_times)
{
lpx_set_col_name(m_lp,iCol, "ColName");
lpx_set_col_bnds(m_lp,iCol,LPX_DB,0,1);
lpx_set_col_kind(m_lp,iCol,LPX_CV); // or Integer
lpx_mark_col(m_lp, iCol, 1);
}
//...
for(a_couple_of_times)
{
lpx_set_row_name(m_lp,m_iRowCounter,"RowName");
lpx_set_row_bnds(m_lp,m_iRowCounter,LPX_FX,A_dBound,A_dBound);
}
//...
lpx_load_mat3(m_lp, m_iMatrixCounter, m_rn, m_cn, m_a);
//...
lpx_simplex(m_lp);
lpx_integer(m_lp);
//...
lpx_write_lpt(m_lp, "first.lpt");
//...
lpx_clear_mat(m_lp);
//...
// Change some coefficients here and put them in m_rn, m_cn and m_a
//...
lpx_load_mat3(m_lp, m_iMatrixCounter, m_rn, m_cn, m_a);
//...
for(a_couple_of_times)
{
lpx_get_row_bnds(m_lp,iRow,&typx, &lb, &ub);
lpx_set_row_bnds(m_lp,iRow,typx,dBound,dBound);
}
//...
lpx_simplex(m_lp);
lpx_integer(m_lp);
//...
lpx_write_lpt(m_lp, "second.lpt");
//...
lpx_clear_mat(m_lp);
//...
// Change some coefficients here and put them in m_rn, m_cn and m_a
//...
lpx_load_mat3(m_lp, m_iMatrixCounter, m_rn, m_cn, m_a);
//...
for(a_couple_of_times)
{
lpx_get_row_bnds(m_lp,iRow,&typx, &lb, &ub);
lpx_set_row_bnds(m_lp,iRow,typx,dBound,dBound);
}
//...
lpx_simplex(m_lp);
lpx_integer(m_lp);
//...
lpx_write_lpt(m_lp, "third.lpt");
//...
Do you have an idea why the first system is working and the third not???
Have I forgotten something???
I am using glpk under windows and cygwin. I compiled the 4.2 sources with
gcc 3.3.1 from cygwin. I linked glpk with a c interface to my c++ programm.
Thank you very much
Stefan