LINGO教程 如何用LINGO解决LP问题?
时间:2023-08-04 10:46:45
LINGO是一款建模人员用来求解线性和非线性优化问题的简易工具,利用LINGO可以对一些数据进行高效的求解并分析结果,本文将带来两个例子给大家演示如何用LINGO进行模型优化。
当你在windows下开始运行LINGO系统时,会得到类似下面的一个窗口:
![LINGO教程 如何用LINGO解决LP问题?](https://img.aspxhome.com/file/2023/9/a340474_0.jpg)
外层是主框架窗口,包含了所有菜单命令和工具条,其它所有的窗口将被包含在主窗口之下。在主窗口内的标题为LINGO Model – LINGO1的窗口是LINGO的默认模型窗口,建立的模型都都要在该窗口内编码实现。下面举两个例子。
例1.1 如何在LINGO中求解如下的LP问题:
在模型窗口中输入如下代码:
min=2*x1+3*x2;
x1+x2》=350;
x1》=100;
2*x1+x2《=600;
然后点击工具条上的靶子按钮即可。
![LINGO教程 如何用LINGO解决LP问题?](https://img.aspxhome.com/file/2023/9/a340474_2.jpg)
使用LINGO软件,编制程序如下:
model:
!6发点8收点运输问题;
sets:
warehouses/wh1..wh6/: capacity;
vendors/v1..v8/: demand;
links(warehouses,vendors): cost, volume;
endsets
!目标函数;
min=@sum(links: cost*volume);
!需求约束;
@for(vendors(J):
@sum(warehouses(I): volume(I,J))=demand(J));
!产量约束;
@for(warehouses(I):
@sum(vendors(J): volume(I,J))《=capacity(I));
!这里是数据;
data:
capacity=60 55 51 43 41 52;
demand=35 37 22 32 41 32 43 38;
cost=6 2 6 7 4 2 9 5
4 9 5 3 8 5 8 2
5 2 1 9 7 4 3 3
7 6 7 3 9 2 7 1
2 3 9 5 7 2 6 5
5 5 2 2 8 1 4 3;
enddata
end
然后点击工具条上的靶子按钮即可。
以上便是在LINGO中求解LP问题的详细步骤,如果你碰到难以解决的LP问题就可以借助这个方法来进行解决,当然LINGO远远不止这些功能,其它功能将会在后面的教程中给大家提供。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
利用U极速u盘启动盘装win7系统后出现蓝屏现象原因及解决办法
![](https://img.aspxhome.com/file/2023/28/a246394_0s.jpg)
如何设置不显示WPS表数据0值
![](https://img.aspxhome.com/file/2023/1/a170961_0s.png)
word文档语言选项在哪设置
PPT文字与图片穿插怎么设置?PPT图文穿插效果制作方法
![](https://img.aspxhome.com/file/2023/10/a350332_0s.jpg)
3.这样我们就可以快速提取Excel表格里的不重复值啦
win10如何关闭自动播放_win10如何关闭自动播放的方法
![](https://img.aspxhome.com/file/2023/3/a301101_0s.png)
浏览器网页502 bad gateway详细修复教程
![](https://img.aspxhome.com/file/2023/3/a297686_0s.jpg)
wps office单元格怎么删除?
![](https://img.aspxhome.com/file/2023/4/a168234_0s.png)
Win10系统应用商店闪退的解决方法
![](https://img.aspxhome.com/file/2023/5/a316610_0s.png)
金山数据恢复大师怎么恢复丢失数据 金山数据恢复大师恢复丢失数据的方法
![](https://img.aspxhome.com/file/2023/8/a338310_0s.jpg)
Win11地平线4闪退为什么 Win11玩地平线4闪退怎么解决
![](https://img.aspxhome.com/file/2023/27/a235919_0s.jpg)
Win10 20H1快速预览版19013推送(附更新内容)
![](https://img.aspxhome.com/file/2023/28/a241120_0s.jpg)
红米k20 pro怎么开启显示实时网速?红米k20 pro开启显示实时网速的方法
![](https://img.aspxhome.com/file/2023/6/a324989_0s.jpg)
Excel中进行财务函数汇总的使用介绍
Word2003文档打不开
![](https://img.aspxhome.com/file/2023/1/22121_0s.gif)
excel表格添加图片的方法
Win10正式版发布20天有多少中国用户在用这款新系统
![](https://img.aspxhome.com/file/2023/28/a248083_0s.jpg)
Win10如何在保留个人文件的前提下重置系统?
![](https://img.aspxhome.com/file/2023/30/a266665_0s.jpg)
苹果:正在调查 M1 Mac Mini显示 “粉红色方块”的问题
![](https://img.aspxhome.com/file/2023/0/a208290_0s.jpeg)
pr为什么倒放会卡?pr倒放视频画面卡怎么解决
![](https://img.aspxhome.com/file/2023/1/a274385_0s.jpg)