Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
38 views
Kernel: SageMath 7.6

load('/home/user/lin.prog2.sage')
Var = ['pork', 'carrot', 'melon'] # Variables con = ['fat ', 'protein', 'carbohydrate'] #constraints ob = [2.75,1.00,4.5] # cost per lbs M = [[240,42,0], [1.1,4.2,43], [1.1,3.8,36]] inq = [-1,-1,-1] bnd = [65,50,300]
lp(Var,con,ob,M,inq,bnd, mx = False)
GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 1 Problem: Objective: 38.20755208 (MINimum) No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 fat NL 65.00000 . 65.00000 . -.01089 37.50000 pork .01089 +Inf 65454.54545 +Inf 750.00000 melon 2 protein BS 358.27541 -308.27541 50.00000 +Inf -.10465 .71361 carbohydrate . +Inf 357.80886 .22495 118.80095 carrot 3 carbohydrate NL 300.00000 . 300.00000 41.90896 -.12500 5.94617 protein .12500 +Inf +Inf +Inf +Inf GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 2 Problem: Objective: 38.20755208 (MINimum) No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 pork BS .27083 2.75000 . 272.72727 .13750 37.50000 fat . +Inf -14.26773 3.13750 38.31250 carrot 2 carrot NL . 1.00000 . -Inf .93219 -Inf .06781 +Inf 1.54762 +Inf 38.31250 pork 3 melon BS 8.32506 4.50000 . +Inf . .74479 carbohydrate . +Inf 8.16997 5.17672 43.84125 carrot End of report
# calculating Prices Pork = .27083*2.75 melon = 8.32*4.5 carrot = 1.00
Cost = Pork + melon + carrot
Var = ['pork', 'carrot', 'melon'] con = ['fat ', 'protein', 'carbohydrate','calcium'] ob = [2.75,1.00,4.5] # cost M = [[240,42,0], [1.1,4.2,43], [1.1,3.8,36], [22.68,149.69,45.36]] inq = [-1,-1,-1,-1] bnd = [65,50,300,1]
lp(Var,con,ob,M,inq,bnd, mx = False)
GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 1 Problem: Objective: 38.20755208 (MINimum) No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 fat NL 65.00000 . 65.00000 . -.01089 37.50000 pork .01089 +Inf 65454.54545 +Inf 750.00000 melon 2 protein BS 358.27541 -308.27541 50.00000 +Inf -.10465 .71361 carbohydrate . +Inf 357.80886 .22495 118.80095 carrot 3 carbohydrate NL 300.00000 . 300.00000 41.90896 -.12500 5.94617 protein .12500 +Inf +Inf +Inf +Inf 4 calcium BS 383.76712 -382.76712 1.00000 602.25310 -.00048 38.02321 carrot . +Inf 383.76712 +Inf +Inf GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 2 Problem: Objective: 38.20755208 (MINimum) No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 pork BS .27083 2.75000 . 272.72727 .13750 37.50000 fat . +Inf -14.26773 3.13750 38.31250 carrot 2 carrot NL . 1.00000 . -2.71128 .93219 38.02369 calcium .06781 +Inf 1.54762 +Inf 38.31250 pork 3 melon BS 8.32506 4.50000 . +Inf . .74479 carbohydrate . +Inf 8.16997 5.17672 43.84125 carrot End of report
Var = ['pork', 'carrot', 'melon','milk'] con = ['fat ', 'protein', 'carbohydrate','calcium'] ob = [2.75,1.00,4.5,3.99] # cost M = [[240,42,0,32], [1.1,4.2,43,27], [1.1,3.8,36,24], [22.68,149.69,45.3,875.43]] inq = [-1,-1,-1,-1] bnd = [65,50,300,1]
lp(Var,con,ob,M,inq,bnd,mx=False)
GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 1 Problem: Objective: 38.20755208 (MINimum) No. Row name St Activity Slack Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 fat NL 65.00000 . 65.00000 . -.01089 37.50000 pork .01089 +Inf 65454.54545 +Inf 750.00000 melon 2 protein BS 358.27541 -308.27541 50.00000 +Inf -.10465 .71361 carbohydrate . +Inf 357.80886 .22495 118.80095 carrot 3 carbohydrate NL 300.00000 . 300.00000 41.90896 -.12500 5.94617 protein .12500 +Inf +Inf +Inf +Inf 4 calcium BS 383.26762 -382.26762 1.00000 601.76290 -.00048 38.02346 carrot . +Inf 383.26762 +Inf +Inf GLPK 4.60 - SENSITIVITY ANALYSIS REPORT Page 2 Problem: Objective: 38.20755208 (MINimum) No. Column name St Activity Obj coef Lower bound Activity Obj coef Obj value at Limiting Marginal Upper bound range range break point variable ------ ------------ -- ------------- ------------- ------------- ------------- ------------- ------------- ------------ 1 pork BS .27083 2.75000 . 272.72727 .13750 37.50000 fat . +Inf -14.26773 3.13750 38.31250 carrot 2 carrot NL . 1.00000 . -2.70763 .93219 38.02394 calcium .06781 +Inf 1.54762 +Inf 38.31250 pork 3 melon BS 8.32506 4.50000 . +Inf . .74479 carbohydrate . +Inf 8.16997 5.17672 43.84125 carrot 4 milk NL . 3.99000 . -.45379 3.34833 37.91637 calcium .64167 +Inf 2.03125 +Inf 39.51094 pork End of report