[AMPL 24541] Assigning new parameter values

How do I assign new parameter values if am running various simulations. For instance in the loop below how do I change pwe[‘AGR-C’] to use different values. Have tries “let”, “purge”, “reset” without much success.

Loop and solve all the simulations

for {s in SIM}
{
purge pwe;
let pwe[‘AGR-C’] := PWEAGRSIM[s];
let pwm[‘NAGR-C’] := PWMNAGRSIM[s];
let {c in C} tm[c] := TMSIM[c,s];

Solve the model

solve;

Keep the results

let {ce in CE} PWEREP[ce,s] := pwe[ce];
let {cm in CM} PWMREP[cm,s] := pwm[cm];
let {cm in CM} TARREP[cm,s] := tm[cm];
}

The statement “let pwe[‘AGR-C’] := PWEAGRSIM[s];” looks right. But you should remove “purge pwe;” – that deletes pwe from the model entirely.

If you remove “purge pwe;” and you still see an error, then it is likely due to a problem with the way SIM or pwe or PWEAGRSIM is defined. So you should reply with copies of those definitions (or with your files attached.)