Alan,

the following should work:

printf{i in Trainer, j4 in Course4, j5 in Course5, j6 in Course6: x4[i,j4] + x5[i,j5] + x6[i,j6] = 0} ...

Regards

Oscar

Andrew Makhorin skrev 2011-02-19 22:26:
-------- Forwarded Message --------
From: Alan Zinober<[email protected]>
To: [email protected]
Subject: GLPK printing with if and iterative loop
Date: Sat, 19 Feb 2011 17:27:04 +0000

I need to print the Trainer names only when

       x4[i,j4] + x5[i,j5] + x6[i,j6] = 0

I declare:

set Trainer;           different trainer names

set Course4;         different course names
set Course5;         different course names
set Course6;         different course names

var x4{Trainer, Course4}>=0, binary;
var x5{Trainer, Course5}>=0, binary;
var x6{Trainer, Course6}>=0, binary;


Essentially I need a print statement with the logic of the code below
but do not know how to set up
j4 iterated on Course 4, j5 iterated on Course5, j6 iterated on Course6 :

for {i in Trainer}

       printf (if x4[i,j4 iterated on Course4] + x5[i,j5 iterated on
Course 5]
                            + x6[i,j6 iterated on Course6] =0 then  "%s
"),Trainer[i];

       Alan





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


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

Reply via email to