博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
LINGO的数据段
阅读量:5951 次
发布时间:2019-06-19

本文共 3350 字,大约阅读时间需要 11 分钟。

The DATA Section

Typically, you willwant to initialize the members of certain sets and assign values to certain set
attributes. For this purpose, LINGO uses a second optional section called the datasection. The data
section
allows you to isolate data from the equations of your model.This is a useful practice in that it
leads to easier model maintenance and facilitates scaling up a model to largerdimensions.

数据段

通常情况下,你想初始化某些集的成员并将值赋给某些特定集的属性。为此,LINGO使用另一个称为数据段的可选部分。数据段允许你从你的模型方程中抽象出数据。这是有用的做法,因为它促进维护更简单的模型并使模型扩大到更大规模。

Similar to the sets section, the data section begins with the keyword
DATA: (includingthe colon) and
ends with the keyword
ENDDATA. In the data section, you can havestatements to initialize the sets
and/or attributes you defined in a sets section. These expressions have thesyntax:
object_list =
value_list;

类似于集合段,数据段以关键字DATA:(包括冒号)开始, 以ENDDATA关键字结束。在数据段中,你可以初始化集合、在集合段中定义的属性。其语法为:

         object_list = value_list;

The
object_list contains the names of a set and/or attributes you wantto initialize, optionally separated
by commas. If there is more than one attribute name on in the object list, thenall attributes must be
defined on the same set. Furthermore, if a set name appears in the object list,then it must be the parent
set of any attributes also in the object list. The
value_list containsthe values to assign to the objects in
the object list
, optionally separated by commas. For example, considerthe following model:
MODEL:
SETS:
SET1: X, Y;
ENDSETS
DATA:
SET1 = A B C;
X = 1 2 3;
Y = 4 5 6;
ENDDATA
END
We have twoattributes,
X and
Y, defined on the set
SET1. The threevalues of
X are set to 1, 2, and 3,
while
Y is set to 4, 5, and 6. We could have also used the followingcompound data statement to the
same end:
MODEL:
SETS:
SET1: X, Y;
ENDSETS
DATA:
SET1 X Y = A 1 4
B 2 5
C 3 6;
ENDDATA
END

对象列(object_list)包含要设置集成员的集名、要指定值的属性名,用逗号隔开。如果对象列中有多个属性名,那么它们的类型必须一致。此外,如果对象列中有一个集名,那么对象列中所有的属性的类型就是这个集。数值列(value_list)包含要分配给对象列中的对象的值,用逗号隔开。例如,考虑以下模型:

MODEL:

SETS:

SET1:X, Y;

ENDSETS

DATA:

SET1 =A B C;

X = 1 23;

Y = 4 56;

ENDDATA

END

在集SET1中定义了两个属性X和Y。X的三个值设置为 1、 2 和 3,Y的三个值是4、 5 和 6。也可以使用如下的复合数据声明实现同样的功能:

MODEL:

SETS:

SET1:X, Y;

ENDSETS

DATA:

SET1 XY = A 1 4

B 2 5

C 3 6;

ENDDATA

END

An important factto remember is that when LINGO reads a compound data statement's value list, it
assigns the first
n values in the list to the first position of each ofthe
n objects in the object list, the
second
n values to the second position of each of the
n objects,and so on. In other words, LINGO is
expecting the input data in column format rather than row format, which mirrorsthe flat file approach
used in relational databases. 

要记住的重要一点是,当LINGO读取复合数据语句的数值列,它指定列表中的第一次n值的每个在对象列中的n对象,到第二次出现的n对象、每第二次n值的第二个位置等等。换句话说,LINGO期待反映在关系数据库中使用的平面文件方法的输入数据的列格式,而不是行格式。

This section hasserved to give you a brief introduction into the use of the data section. In Dataand
Init Sections
, you will learn more about the capabilities of the datasection. You will learn data does
not have to actually reside in the data section as shown in examples here. Infact, your data section can
have OLE links to Excel, ODBC links to databases, and connections to text baseddata files.

这一节给你简要介绍数据段的使用。在数据和初始化部分,你将学习更多关于数据段的功能。你将了解数据而不必拘束在示例的数据段中。事实上,你的数据段中可以有链接到 Excel的OLE,链接到数据库的ODBC,以及链接到文本数据文件的连接。

 

转载于:https://www.cnblogs.com/Genesis2018/p/8304756.html

你可能感兴趣的文章
网站最后是.com\.cn\.net有什么区别么?
查看>>
DNS 服务器的搭建
查看>>
LINUX -bash java command not found
查看>>
【docker】02、docker安装
查看>>
num_plus_sep
查看>>
将博客搬至CSDN
查看>>
Spring2.5学习笔记2-AOP-基本概念
查看>>
TCP/IP三次握手详细过程
查看>>
马哥linux+python——2015年9月1日课程作业
查看>>
你的梦想还在吗
查看>>
BIGIP-LTM中的NAT和SNAT
查看>>
sed单行处理命令奇偶行输出
查看>>
走向DBA[MSSQL篇] 从SQL语句的角度 提高数据库的访问性能
查看>>
VC++深入详解学习笔记1
查看>>
对OpenBSD中的OSPF和BGP路由协议的探索
查看>>
安装配置discuz
查看>>
CentOS7 64位小型操作系统的安装
查看>>
线程互互斥锁
查看>>
KVM虚拟机&openVSwitch杂记(1)
查看>>
使用Jmeter进行http接口测试
查看>>