1
我主義學習使用AMPL和我寫的下一個腳本AMPL語法錯誤
# Problema 2
set P #plantas
set PI #puntos intermedios
set CD # centros de distribucion
set O # origenes
set D # destinos
param coste {i in O , j in D}
param produc {k in P}
param capac {l in PI}
param requiere {m in CD}
var cantidad{O,D}>==0;
check: sum{k in P} produc[k] <= sum{m in CD} requiere[m];
minimize costo_transporte: sum{i in O, j in D} coste[i,j]*cantidad[i,j];
subject to restriccion_produccion{k in P}:
sum{j in D}cantidad[k,j]<=produc[k];
subject to restriccion_intermedio_entrada{l in PI}:
sum{i in O}cantidad[i,l]<=capac[l];
subject to resctriccion_intermedio_salida{l in PI}:
sum{i in O}cantidad[i,j] - sum{j in D}cantidad[l,j]>=0;
subject to restriccion_demanda{m in CD}:
sum{i in O}cantidad[i,m]=requiere[m];
下一個數據文件
set P:= Rancagua SanPablo Bogota;
set PI:= Lima Mendoza;
set CD:= Santiago RiodeJaneiro Quito Caracas;
set O:= Rancagua SanPablo Bogota Santiago Lima Mendoza;
set D:= Santiago RiodeJaneiro Quito Caracas Lima Mendoza;
param coste:
Santiago RiodeJaneiro Quito Caracas Lima Mendoza:=
Rancagua 3 20 30 30 10 6
SanPablo 15 5 35 40 20 12
Bogota 45 25 10 12 25 30
Santiago 0 15 30 48 12 10
Lima 12 22 8 30 0 15
Mendoza 10 15 12 35 15 0;
param produc:=
Rancagua 300
SanPablo 250
Bogota 200;
param capac:=
Lima 150
Mendoza 180;
param requiere:=
Santiago 120
RiodeJaneiro 300
Quito 80
Caracas 200;
但是當我責成國防部文件,AMPL打印
ampl:model'C:\ Users \ Laura \ Desktop \ Monserrat \ P2 \ problema2.mod';
C:\用戶\勞拉\桌面\蒙塞拉特\ P2 \ problema2.mod,3號線(偏移30): 語法錯誤
我審查的代碼,但我不明白是什麼錯誤。 請!幫我。