用LINGO求解线性规划问题Solving linear programming problems with LINGO.docx
- 文档编号:17867200
- 上传时间:2023-08-04
- 格式:DOCX
- 页数:12
- 大小:19.16KB
用LINGO求解线性规划问题Solving linear programming problems with LINGO.docx
《用LINGO求解线性规划问题Solving linear programming problems with LINGO.docx》由会员分享,可在线阅读,更多相关《用LINGO求解线性规划问题Solving linear programming problems with LINGO.docx(12页珍藏版)》请在冰点文库上搜索。
用LINGO求解线性规划问题SolvinglinearprogrammingproblemswithLINGO
用LINGO求解线性规划问题(SolvinglinearprogrammingproblemswithLINGO)
Experiment1usesLINGOtosolvelinearprogrammingproblems
LINGOusageprofiles
LINGOsoftwareistheUnitedStatesLINDOSystemsCorporation(LindoSystemInc)developedasetforsolvingtheoptimal
Inadditiontothelinearprogrammingandthetwoprogramming,thesoftwarepackage.LINGOcanbeusedfornonlinearprogramming
Aswellassomelinearandnonlinearequations(sets),themostimportantfeatureof.LINGOsoftwareisthatitallowstheoptimizationofthemodel
Thedecisionvariableisinteger,andtheexecutionspeedisfast..LINGOhasalanguagebuilttooptimizethemodel,whichissimpleandconvenient
Toexpresslargescaleproblems,theLINGOefficientsolvercanbeusedtosolveandanalyzetheresultsquickly
HowtouseLINGO
LINGOcanbeusedtosolvelinearprogramming,twoprogramming,nonlinearprogramming,integerprogramming,graphtheoryandnetworkoptimizationandscheduling
Theteamdealswiththeoptimizationproblemsinthemodel
ALINGOprogramtypicallycontainscollectionsegments,dataentrysegments,optimizationobjectives,andconstraints,initialsegments,anddata
Eachpartofthepreprocessingsectionhasitsownuniquefunctionandgrammaticalrules.Thereadermayrefertotherelevantreferencebookor
LINGOHELPfiledetailedunderstanding,hereisnotintroduced
ThemainfeaturesofLINGOareasfollows:
itcannotonlysolvelinearprogrammingproblems,butalsohavestrongnonlinearprogrammingproblems
Theinputmodelisconcise,intuitive,fastandpowerfulincomputation;thebuilt-inmodelinglanguageprovidesdozensofinternalfunctions
Number,thusdescribinglargescaleoptimizationmodelsinlessstatementsandmoreintuitiveways;introducingtheconceptofsetsintoprogramminglanguages,
ItiseasytotranslatetheactualproblemintoaLINGOmodel,andcaneasilyexchangedatawithothersoftwaresuchasExcel,database,etc.
Accordingto.
LINGOsyntaxrules:
(1)seekingthemaximumorminimumoftheobjectivefunction,respectively,usingMAX=...OrMIN=...Comeexpress;
(2)eachstatementmustendwithasemicolon,andeachlinecanhavemanystatementsthatcancrosstheline;
(3)thenameofthevariablemustbeginwiththeletter(A~Z),consistingofletters,numbers(0~9)andunderscores
Nomorethan32characters,caseinsensitive;
(4)youcanaddlabelstostatements,suchas[OBJ],MAX=200*X1+300*X2;
(5)withexclamationmark"!
"Thestatementthatendswithasemicolonisthecommentstatement;
(6)iftherangeofvariablesisnotspecified,allthedecisionvariablesareassumedtobenegative;
(7)theLINGOmodelbeginswiththestatement"MODEL"andendswith"END",forsimplermodels,
Thesetwostatementscanbeomitted
Experimentalpurpose
1.,foragivenpracticalapplication,themathematicalmodelofthelinearprogrammingproblemisestablishedandsolvedbyLINGO;
2.masterthesensitivityanalysisandthemethodofshadowpricecorrelationanalysis
Experimentaldataandcontents
Problem1.1afactoryintheplanningperiodtoarrangeproductionofA,Btwokindsofproducts,knownproductionunits,productsrequiredequipment
Thedataoftableandtheconsumptionoftwokindsofrawmaterials,suchasaandB,arelistedintable1.1.:
howshouldtheproductionschedulebearrangedsothatthefactorycanobtain
Max?
Table1.1dataforresourceallocationissues
product
Resources
A
B
Availableresources
equipment
One
Two
8sets
nail
Four
Zero
16kilograms
B
Zero
Four
12kilograms
Unitprofit
2yuan
3yuan
Themathematicalmodelofthelinearprogrammingproblemisestablished,andtheoptimalsolutionisobtainedbyLINGO
Problem1.2.Acompanyraisesexperimentalanimalsforsale.Thegrowthoftheseanimalsisknowntobethe3Nutrientinthediet
Ingredients(proteins,minerals,andvitamins)areespeciallysensitive.Eachanimalneedsatleastprotein60g,mineral3Gperweek,
Vitamin8mg,thecompanycanbuy5differentkindsoffeed,
Eachfeedcontainsvariousnutrientsandcostssuchas1kg
1.2,ifeachsmallanimalfeedsmorethan52kgaweek,itcanmeettheneedsofanimalgrowthandmaketheassembly
Thisminimumrecipeforfeed
Table1.2dataforingredients(recipes)
feed
Nutrition
1A
2A
3A
4A
5A
Minimumnutrition
Requirement
Protein(g)
Zeropointthree
Two
One
Zeropointsix
Onepointeight
Sixty
Minerals(g)
Zeropointone
ZeroPointZeroFive
Zeropointzerotwo
Zeropointtwo
ZeroPointZeroFive
Three
Vitamin(mg)
ZeroPointZeroFive
Zeropointone
Zeropointzerotwo
Zeropointtwo
Zeropointzeroeight
Eight
Cost(yuan/kg)
Zeropointtwo
Zeropointseven
Zeropointfour
Zeropointthree
Zeropointfive
Experimentalguidance
Question1.1plantoproducetwoproducts,namely,theestablishmentoflinearprogrammingmathematicalmodelBA,21,XX
.
.
.
.
.
Morethan
Lessthanorequalto
Lessthanorequalto
=+
=
012416482.32max21212121xxxxxxtsxxS
EnterthefollowingmodelintheMODELwindowoftheLINGO:
Model:
Max=2*x1+3*x2;
X1+2*x2<=8;
4*x1<=16;
4*x2<=12;
End
SelectLingo|Solvemenu(orpressCtrl+S),orusethemousetoclickonthe"solution"button,ifthemodelhasasyntaxerror,then
Popupawindowtitled"LINGOErrorMessage"(errorinformation)toindicatewhatlineoferrorisin,
Eacherrorhasanumber(meaningcanrefertotherelevantdocumentorLINGOHelp).Aftercorrectingtheerror,askagain
Solution,ifthesyntaxispassed,theLINGOusestheinternalsolvertofindthesolutionofthemodel,andthenpopsupatitlefor
Thewindowof"LINGOSolverStatus"(solutionstate),whosecontentisthenumberofvariables,thenumberofconstraints,andtheoptimization
Status,consumptionofmemory,timespentandsoon.ClickClosetoclosethewindow.Thetitleappearsonthescreenas"SolutionReport""
Theinformationwindowofthesolutionreportshowsthestepsoftheoptimizationcalculation(theiterationofthebasechangeinthelinearprogramming)andtheoptimizedtargetletter
Thenumericalresultsofeachvariablearecalculated:
Global,optimal,solution,found,at,iteration:
5
Objectivevalue:
14
VariableValueReducedCost
X140
X220
Row,Slack,or,Surplus,Dual,Price
114,1
20,1.500000
30,0.1250000
44,0
Thereportshows:
run5stepstofindtheglobaloptimalsolution,theobjectivefunctionvalueis14,thevariablevaluesare
Themeaningof"ReducedCost"istoreducethecostcoefficientortoincreasetheprofitcoefficient(thenonzerochangeinthevalueoftheoptimalsolution
TheReducedCostvalueequalszero.TheRowisthelinenumberintheinputmodel.Thedestinationfunctionisthefirstline;Slackor
"Surplus"means"slack"or"left",thatis,thedifferencebetweentheleftandtherightoftheconstraint"
124,2==xxistherightinequality
ThedifferencetotheleftisSlack(relaxation).Fortheinequalityoftheleft,thedifferenceontheleftisSurplus(theremainder),
Whentheconstraintsareequalonbothsides,thevalueoftheslackorsurplusisequaltozero."DualPrice"meansthedualprice(or
Shadowprice)therelaxationvalueofRow2intheabovereportis0,indicatingthat4unitsand2unitsofaproductareproduced
When8unitsarerequiredtobesaturated,thedualprice1.5means:
iftheequipmentisincreasedby1units,thevalueofthetargetfunctioncanbeincreased
Inthe1.5.report,therelaxationvalueofRow4is4,indicatingthat4unitsofaproductand2unitsofBproductsareneeded
8kilogramsstillhave4kilograms,sotheincreaseofrawmaterialBwillnotincreasethevalueoftheobjectivefunction,sothedualpriceis0.
Morethan
Problem1.2setfeedneedskg,linearprogrammingmathematicalmodelisestablished
Type:
54321,,,,,AAAAA54321,,,xxxxx
123451234512345123451234512345min0.20.70.40.30.50.320.61.8600.10.050.020.20.0530.050.10.020.20.088.52,,,0Sxxxxxxxxxxxxxxxxxxxxstxxxxxxxxxx=++++
=++++.
++++..
++++..
=++++.
Aged.
EnterthefollowingmodelintheMODELwindowoftheLINGO:
Min=0.2*x1+0.7*x2+0.4*x3+0.3*x4+0.5*x5;
0.3*x1+2*x2+x3+0.6*x4+1.8*x5>60;
0.1*x1+0.05*x2+0.02*x3+0.2*x4+0.05*x5>3;
0.05*x1+0.1*x2+0.02*x3+0.2*x4+0.08*x5>8;
X1+x2+x3+x4+x5<52;
Thesolutionoutputsareasfollows:
Global,optimal,solution,found,at,iteration:
4
Objectivevalue:
22.40000
VariableValueReducedCost
X100.7000000
X2120
X300.6166667
X4300
X5100
Row,Slack,or,Surplus,Dual,Price
122.40000-1.000000
20-0.5833333
34.100000,0
40-4.166667
50,0.8833333
Asaresult,weeklyamountsoffeedforeachanimalare12,30and10kg,respectively
52,thefeedingcostcanbeminimized,andtheminimumcostis22.4yuan
Thepriceofthesetwofeedsistoohightobecompetitive."ReducedCost"isequalto0.7and0.617,respectively
Whenthepriceofthetwofeedswasreducedby0.7yuanandmorethan0.62yuan,notonlythetwokindsoffeedstuffswereused,butalsothefeedcostwaslowered
Low.Fromthe"SlackorSurplus",youcanseethattheproteinandvitaminshavejustreachedtheminimumstandardandthemineralexceedstheminimumstandard
4.12A4A5Akgkgkg1A3Ag;fromthe"DualPrice"canbereducedstandardprotein1units,youcanreducethecostofbreeding0.583yuan,reducethestandard
Aquasivitamin1unitcanreducefeedcostsby4.167yuan,butloweringmineralstandardswillnotreducefeedcostsif
Iftheamountoffoodconsumedbyanimalsisreduced,itisnecessarytoselectsomefinefodder.However,ifthecostisincreased,about1ofthefoodconsumptioncanbereduced
Thecostofraisingwasincreasedby0.88yuan
Kg
Fortheobjectivefunctioncoefficientsand
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 用LINGO求解线性规划问题Solving linear programming problems with LINGO 求解 线性规划 问题 Solving
![提示](https://static.bingdoc.com/images/bang_tan.gif)
链接地址:https://www.bingdoc.com/p-17867200.html