[AMPL 24800] How to write this in ampl

Hi, i got confused about how to write this objective function in Ampl, while CAL is for kilocalories. Would you mind help me?
Screenshot 2023-09-23 110418.jpgScreenshot 2023-09-23 110457.jpgScreenshot 2023-09-23 110518.jpg

The description says, “We define variables Rk . . .” but the expression for CAL refers to Rkt. The index “t” is not defined in the CAL expression, so maybe Rk should be used in that expression instead. Then the AMPL expression for minimizing calories could be written

minimize CAL: (sum {k in COMMOD} nutval[k,"energy"] * R[k]) / card(T);

(The function “card” computes the cardinality of the set T, which is just the number of members in the set.) Alternatively, if Rkt is correct, then you need to define t by, for example by summing over all t in T:

minimize CAL: (sum {k in COMMOD, t in T} nutval[k,"energy"] * R[k,t]) / card(T);

You will need to use your knowledge of the problem to determine which expression is correct.

Hi, i got trouble again. Could you fix this error?
T2.dat, line 110 (offset 5610):
irregular : … : header
context: param Cost_Transportation >>> := <<< #cost transportation (m,d,t)

im trying to write this kind of parameter
param Cost_Transportation {M, D, T};

then i input the data on my ampl like this:

See the comment in your other question about this.