当前位置:网站首页>Lingo软件的使用
Lingo软件的使用
2022-07-26 14:25:00 【是数学系的小孩儿】
文章目录
Lingo软件的基本语法
1.1.集合
set:
集合名称1/成员列表1/:属性1-1,属性1-2,……,属性1-n1;
集合名称2/成员列表2/:属性2-1,属性2-2,……,属性2-n2;
派生集合名称(集合名称1,集合名称2):属性3-1,属性3-2,……,属性3-n3;
endsets
例子
sets:
product/A B/;
machine/M N/;
week/1..2/;
allowed(product,machine,week):x;
endsets
1.2.数据
data:
属性1=数据列表;
属性2=数据列表;
enddata
1.3.数据计算段
数据计算段部分不能含有变量,必须是已知数据的运算
calc:
b=0;
a=a+1;
endcalc
1.4.变量的初始化
变量的初始化主要用于非线性问题赋值初始值
init:
X,Y=0,.1;
endinit
Y=@log(X);
X^2+Y^2<=1;
好的初始点会减少模型的求解时间

1.6. 实时数据处理
data:
interest_rate,inflation_rate=.085?;
enddata
注
- Lingo中是不区分大小写字符的
- Lingo中数据部分不能使用分式,不能用1/2
- Lingo中注释是用!进行引导的
- Lingo中默认的所有变量都是非负的
- Lingo中矩阵数据是逐行储存,Matlab中的数据是逐列储存的
Lingo函数
2.1.算术运算符
2.2.逻辑运算符
逻辑运算符主要用于集循环函数的条件表达式中,来控制在函数值哪些集成员被包含,哪些被排斥。在创建稀疏矩阵集时用在成员资格过滤器中。
2.3.关系运算符
只有三种
=、<=,>=
他不支持严格小于或严格大于。
2.6.集循环函数
@for:该函数用来产生对集成员的约束
@sum:该函数返回遍历指定的集成员的一个表达式的和
@min和@max:返回指定的集成员的一个表达式的最小值和最大值
求向量[5,1,3,4,6,10]前5个数的最小值,后3个数的最大值。
model:
data:
N=6;
enddata
sets:
number/1..N/:x;
endsets
data:
x=5 1 3 4 6 10;
enddata
minv=@min(number(i)|i#le#5:x);
maxv=@max(number(i)|i#ge#N-2:x);
end


参考文献
司守奎,孙兆亮.数学建模算法与应用.国防工业出版社,第二版.
感谢百度翻译对本文章的大力支持
1.inflation
时间
2022年7月16日15:00:00——16:03:27
边栏推荐
- Use of URL download resources
- Learning basic knowledge of Android security
- C language_ Structure pointer variable introduction
- Prediction and value evaluation of technology fusion relationship based on multiple features
- 请问数据库规范的文档吗 参考一下?
- OA项目之我的会议
- Arithmetic operation and logic operation of image in opencv
- [GYCTF2020]FlaskApp
- 中部“第一城”,长沙“人才引力”从争先到领先
- Leetcode36 effective Sudoku
猜你喜欢

Image-Level 弱监督图像语义分割汇总简析

基于专利多属性融合的技术主题划分方法研究

OpenCV中图像算术操作与逻辑操作

敏捷开发与DevOps的对比

Leetcode215 the kth largest element (derivation of quick sort partition function)

Leetcode1170- compare the occurrence frequency of the minimum letter of the string (the corresponding occurrence frequency of each string minimum element in the map set storage array)

Some lightweight network models in detection and segmentation (share your own learning notes)

Install dexdump on win10 and remove the shell

基于双层主题模型的技术演化分析框架及其应用
![[ostep] 02 virtualized CPU - process](/img/0b/3f151ccf002eb6c0469bf74072a3c5.png)
[ostep] 02 virtualized CPU - process
随机推荐
Leetcode148 sort linked list (merge method applied to merge)
中部“第一城”,长沙“人才引力”从争先到领先
Instructions for various interfaces of hand-held vibrating wire collector vh03
MySQL-03 数据库操作
MySQL-04 存储引擎和数据类型
C language_ Structure pointer variable introduction
C language Snake linked list and pointer practice
Would you please tell me if there is a way for Flink SQL not to output update_ before?
Large and small end mode
[untitled]
Use cpolar to build a commercial website (apply for website security certificate)
How to do app upgrade test?
关于存储芯片的入门基础知识
Unity学习笔记–无限地图
Red * is added to the input box to indicate mandatory items
Plato farm is expected to further expand its ecosystem through elephant swap
请问数据库规范的文档吗 参考一下?
[deep learning] fully connected network
When AI encounters life and health, Huawei cloud builds three bridges for them
MLX90640 红外热成像仪测温传感器模块开发笔记(六)