[AMPL 2104] how to use AMPL to solve the following problem.

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[AMPL 2104] how to use AMPL to solve the following problem.

a4youngie

Hi, all,
I am a new learner in AMPL and I can't figure out how to solve the
problem below by using AMPL. Can you be kind enough to share me the
language used in AMPL step by step? Thanks in advance for your help.

Problem:  Sunco oil has three different processes that can be used to
manufacture various types of gasoline. Each process involves blending
oils in the company's catalytic cracker. Running process 1 for an hour
costs $5 and requires 2 barrels of crude oil 1 and 3 barrels of crude
oil 2. The output from running process 1 for an hour is 2 barrels of
gas 1 and 1 barrel of gas 2. Running process 2 for an hour costs $4
and requires 1 barrel of crude 1 and 3 barrels of crude 2. The output
from process 2 for an hour is 3 barrels of gas 2. Running process 3
for an hour costs $1 and requires 2 barrels of crude 2 and 3 barrels
of gas 2. The output from running process 3 for an hour is 2 barrels
of gas 3. Each week, 200 barrels of crude 1, at $2/ barrel, and 300
barrels of crude 2 at $3/barrel, may be purchased. All gas produced
can be sold at the following per-barrel prices: gas 1, $9; gas 2, $10;
gas 3, $24. Formulate an LP whose solution will maximize revenues less
costs. Assume that only 100 hours of time on the catalytic cracker are
available each week.

My Solution:
Let X_i  = no. of hours process i is run per week (where i =1,2,3)

Let O_i = no. of barrels of oil i that is purchased per week (i =1,2)
Let G_2 = no. of barrels of gas 2 sold per week

maximize cost= 9(2*X_1)+10(G_2)+24(X_3)-5(X_1)-4(X_2)--2(O_1)-3(O_2)
                     =13X_1-4X_2+47X_3+10G_2--2(O_1)-3(O_2)

constraints:
2X_1+X_2-O_1=0
3X_1+3X_2-O_2=0
X_1+3X_3-G_2=0
X_i, O_i ,G_2>=0
O_1<=200
O_2<=300
sum{X_i}<=100





--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "AMPL Modeling Language" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/ampl?hl=en
-~----------~----~----~----~------~----~------~--~---