AMPL 構文に苦労しています (これは私の最初のプロジェクトです)。私のモデルには次のものがあります。
set GRID; # a grid represented by a sequence of integer
param W; # width of the grid
param d{i in GRID, j in GRID}; # distance between point of the grid
私のデータには次のものがあります:
set GRID = 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16;
param W = 4;
param d{i in GRID, j in GRID} = sqrt( (abs(i-j) mod W)**2 + (abs(i-j) div W)**2 ); # I want to calculate the distance between each pair of points
しかし、最後の行でエラーが発生します:
(offset 7)
expected ; ( [ : or symbol