运筹优化学习01:Lingo入门与错误列表分析(二)

简介: 运筹优化学习01:Lingo入门与错误列表分析

4 常见错误分析

4.1 错误代码29:数组初始化个数与指定数目不一致

若提供的数据数目与集合段指定的数据长度不一致,会报如下错误:

20190605224903364.png

意思是说:B变量初始化的个数少于集合段指定的数目;点击Explain按钮可以查询更详细的问题解释


You must assign a value to every element of each array in a DATA or INIT statement. LINGO keeps track of the number of values you specified and checks this against the length of each array being assigned. If the two numbers don’t agree, LINGO prints this message along with the number of values that are required.


4.2 错误代码12:缺少右括号报错

20190605225947605.png


意思是:这样代码缺了一个右括号


A LINGO expression is missing at least one closing right parenthesis. LINGO will point to the end of the expression where the error occurred. Count the number of parentheses in this expression to verify if you have input the correct number, or, in Window use the Edit|Match Parenthesis command to find the unmatched parenthesis.


4.3 错误代码11:无效的输入,语法错误

模型的【model】关键字没有加【:】


2019060523295383.png

This is the generic error issued by the LINGO compiler when it detects a syntax error. In Windows, when you close the error box, the cursor will be on the line where the error occurred. Other versions of LINGO will try print out the general area where the error has occurred, but LINGO cannot always pinpoint the exact line. Examine this area for any obvious syntax errors. If you are unable to find any obvious errors, a useful technique is to comment out small sections of the model until the error goes away. This should give you a good idea of exactly where the error is occurring.


Syntax errors may also occur if you are not invoking the correct compiler in LINGO.  Most users will choose to build models using the native LINGO syntax, however, some users may prefer building their models using LINDO syntax.  LINGO can compile models written in either native LINGO syntax or LINDO syntax.  LINGO chooses the compiler based on a model's file extension.  LINGO models must have an extension of lg4 (the default) or lng. LINDO models must have an ltx extension. The default model extension may be set by clicking on: LINGO | Options | Interface | File Format.  Each model window's title bar displays whether it is a LINGO or LINDO model.


5 LINGO的错误列表

LINGO出错时错误代码含义:

  在LINGO程序求解时,系统首先会对程序进行编译.系统在编译或执行其他命令时,会因程序中的错误或运行错误,弹出一个出错报告窗口,显示其错误代码,并简要指出错误的原因.这些错误报告信息能够提示用户发现程序中的错误,以便能尽快修改.下面我们给出出错信息的一个简要说明,仅供参考.

LINGO错误编号及原因对照表

image.png

image.png

image.png

image.png

image.png

image.png

image.png


相关文章
二维坐标系空间变换(详细解读,附MATLAB代码)
二维坐标系空间变换(详细解读,附MATLAB代码)
1425 0
二维坐标系空间变换(详细解读,附MATLAB代码)
|
Dubbo Java 应用服务中间件
深入Dubbo异步化:探索AsyncContext的神奇之处
深入Dubbo异步化:探索AsyncContext的神奇之处
325 0
|
机器人 C++ Python
ROS2教程 02 功能包
本文是关于ROS2(机器人操作系统2)中功能包(package)管理的教程,介绍了如何检查功能包的依赖、创建新功能包、列出可执行文件、列出所有功能包、查询功能包的位置和描述信息,以及为C++和Python功能包配置必要的文件。
416 0
|
10月前
|
存储 C语言 计算机视觉
在C语言中指针数组和数组指针在动态内存分配中的应用
在C语言中,指针数组和数组指针均可用于动态内存分配。指针数组是数组的每个元素都是指针,可用于指向多个动态分配的内存块;数组指针则指向一个数组,可动态分配和管理大型数据结构。两者结合使用,灵活高效地管理内存。
|
存储 IDE 语音技术
振南技术干货集:znFAT 硬刚日本的 FATFS 历险记(9)
振南技术干货集:znFAT 硬刚日本的 FATFS 历险记(9)
|
算法 安全 C++
【C++14算法】make_unique
【C++14算法】make_unique
697 0
|
数据采集 机器学习/深度学习 Python
掌握XGBoost:特征工程与数据预处理
掌握XGBoost:特征工程与数据预处理
891 3
|
算法 Java C++
branch and price求解VRPTW问题代码详解
branch and price求解VRPTW问题代码详解
802 0
branch and price求解VRPTW问题代码详解
|
决策智能
运筹优化学习04:Lingo的sum函数和for函数的使用方法介绍
运筹优化学习04:Lingo的sum函数和for函数的使用方法介绍
运筹优化学习04:Lingo的sum函数和for函数的使用方法介绍
|
机器学习/深度学习
【DR_CAN-MPC学习笔记】3&4.详细的MPC建模例子和matlab代码
【DR_CAN-MPC学习笔记】3&4.详细的MPC建模例子和matlab代码