资源描述:
《lingo使用教程东南大学数模培训材料》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Lingo使用教程东南大学数模培训材料www.lindo.comLINGOisacomprehensivetooldesignedtomakebuildingandsolvingLinear,Nonlinear(convex&nonconvex/Global),Quadratic,QuadraticallyConstrained,SecondOrderCone,Stochastic, andIntegeroptimizationmodelsfaster,easierandmoreefficient.LINGOprovidesaco
2、mpletelyintegratedpackagethatincludesapowerfullanguageforexpressingoptimizationmodels,afullfeaturedenvironmentforbuildingandeditingproblems,andasetoffastbuilt-insolvers.TherecentlyreleasedLINGO12.0includesanumberofsignificantenhancementsandnewfeatures.LINGOprovidesallo
3、fthetoolsyouwillneedtogetupandrunningquickly.YougettheLINGOUserManual(inprintedformandavailableviatheonlineHelp),whichfullydescribesthecommandsandfeaturesoftheprogram.AlsoincludedwithsuperversionsandlargerisacopyofOptimizationModelingwithLINGO,http://www.lindo.com/inde
4、x.php?option=com_content&view=article&id=38&Itemid=24acomprehensivemodelingtextdiscussingallmajorclassesoflinear,integerandnonlinearoptimizationproblems.LINGOalsocomeswithdozensofreal-worldbasedexamplesforyoutomodifyandexpand.优化问题的一般形式LP,ILP,BILP,NLP,INLP,QP,IQP,PIP,ZO
5、P线性规划问题LP的标准形式MATLAB命令:linprog,bintprog例1.如何在LINGO中求解如下的LP问题:LINGO代码:min=2*x1+3*x2;x1+x2>=350;x1>=100;2*x1+x2<=600;例2.如何在LINGO中求解如下的IQP问题:LINGO代码:max=98*x1+277*x2-x1^2-0.3*x1*x2-2*x2^2;x1+x2<=100;x1<2*x2;@gin(x1);@gin(x2);例3。职员时序安排模型一项工作一周7天都需要有人(比如护士工作),每天(周一至周日)所需的最少
6、职员数为20、16、13、16、19、14和12,并要求每个职员一周连续工作5天,试求每周所需最少职员数,并给出安排。注意这里我们考虑稳定后的情况。model:sets:days/mon..sun/:required,start;endsetsdata:!每天所需的最少职员数;required=20161316191412;enddata!最小化每周所需职员数;min=@sum(days:start);@for(days(J):@sum(days(I)
7、I#le#5:start(@wrap(J+I+2,7)))>=required(
8、J));end例2。职员时序安排模型一项工作一周7天都需要有人(比如护士工作),每天(周一至周日)所需的最少职员数为20、16、13、16、19、14和12,并要求每个职员一周连续工作5天,试求每周所需最少职员数,并给出安排。注意这里我们考虑稳定后的情况。model:sets:days/mon..sun/:required,start;endsetsdata:!每天所需的最少职员数;required=20161316191412;enddata!最小化每周所需职员数;min=@sum(days:start);@for(days(J)
9、:@sum(days(I)
10、I#le#5:start(@wrap(J+I+2,7)))>=required(J));end最优解决方案是:每周最少需要22个职员,周一安排8人,周二安排2人,周三无需安排人,周四安排6人,周五和周六都安