Hands On 3 Errors – Bruce McCarl
Source: https://agecoresearch.tamu.edu/mccarl/classes-i-teach/hands-on-3-errors/ Parent: https://agecoresearch.tamu.edu/mccarl/
- File contains errors, both theoretical and syntax-related, *
- find them and interpret the results of the corrected model *
SETS\ Sources cities that have canning plants that produce cases of canned peaches\ / Seattle\ “San Diego”\ Topeka\ Houston\ /\ Destination cities that are markets for the canned peaches\ / “New York”\ Chicago\ /
PARAMETERS\ Supply(Sources) Supply available of canned peaches at each source plant in cases\ /Seattle 50\ “San Diego” 30\ Topeka 20\ Houston 10\ /
Need(Destination) Amount neeeded at each market destination in cases of canned peaches
/"New York" 55
Chicago 45
/;
TABLE Distance(Sources,Destination) Distance in miles
"New York" Chicago
Seattle 20 25
"San Diego" 15 32
Topeka 10 15
Houston 17 19 ;
SCALAR\ PrMileCst Freight cost in $ per miles /0.5/ ;
PARAMETER\ TranCost(Sources,Destination) Transport cost in dollars per case ;\ Trancost(Sources,Destination)\ = PrMileCst*Distance(Sources,Destination)
VARIABLE\ TotalCost total transportation costs in dollars ;
POSITIVE VARIABLE\ Transport(Sources,Destination) shipment quantities in cases ;
EQUATIONS\ Costsum total transport cost — objective function\ Supplbal(Sources) supply limit at source plants\ Demandbal(Destination) demand at destinations ;
Costsum..\ TotalCost\ =e= SUM((Sources,Destination),\ Trancost(Sources,Destination)*Transport(Sources,Destination)) ;
Supplbal(Sources)..\ SUM(Destination, Transport(Sources,Destination))\ =l= Supply(Sources) ;
Demandbal(Destination)..\ SUM(Sources, Transport(Sources,Destination))\ =e= Need(Destination);
MODEL Transports /All/ ;
SOLVE Transports using lp minimizing TotalCost ;\ display transport.L, transport.M;
- The display command is used simply to build a simple report for the optimal solution level (transport.L) and reduced costs
- of transport (transport.M) var