help-glpk
[Top][All Lists]
Advanced

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

Re: [Help-glpk] Tell glpk not to use some variables


From: Andrew Makhorin
Subject: Re: [Help-glpk] Tell glpk not to use some variables
Date: Sat, 30 Aug 2008 08:50:15 +0400

> How do I tell GLPK by API to not use a few variables, lets say that
> I dont want that the variables Y appear at the Minimize at the top of
> the problem file. like this.

> *** OBJECTIVE FUNCTION ***

> Minimize: OBJF
>                      7 x[0,1]
>                     12 x[0,2]
>                     17 x[0,3]
>                      7 x[0,4]
>                      5 x[1,1]
>                      9 x[1,2]
>                     14 x[1,3]
>                      7 x[1,4]
>                      3 x[2,1]
>                      7 x[2,2]
>                     12 x[2,3]
>                      8 x[2,4]
>                      2 x[3,1]
>                      5 x[3,2]
>                     10 x[3,3]
>                      9 x[3,4]
>                      1 Y1
>                     -1 Y2
>                      1 Y3
>                     -1 Y4
> *** ROWS (CONSTRAINTS) ***
> Row 1: APPLE1 = 1
>                      7 x[0,4]
>                     17 x[0,3]
>                     12 x[0,2]
>                      7 x[0,1]


> This is part of the output fo glpk when I use the function
> lpx_print_prob(lp);

> And the variables Y that appear at Minimize I do not want them to
> appear there. Is there a way?

Y's appear in the objective function because you specified non-zero
objective coefficients for them. To change objective coefficients use
the api routine glp_set_obj_coef. For more details please see the
reference manual.

BTW, you could use glp_write_lp(lp, NULL, "filename") rather than
lpx_print_prob; its output is more readable.





reply via email to

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