solve

10 views
Skip to first unread message

Esteban Cáceres

unread,
Jul 3, 2022, 3:13:25 AM7/3/22
to AMPL Modeling Language
AMPL throws me an error when applying the solve; with the following message: 

ampl: solve;
Error executing "solve" command:
error processing var X[...]:
    no data for set PLANTAS

I attach complete code below:
TAREA2 (2).pdf

AMPL Google Group

unread,
Jul 4, 2022, 3:20:05 AM7/4/22
to AMPL Modeling Language
Try creating separate model and data files, like the ones TAREA2.mod and TAREA2.dat attached to this message. Then read them with model and data statements, like this:

model TAREA2.mod;
data TAREA2.dat;
solve;

When I do this, I do not see the "no data for set PLANTAS" message. Instead I see this error message:

error processing objective COSTOS:
invalid subscript TR['PLA1',1,1]

You define "var TR{PLANTAS, CENTROS, 1..T} integer >= 0" but in the objective you write "TR[m,1,t]". You are getting this error because 1 is not in the set CENTROS. Maybe you want to write this instead:

TR[m,"CEN1",t]


--
Robert Fourer
am...@googlegroups.com
{#HS:1938493115-110803#}
TAREA2.dat
TAREA2.mod
Reply all
Reply to author
Forward
0 new messages