函数·分析·方程版 #372532 层

@wrap函数有什么具体用法,请大家指教!

楼主 · 1 楼
@wrap函数有什么具体用法,请大家指教!
2 楼
类似于取模,略有不同,结果在[1,limit]之间,不会有0。@wrap(10,3)=1@wrap(11,3)=2@wrap(12,3)=3@wrap(13,3)=1
......

lingo帮助:@WRAP( INDEX, LIMIT)

This allows you to @wrap an index around the end of a set and continue indexing at the other end of the set. That is, when the last (first) member of a set is reached in a set looping function, use of @WRAP will allow you to wrap the set index to the first (last) member of the set. This is a particularly useful function in cyclical, multiperiod planning models.

Formally speaking, @WRAP returns J such that J = INDEX - K * LIMIT, where K is an integer such that J is in the interval [1,LIMIT]. Informally speaking, @WRAP will subtract or add LIMIT to INDEX until it falls in the range 1to LIMIT.

For an example on the use of the @WRAP function in a staff scheduling model, refer to the Primitive Set Example section in Using Sets.