Why does AMPL reject my “let” statement with a “… has a := value in the model” message?

Your let command is attempting to assign a value to some set or parameter. In the set’s or parameter’s declaration, however, you have used a := phrase to permanently define the value. A let command is not permitted to redefine the value of such a parameter; hence the error message that you received.

As an example, if the model declares

param dstot {p in prod} := sum {w in whse} ds[p,w];

then dstot[p] is permanently defined to take the value sum {w in whse} ds[p,w] . You can make any changes you like to the ds[p,w] values, and AMPL will automatically change the dstot[p] values accordingly. Any command beginning let {p in prod} dstot[p] := ... will be in error, however.

If you want to be able to use let to override the defined value of a parameter, use default in place of := in your param declaration.