[AMPL 24901] Need help with this error

You are the proud inventor of ”The best barbecue sauce on earth.” You

have four plants with the following stock: Accident, Maryland (AMD)
has 250 bottles, Chicken, Alaska (CAK) has 500, Embarrass,
Minnesota (EMN) has 300, and Experiment, Georgia (EGA) has 400.
Your orders for next week are as follows: New Jersey (NJ) 150; New
York City (NYC) 250; South California (SCA) 300; Florida (FL) 250;
Texas (TX) 100; Alabama (AL) 150; Colorado (CO) 150; Nevada
(NV) 100.
You also have 1500 bottles of your very special ”Chicken with a
Rythm: the world’s best chicken spice” at your AMD plant, and you
have the following orders for this spice: NJ 350 NYC 250 TX 500 CO
400.
The following list provides the unit shipping costs in cents (the same
for both products): CAK→EMN 10, EMN→NYC 8, EMN→CO 3,
CO→NV 5, NV→SCA 2, TX→NV 3, AL→TX 1, AL→CO 3,
EMN→AL 4, AMD→NJ 4, NJ→NYC 3, AMD→FL 4, AMD→EGA
4, EGA→AMD 3, EGA→AL 5, EGA→FL 2, EGA→TX 6, FL→TX
5, TX→SCA 6.
Both products are delivered in same sized boxes. For each shipping
segment we have a capacity given the number of boxes we can ship
through that route: CAK→EMN 320, EMN→NYC 230, EMN→CO
290, CO→NV 190, NV→SCA 120, TX→NV 150, AL→TX 90,
AL→CO 110, EMN→AL 180, AMD→NJ 120, NJ→NYC 250,
AMD→FL 230, AMD→EGA 500, EGA→AMD 400, EGA→AL 700,
EGA→FL 600, EGA→TX 500, FL→TX 400, TX→SCA 250.
Create a model and ampl implementation to find a cost minimizing
delivery plan to distributors that ordered your products (fulfilling
orders as much as possible.)

here is the problem, I have attached my ampl code, and I am getting this error check at line 15 of /Users/sanjanaachar/Documents/Optimization modeling/SAHC-hw8.mod:

check: sum{w in WAREHOUSES} (supply[w] + spice_supply[w]) >= sum{s in

STORES} (demand[s] + spice_demand[s]);

no value for spice_supply[‘AMD’]

ampl:

Please help me fix it

SAHC-hw8.dat (830 Bytes)

SAHC-hw8.mod (1.82 KB)

After replacing “data BBQ.dat;” by “data SAHC-hw8.dat;” I saw the following error:

Error at _cmdno 3 executing "solve" command
(file ../sahc-hw8.mod, line 48, offset 1843):
check at line 15 of ../sahc-hw8.mod:
    check: sum{w in WAREHOUSES} (supply[w] + spice_supply[w]) >= sum{s in 
  STORES} (demand[s] + spice_demand[s]);

no value for spice_demand['SCA']

This is happening because, in the statement giving data for param spice_demand, SAHC-hw8.dat, there is no data for spice_demand[‘SCA’]:

param spice_demand := NJ 350 NYC 250 TX 500 CO 400;

In fact there are 4 stores missing from this data. You can add data for the missing stores; or, if you want spice_demand to be 0 for all of those stores, you can define 0 to be the default value for spice_demand, like this:

param spice_demand default 0 := NJ 350 NYC 250 TX 500 CO 400;