Try adding some display statements like this:
display X_CH, Y_CH;
for {i in VS}{
if (card (minn[i])>=1) then let S_minn[i]:={j in VCH : distance1[i,j] == min{ii in VS} distance1 [ii,j]};
display S_minn[i];
let avg_x[i]:= (sum {Z in S_minn[i]} X_CH[Z]) / card(S_minn[i]);
let avg_y[i]:= (sum {Z in S_minn[i]} Y_CH[Z]) / card(S_minn[i]);
}
Probably you will see that S_minn[i] is empty for some i. In that case both the numerator (a sum over S_minn[i]) and the denominator are zero, which would be the cause of the error message.
If this explanation does not resolve the problem, then post all of the output from the AMPL run, including the display output and the complete error message. Also it may be helpful to attach your files.
Bob Fourer
am...@googleroups.com
=======