> I #8217;m trying to figure out a way to calculate variables
> in my .mod file. 

> For example, say I have
> Var x
> Var y
> Param a
> Param b

> Max: a*x + b*y

> I want to replace this with something like

> Var x
> Var y
> Param a
> Param b
> Var x_a = x*a
> Var y_b = y*b

> Max: x_a + y_b.

> The reason for this is so that I have x_a and y_b showing up
> in my output. 

You may either introduce additional variables and corresponding
equality constraints:

var x_a;
var x_b;
s.t. foo: x_a = x * a;
s.t. bar: x_b = x * b;

Or, that is better, use the printf statement:

...
solve; /* <- this statement should be specified */
printf "x * a = %g; x * b = %g\n", x * a, x * b;
...


_______________________________________________
Help-glpk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-glpk

Reply via email to