Lingo中的集——基础介绍

LINGO(Linear Interactive and GeneralOptimizer)是由美国芝加哥大学的LinusSchrage教授于1980年开发,现属Lindo System公司的专门用于求解最优化问题的工具软件包。

之前暑期建模学习时,看过英文文档(LINGO14用户手册),当时也尝试着翻译了极少一部分,现在再翻译试试。( ﹁ ﹁ ) ~→

 

Why Use Sets?
Sets are the foundation of LINGO’s modeling language—the fundamental building block of the
program’s most powerful capabilities. With an understanding of sets, you can write a series of similar
constraints in a single statement and express long, complex formulas concisely. This allows you to
express your largest models very quickly and easily. In larger models, you’ll encounter the need to
express a group of several very similar calculations or constraints. Fortunately, LINGO’s ability to
handle sets of information allows you to perform such operations efficiently.
For example, preparing a warehouse-shipping model for 100 warehouses would be tedious if you had
to write each constraint explicitly (e.g., “Warehouse 1 must ship no more than its present inventory,
Warehouse 2 must ship no more than its present inventory, Warehouse 3 must ship no more than its
present inventory…”, and so on). LINGO allows you to express formulas in the form easiest for you to
read and understand (e.g., “Each warehouse must ship no more than its present inventory”).

 

为什么使用集?

集是LINGO建模语言的基础——程序最强大的的基本构成部分。根据对集合的理解,你能用单一的声明,简明地表达长的、复杂的公式,写出一系列相似的约束条件。这使得你快速、简单地表达最大的模型。在较大的模型中,你需要表达一组几个非常相似的计算或约束条件。幸运的是,LINGO能处理这些信息的集,使得你有效的执行这样的操作。

比如:如果你必须明确得写出每个约束,那么准备100个的仓库运输模型将是冗长乏味的(例如,仓库1必须运送不超过它当前的库存,仓库2必须运送不超过它当前的库存,仓库3必须运送不超过它当前的库存......,等等)。LINGO可以用你阅读、理解最简单的形式表达公式(比如,每个仓库必须运送不超过它当前的库存)。

 

What Are Sets?
Sets are simply groups of related objects. A set might be a list of products, trucks, or employees. Each
member in the set may have one or more characteristics associated with it. We call these
characteristics attributes. Attribute values can be known in advance or unknowns that LINGO solves
for. For example, each product in a set of products might have a price attribute; each truck in a set of
trucks might have a hauling capacity attribute; and each employee in a set of employees might have a
salary attribute, as well as a birth date attribute.

 

什么是集?

集是简单的相联系对象的组。一个集可能是一组产品、卡车或雇员。每个成员可能有与它关联的一个或多个特性。我们称这些特性为属性。属性值可以是LINGO求解时已知或未知的。比如,一套产品中的每个产品可能会有一个价格属性;卡车组里的每辆卡车可能具有牵引能力属性;一组雇员里的每个员工可能有薪水属性以及出生日期属性。

 

Types of Sets
LINGO recognizes two kinds of sets: primitive and derived.
A primitive set is a set composed only of objects that can’t be further reduced. In the Wireless Widgets
example (page 27), the WAREHOUSES set, which is composed of six warehouses, is a primitive set.
Likewise, the set composed of eight vendors is a primitive set.
A derived set is defined using one or more other sets. In other words, a derived set derives its members
from other preexisting sets. Again, using the Wireless Widgets example, the set composed of the links
between the six warehouses and eight vendors (LINKS) is a derived set. It derives its members from
the unique pairs of members of the WAREHOUSES and VENDORS sets. Although the LINKS set is
derived solely from primitive sets, it is also possible to build derived sets from other derived sets as
well. See the section below, Defining Derived Sets, for more information.

 

集的类型

LINGO可识别的集有两种类型:原始集和派生集。

一个原始集是由一些最基本的对象组成的。在无线小部件示例(第27页,英文文档)中,由六个仓库组成的仓库集是一个原始集。同样的,由八个供应商组成的集也是一个原始集。

派生集定义为使用一个或多个其他的集。换句话说,派生集从其它先前存在的集中派生它的成员。再一次使用无线小部件的示例,由六个仓库和八个供应商(联系)之间的的联系组成的集是一个派生集。它从仓库和供应商这独特组合中派生它的成员。尽管联系集完全来自原始集,它也可能从其他派生集中产生。了解更多信息请参见下面的部分,定义派生集。

 

原文地址:https://www.cnblogs.com/Genesis2018/p/8304758.html