help-glpk
[Top][All Lists]
Advanced

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

[Help-glpk] Same lp different results...


From: Stefan Herbergs
Subject: [Help-glpk] Same lp different results...
Date: Thu, 05 Feb 2004 13:49:45 +0100

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

Attachment: second.lpt
Description: Binary data

Attachment: third.lpt
Description: Binary data

Attachment: first.lpt
Description: Binary data


reply via email to

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