Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Plain Text by atata ( 15 years ago )
$Title A Transportation Problem (TRNSPORT,SEQ=1)
$Ontext
$Offtext
Set
i products for sale / A,B, Product1, Product1LowCost, Product1SuperLowCost,
Product1Purchased, Product2, Product2Purchased /
mass mass of transitional and output products /Product1MakedFromA, Product1MakedFromB, Product1MakedByConverter,
Product2ForConverting, Product2MakedByConverter, Product2MakedFromA, Product2MakedFromB/;
Parameter
a(i) cost products in rubles
/ A -3.25
B -3.40
Product1 5.50
Product1LowCost 5.20
Product1SuperLowCost 5.00
Product1Purchased -5.75
Product2 3.80
Product2Purchased -4.00
/;
Scalar mainProcessCost /-0.35/;
Scalar filteringProduct1Cost /-0.10/;
Scalar convertingCost /-0.25/;
Variables
z total costs in rubles ;
Positive Variables
massForSale(i) of products in tonns
massForChemistry(mass);
Equations
cost define objective function
stageA1
stageA2
stageB1
stageB2
converter1
converter2
converterPerfomance
product1OkPrice
product1LowPrice
product1Contract
massA
massB
factoryPerfomance
product1MassEquals
product2MassEquals
productsConverting;
cost.. z =e= sum(i, a(i)*massForSale(i)) + (massForSale("A") + massForSale("B"))*mainProcessCost
+ (massForChemistry("Product1MakedFromA")+ massForChemistry("Product1MakedFromB") )*filteringProduct1Cost
+ massForChemistry("Product2ForConverting")*convertingCost;
stageA1.. 0.15*massForSale("A") =e= massForChemistry("Product1MakedFromA");
stageA2.. 0.85*massForSale("A") =e= massForChemistry("Product2MakedFromA");
stageB1.. 0.25*massForSale("B") =e= massForChemistry("Product1MakedFromB");
stageB2.. 0.75*massForSale("B") =e= massForChemistry("Product2MakedFromB");
converter1.. 0.5*massForChemistry("Product2ForConverting") =e= massForChemistry("Product1MakedByConverter");
converter2.. 0.5*massForChemistry("Product2ForConverting") =e= massForChemistry("Product2MakedByConverter");
converterPerfomance.. massForChemistry("Product2ForConverting") =l= 50*1000;
productsConverting.. massForChemistry("Product2ForConverting") =l= massForChemistry("Product2MakedFromB")
+ massForChemistry("Product2MakedFromA") + massForSale("Product2Purchased");
product1OkPrice.. massForSale("Product1") =l= 45*1000;
product1LowPrice.. massForSale("Product1LowCost") =l= 4*1000;
product1MassEquals.. massForChemistry("Product1MakedFromA")+ massForChemistry("Product1MakedFromB")
+ massForChemistry("Product1MakedByConverter") =e=
massForSale("Product1")+ massForSale("Product1LowCost")
+ massForSale("Product1SuperLowCost");
product2MassEquals.. massForChemistry("Product2MakedFromA")+ massForChemistry("Product2MakedFromB")
+ massForChemistry("Product2MakedByConverter") =e= massForSale("Product2");
product1Contract.. massForSale("Product1")+ massForSale("Product1LowCost")
+ massForSale("Product1SuperLowCost") + massForSale("Product1Purchased") =g= 40*1000;
massA.. massForSale("A") =l= 100*1000;
massB.. massForSale("B") =l= 30*1000;
factoryPerfomance.. massForSale("A")+massForSale("B") =l=100*1000;
Model transport /all/ ;
Solve transport using lp maximizing z ;
Display z.up ;
Display 'first a set', i, 'then parameter',a ,
'then the activity level of a variable', massForSale.l, ' and ', massForChemistry.l, mass;
Revise this Paste