Seeking Assistance with AMPL Programming - Syntax Error

I hope this email finds you well. I am currently working on a mathematical optimization problem and using AMPL for programming. However, I have encountered syntax errors while trying to translate certain mathematical constraints into AMPL code. I would greatly appreciate your guidance on resolving this issue.

Here is a brief description of the mathematical constraints I am working with:

The code I wrote in AMPL is as follows:
set I := {1…10 by 1}; # Signal cycles
set J := {0…4 by 1}; # Signal phases
var g{i in I, j in J} >= 10, <= 25 integer; # Decision variable for green light duration in phase j of signal cycle i
var C_{I}; # Start time of cycle i
var cycle_length{i in I} = sum{j in 1…4} g[i, j]; # Length of cycle i
var in_cycle{k in K, i in I} binary; # Binary variable indicating if vehicle k arrives at the intersection during cycle i

Calculate the start time of signal cycle i

subject to Cycle_Start_Time_Constraint{i in 2…10}:
C_[i] = sum{j in 1…4} g[i-1, j] + C_[i-1];

Initial condition

subject to Cycle_Start_Time_Constraint_0:
C_[1] = 0; # The first cycle starts at time 0

Determine in which signal cycle each vehicle arrives

subject to Car_In_Cycle{k in K, i in I}:
t[k] >= C_[i] and t[k] <= C_[i] + cycle_length[i] * in_cycle[k, i] ;

param p{k in K}; # Phase at which vehicle k enters the intersection
var delay{k in K}; # Vehicle delay

If the vehicle can enter the intersection in the current cycle

subject to delay_1{k in K, i in I}:
t[k] <= C_[i* in_cycle[k, i]] + sum {1…p[k]} g[i, p[k]]
==> d[k] = max(0, C_[i* in_cycle[k, i] ] + sum {1…p[k]-1} g[in_cycle[k, i] * i, p[k]]-t[k]) ;

If the vehicle needs to enter the intersection in the next cycle

subject to delay_2{k in K, i in I}:
t[k] >= C_[in_cycle[k, i] * i] + sum {1…p[k]} g[in_cycle[k, i] * i, p[k]]
==> d[k] = C_[in_cycle[k, i] * i + 1] + sum {1…p[k]-1} g[in_cycle[k, i] * i + 1, p[k]]-t[k];

Minimize the total delay of all vehicles

sum{k in K} d[k];

The syntax error message I encountered is as follows:
Variables in subscripts are not yet allowed.
context: t[k] >= >>> C_[in_cycle[k,i]*i] <<< + sum {1…p[k]} g[in_cycle[k,i]*i,p[k]]

variable in index expression

context: t[k] >= >>> C_[in_cycle[k,i]*i] <<< + sum {1…p[k]} g[in_cycle[k,i]*i,p[k]]

k is not defined

context: t[k] >= C_r[in_cycle[k,i]*i]+ sum >>> {1…p[k]} g[in_cycle[k,i]*i,p[k]]

As indicated by “variable in index expression”, AMPL does not recognize C_[i*in_cycle[k,i]] where in_cycle is a variable.

Were you able to find a different formulation, as suggested in your later question to this forum?