help-glpk
[Top][All Lists]

## [Help-glpk] (no subject)

 From: Antonio Carlos Moretti Subject: [Help-glpk] (no subject) Date: Tue, 18 Jun 2013 17:27:29 -0300 (BRT) User-agent: SquirrelMail/1.4.8

```Hi,

I am trying to put a condition in an index of a summation:

minimize z: sum{i in I: i < 2, j in J[i], k in K[i,j], t in T} x[i,j,k,t];

the condition is that I want i = 1 only teh set I is defined as
I = { 1 2 3 4 5 6}

the compiler says: sintax error indexing expression.

I do not know what I am doing wrong.

The whole code is below:

set I;
set J{i in I};
set K{i in I,j in J[i]};
set T;
set C;
var x{i in I, j in J[i], k in K[i,j], t in T} >= 0;
minimize z: sum{i in I: i < 2, j in J[i], k in K[i,j], t in T} x[i,j,k,t];
data;
set T := 1 2 3 4 5 6 7  8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
25 26 27 28 29 30;
set I :=  1 2 3 4 5 6;
set C :=  1 2 3 4 5 6 7;
set J[1] := 1;
set J[2]:= 1;
set J[3] := 1 2 3 4;
set J[4] := 1 2 3 4 5 6;
set J[5] := 1 2 3 4;
set J[6] := 1 2;
set K[1,1] := 1 2 3 4;
set K[2,1] := 1 2 3;
set K[3,1] := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24 25 26 27 28;
set K[3,2] := 1;
set K[3,3] := 1 2 3;
set K[3,4] := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19;
set K[4,1] :=  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
24 25 26 27 28;
set K[4,2] := 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21;
set K[4,3] := 1 2 3 4 5;
set K[4,4] := 1 2 3 4;
set K[4,5] := 1 2 3 4;
set K[4,6] := 1 2 3 4 5 6 7;
set K[5,1] := 1 2 3 4 5 6 7 8 9 10 11 12 13 14;
set K[5,2] := 1 2 3 4 5 6 7 8 9  10;
set K[5,3] :=  1 2 3 4 5 6 7 8 9  10;
set K[5,4] := 1 2 3 4 5 6;
set K[6,1] :=   1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44;
set K[6,2] := 1 2 3 4 5 6;
end;

Thanks for helping me.

Antonio

```