|
From: | Anett Ehlert |
Subject: | [Help-glpk] Integer solution required |
Date: | Tue, 27 Jan 2004 11:53:58 +0000 |
I'm trying to solve a problem of the following form:
- non-zero constraint coefficients are either 1.0 or -1.0
- artificial variables have an upper bound (0.0) apart from one constraint with an upper bound > 0, but of integer value
- coefficients in the objective function are >=0 for all structural variables
- obj. direction: Max
- all structural variables are double bounded (0.0, 1.0)
As a result of this formulation the structural variables should become 0 or 1, at least that was what I expected.
First I used the simplex method (pure LP):
1. lp = lpx_create_prob();
2. lpx_add_rows(lp, M);
...read rows
3. lpx_add_cols(lp, N);
...read cols
4. lpx_load_mat3(lp, nz, rn, cn, a)
5. lpx_simplex(lp);
6. lpx_get_obj_val(lp);
7. lpx_get_col_info
which worked well for small problems, but resulted in non-integer values as the problem becomes bigger (e.g. number of constraints about 400, which is only a medium sized problem).
Then I tried lpx_integer (after step 5 with class MIP) which gives the result "Integer solution found", but still some of the variables are non-integer. Is there a way to obtain 1s and 0s for all structural variables? (I'm using MSVC++.Net)
Any suggestions, please?
Sorry for the lengthy explanation.
Many thanks in advance.
Anett
[Prev in Thread] | Current Thread | [Next in Thread] |