help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Some questions...


From: Andrew Makhorin
Subject: Re: [Help-glpk] Some questions...
Date: Wed, 10 Oct 2001 03:21:52 +0300

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

Yes, you can do that as follows:

   parameters AAA, AAB, ABA, ABC, MAXD;
   AAA := 1; AAB := 2; ABA := 1; ABC := 1; MAXD := 5;

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

No, names should not exceed 31 chars. However, if some variables or
constraints in your problem are structured, you can organize arrays of
such objects over sets. For example:

   set week = (Mon, Tue, Wed, Thu);
   variable level[week];

In this case composite names (like level[Mon], level[Tue], etc.) may
have length up to 255 chars. See the GLPK/L description for details.

Btw, if you do generate the model description, I advise you to use
glpk api routines. This is the best way if your problem is produced by
a computer program (and, in particular, this'd allow using symbolic
names up to 255 chars.)

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

If some variables have simple lower and/or upper bounds, it's better
to specify the bounds explicitly like follows:

   x.lo := <lower bound>;
   x.up := <upper bound>;

where x is a variable. This allows reducing the number of constraints.

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

If the solution satisfies to your requirements, this is normal. But
sometimes using less trivial objective function (for example, the sum
of some variables) allows solving a problem faster. You also should
not forget that a system of inequations may have different feasible
solutions, and using the objective function could help to find a more
appropriate one.

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

At your discretion ;+)






reply via email to

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