Lingo 函數講解

1 / 8

# Lingo 函數講解 - PowerPoint PPT Presentation

Lingo 函數講解. 作業研究概論作業八 曹飛廣 10214358. @BND 函數. @BND （ lower_bound,variable,upper_bound ） 原廠手冊介紹： Limits variable to being greater-than-or-equal-to lower_bound and less-than-or-equal-to upper_bound . 作用：限制變量大於等於底界且小於等於上界 例： @BND （ 0 ， X ， 9 ）； 限制 0&lt;=X&lt;=9 ；. @BND() 案例.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about ' Lingo 函數講解' - asher

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Lingo函數講解

@BND函數
• @BND（lower_bound,variable,upper_bound）
• 原廠手冊介紹：Limits variable to being greater-than-or-equal-to lower_bound and less-than-or-equal-to upper_bound.
• 作用：限制變量大於等於底界且小於等於上界
• 例：@BND（0，X，9）；
• 限制0<=X<=9；
@BND()案例
• 給定一個直角三角形，求包含該三角形的最小正方形
• model:
•  sets:
•  object/1..3/: f;
• endsets data:   a, b = 3, 4;
• enddata
•  f(1) = a * @sin(x);   f(2) = b * @cos(x);   f(3) = a * @cos(x) + b * @sin(x);
•    min = @smax(f(1),f(2),f(3));
• @bnd(0,x,1.57);
• end
@IN函數
• @IN(set_name,primitive_1_index[,primitive_2_index…]);
• 原廠手冊：This returns TRUE if the set member referenced by the primitive set member index tuple (primitive_1_index, primitive_2_index, ...) is contained in the set_name set.
• 作用：當一組成員是從原始集合引用並包含在set_name集合時，此函數返回真值
@IN()案例
• SETS:
• PLANTS /SEATTLE, DENVER, CHICAGO,ANTLANTA/:;
• CLOSED(PLANTS) /DENVER/:;
• OPEN(PLANTS)| #NOT# @IN (CLOSED,&1):;
• ENDSETS
• 解釋：OPEN集合源於PLANTS集合，用包含@IN函數的獅子允許不屬於CLOSED的PLANTS定義為OPEN集合
@INDEX函數
• @INDEX( set_name, set_member) ；
• 原廠手冊：This returns the index of a set member set_member in the set set_name. If the specified set member does not belong to the set @INDEX will return 0. @INDEX allows you to refer to set member names directly.
• 作用：此函數用於判斷set_member是否屬於set_name集合，屬於則給出其在集合的對應數值。
@INDEX()案例
• SETS:
• ROWS /R1..R27/;
• COLS /C1..C3/;
• RXC( ROWS, COLS): XRNG;
• ENDSETS
• ! return the index of (r1,c3) in the rxc set;
• NDX = @INDEX( RXC, R1, C3);
• 在這個例子中， (r1,c3) 在派生集合RXC，@INDEX將成員名稱轉換為對應數值賦給NDX。