Hello,

I hope that someone can help me. What does the following error message mean? Does anyone find the error?

Thanks for help.

ampl: option solver cplex;

ampl: model RCPSP_Erweiterung.mod;

ampl: data RCPSP_Erweiterung.dat;

ampl: solve;

Error executing “solve” command:

error processing constraint constraint3[1]:

invalid subscript x[‘D1’,1]

model:

set J; # set of activities

set M;

set L;

set I;

param Sink symbolic in J; # dummy activity that succeeds all other activities

set V {j in J}; # set of predecessors of activity j

set R; # set of resources

param d{j in J} >= 0; # duration of activity j

param EF{j in J} >= 0; # earliest finish time of activity j

param LF{j in J} >= 0; # latest finish time of activity j

param k{j in J, r in R} >= 0; # demand of activity j on resource r

param K{r in R} >= 0; # (renewable) capacity of resource r at any time t

param T := sum{j in J} d[j]; # simple, but not very tight, upper bound on the makespan

check {j in J}: LF[j] <= T; # just a simple check, time-windows (EF[j],LF[j]) can be calculated e.g. with Critical Path Method

var x{j in J, t in EF[j]…LF[j]} binary; # Binary variable indicating the completion of activity j at time t

minimize Makespan:

sum{t in EF[Sink]…LF[Sink]} t * x[Sink,t];

subject to Completion {j in J}:

sum{t in EF[j]…LF[j]} x[j,t] = 1;

subject to Precedence_Relations {j in J diff Source, h in V[j]}:

sum{t in EF[h]…LF[h]} t * x[h,t] <= sum{t in EF[j]…LF[j]} (t - d[j]) * x[j,t];

subject to Capacity {r in R, t in 1…T}:

sum{j in J} k[j,r] * sum{q in max(t,EF[j])…min(t+d[j]-1,LF[j])} x[j,q] <= K[r];

subject to constraint1 {t in 1…T}:

if sum{j in J diff L} x[j,t] >= 1 then sum{j in J diff I} x[j,t] = 0;

subject to constraint2 {t in 1…T}:

sum{j in J diff M} x[j,t] <= 1;

data:

set J := A1 A2 A3 B1 B2 B3 B4 B5 B6 B7 B8 B9 C1 C2 C3 C4 C5 D1 D2 D3 S;

set M := A1 A2 A3 B1 B2 B3 B4 B5 B6 B7 B8 B9 D1 D2 D3 S;

set L := A1 A2 A3 B1 B2 B3 B4 B5 B6 B7 B8 B9 C1 C2 C3 C4 C5 D3 S;

set I := D1 D2 D3 S;

param Sink := S;

set V[‘A2’] := A1;

set V[‘A3’] := A2;

set V[‘B1’] := A3;

set V[‘B2’] := B1;

set V[‘B3’] := B2;

set V[‘B4’] := B3;

set V[‘B5’] := B4;

set V[‘B6’] := B5;

set V[‘B7’] := B6;

set V[‘B8’] := B2;

set V[‘B9’] := B3;

set V[‘C1’] := B9 B8 B7;

set V[‘C2’] := B9 B8 B7;

set V[‘C3’] := C1;

set V[‘C4’] := C1;

set V[‘C5’] := C1;

set V[‘D1’] := B5;

set V[‘D2’] := B5;

set V[‘D3’] := C2 C3 C4 C5 D1 D2;

set V[‘S’] := D3;

set R := 8;

param d := A1 10 A2 8 A3 1 B1 1 B2 4 B3 4 B4 8 B5 8 B6 4 B7 4 B8 6 B9 10 C1 4 C2 6 C3 3 C4 3 C5 4 D1 45 D2 16 D3 1 S 0;

param EF := A1 10 A2 18 A3 19 B1 20 B2 24 B3 28 B4 36 B5 44 B6 48 B7 52 B8 30 B9 38 C1 56 C2 58 C3 59 C4 59 C5 60 D1 89 D2 60 D3 118 S 118;

param LF := A1 10 A2 18 A3 19 B1 20 B2 24 B3 28 B4 36 B5 44 B6 93 B7 97 B8 97 B9 97 C1 107 C2 117 C3 117 C4 117 C5 117 D1 117 D2 117 D3 118 S 118;

param k : 8 :=

A1 2

A2 2

A3 2

B1 1

B2 2

B3 3

B4 2

B5 2

B6 2

B7 2

B8 1

B9 1

C1 1

C2 1

C3 1

C4 1

C5 1

D1 1

D2 1

D3 1

S 0 ;

param K := 8 8;

end;