AMPL syntax error

I'm learnig to use AMPL and I wrote the next script

# 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];

with the next data file

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;

But when I charge the mod file, AMPL print

ampl: model 'C:\Users\Laura\Desktop\Monserrat\P2\problema2.mod';

C:\Users\Laura\Desktop\Monserrat\P2\problema2.mod, line 3 (offset 30): syntax error

I reviewed the code, but I don't understand what is the error. Please! Help me.

Upvotes: 1

Views: 890

Answers (1)

Paul G.
Paul G.

Reputation: 632

You have to end the line with a semicolon ; also for the definition of the sets and the parameters, and not just for the variables and equations.

Upvotes: 1

Related Questions