我正在努力使用 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