help-glpk
[Top][All Lists]

## [Help-glpk] Some questions...

 From: Falk Hueffner Subject: [Help-glpk] Some questions... Date: 10 Oct 2001 00:08:54 +0200 User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.5 (anise)

```Hi,

a while ago I asked about using glpk to solve integer inequations, and
it actually works :) Now I have a few questions...  I wrote a script
to generate the problem corresponding to some input.  Its output looks
like this:

#define AAA 1
#define AAB 2
#define ABA 1
#define ABC 1
#define MAXD 5

model CS;

integer variables
DUMMY, AAA_A, AAB_A, AAB_B, ABA_A, ABA_B, ABC_A, ABC_B, ABC_C;

constraints
D0, D1, D2,
E0, E1, E2, E3, E4, E5, E6, E7,
S0, S1, S2, S3,
Z;

D0 := + AAB_B + ABA_B + ABC_B + ABC_C <= MAXD;
D1 := + AAB_B + ABA_A + ABC_A + ABC_C <= MAXD;
D2 := + AAB_A + ABA_B + ABC_A + ABC_B <= MAXD;

E0 := AAA_A >= 0;
E1 := AAB_A >= 0;
E2 := AAB_B >= 0;
E3 := ABA_A >= 0;
E4 := ABA_B >= 0;
E5 := ABC_A >= 0;
E6 := ABC_B >= 0;
E7 := ABC_C >= 0;

S0 := + AAA_A = AAA;
S1 := + AAB_A + AAB_B = AAB;
S2 := + ABA_A + ABA_B = ABA;
S3 := + ABC_A + ABC_B + ABC_C = ABC;

Z := DUMMY = 0;

minimize Z;

end;

Some questions:

* I use cpp to define some constants.  Can I do this with glpk
language constructs?

* The generated variable names can get very long and hit a limit (32
or so).  Would it be easy to remove this limit?

* I introduce a lot of variables (E_x) just to state all variables
have to be positive.  Is there a better way?

* Also, is there a better way than this "DUMMY" to express I don't
really want to optimize anything?

Falk

PS: Thanks a lot for this great software.  With it, we can solve much
larger problems than with our prior approaches.

PPS: If there is any interest, I could try to make a Debian package of
glpk.

```