In an AMPL model, a parameter cannot be defined to depend on the values of variables. You can define a parameter in your model, and then later assign it a value that depends on the current values of some variables. For example, if your model file has these statements,
var Buy {FOOD} >= 0;
param TotalBuyUnits;
then you can later make an assignment like this:
let TotalBuyUnits := sum {j in FOOD} Buy[j];
As assignment of this kind can be useful after solving, when the current values of the variables are optimal. For instance, you may want to store the optimal value of some expression in a parameter, for convenience in using the value later; or you may want to use optimal values from the current model to set a parameter that appears another model.
--
Robert Fourer
am...@googlegroups.com