【文章內(nèi)容簡介】
字型 stringM..stringN Car101..car208 Car101, car102, … , car208 星期型 dayM..dayN MON..FRI MON, TUE, WED, THU, FRI 月份型 monthM..monthN OCT..JAN OCT, NOV, DEC, JAN 年份 月份型 monthYearM..monthYearN OCT2022..JAN2002 OCT2022, NOV2022, DEC2022, JAN2022 2022/1/4 36 運算符的優(yōu)先級 三類運算符: 算術(shù)運算符 邏輯運算符 關(guān)系運算符 優(yōu)先級 運算符 最高 NOT —(負號) ^ * / + —(減法) EQ NE GT GE LT LE AND OR 最低 (=) = (=) 2022/1/4 37 基本的數(shù)學(xué)函數(shù) @ABS(X) @COS(X) @EXP(X) @FLOOR(X) 指數(shù)函數(shù) @LGM(X) GAMMA函數(shù)的自然對數(shù)值 @LOG(X) @MOD(X,Y) @POW(X,Y) @SINGN(X) @SIN(X) @SMAX(LIST) @SMIN(LIST) @SQR(X) @SQRT(X) @TAN(X) 2022/1/4 38 集合循環(huán)函數(shù) 四個集合循環(huán)函數(shù): FOR、 SUM 、 MAX、 MIN @function( setname [ ( set_index_list)[ | condition]] : expression_list)。 For example: [objective] MAX = @SUM( PAIRS( I, J): BENEFIT( I, J) * MATCH( I, J))。 @FOR(STUDENTS( I): [constraints] @SUM( PAIRS( J, K) | J EQ I OR K EQ I: MATCH( J, K)) =1)。 @FOR(PAIRS( I, J): @BIN( MATCH( I, J)))。 MAXB=@MAX(PAIRS( I, J): BENEFIT( I, J))。 MINB=@MIN(PAIRS( I, J): BENEFIT( I, J))。 2022/1/4 39 集合操作函數(shù) 對于集合進行操作的函數(shù), 包括: @IN,@INDEX,@WRAP,@SIZE @INDEX([SET_NAME,]PRIMITIVE_SET_ELEMENT) @IN(set_name,primitive_index_1[,primitive_index_2…]) @WRAP(I,N) @SIZE(SET_NAME) 2022/1/4 40 變量定界函數(shù) 用于對變量的取值范圍附加限制 @BND(L,X,U): 限制 L=X=U @BIN(X) : 限制 X=0 or 1 @FREE(X) : 取消對 X的符號限制 @GIN(X) :限制 X為整數(shù) 2022/1/4 41 概率論相關(guān)函數(shù) @PBN( P, N, X) This is the cumulative binomial probability. @PCX( N, X) This is the cumulative distribution function for the Chisquared distribution with N degrees of freedom. @PEB( A, X) This is Erlang抯 busy probability for a service system with X servers and an arriving load of A, @PEL( A, X) This is Erlang抯 loss probability for a service system with X servers and an arriving load of A, @PFD( N, D, X) This is the cumulative distribution function for the F distribution with N degrees of freedom in the numerator and D degrees of freedom in the denominator. @PFS( A, X, C) This returns the expected number of customers waiting for or under repair in a finite source Poisson service system with X servers in parallel, C customers, and a limiting load A. @PHG( POP, G, N, X) This is the cumulative hypergeometric probability. @PPL( A, X) This is the linear loss function for the Poisson distribution. @PPS( A, X) This is the cumulative Poisson probability distribution. @PSL( X) This is the unit normal linear loss function. @PSN( X) This is the cumulative standard normal probability distribution. @PTD( N, X) This is the cumulative distribution function for the t distribution with N degrees of freedom. @QRAND( SEED) The @QRAND produces a sequence of quasirandom uniform numbers in the interval (0,1). @RAND( SEED) This returns a pseudorandom number between 0 and 1, depending deterministically on SEED. 2022/1/4 42 文件輸出函數(shù) 用于控制通過文件的結(jié)果的輸入和輸出 @FILE(FILENAME) @ODBC @OLE @POINTER(N) @TEXT([‘filename’]) 2022/1/4 43 結(jié)果報告函數(shù) 用于輸出計算結(jié)果和與之相關(guān)的一些結(jié)果 @ITERS() @NEWLINE(n) @STRLEN(STRING) @NAME(var_or_row_reference) @WRITE(obj1[,…,objn]) @WRITEFOR(SETNAME[(SET_INDEX_LIST) [|CONDITON]]:OBJ1[,…,OBJN]) @FORMAT(VALUE,FORMAT_DESCRIPTOR) @RANGEU(VARIABLE_OR_ROW_NAME) @STATUS() 2022/1/4 44 Lingo 開發(fā)環(huán)境描述 2022/1/4 45 7個選項卡 (可設(shè)置 8090個控制參數(shù) ) 2022/1/4 46 使用外部數(shù)據(jù)文件 ? Cut (or Copy) – Paste 方法 ? @FILE 輸入數(shù)據(jù)、 @TEXT輸出數(shù)據(jù)(文本文件) ? @OLE函數(shù)與電子表格軟件(如 EXCEL)連接 ? @ODBC函數(shù)與數(shù)據(jù)庫連接 程序與數(shù)據(jù)分離 ? LINGO命令腳本文件 ? LG4 ( LINGO模型文件) ? LNG ( LINGO模型文件) ? LTF ( LINGO腳本文件) ? LDT ( LINGO數(shù)據(jù)文件) ? LRP ( LINGO報告文件) 常用文件后綴 2022/1/4 47 @FILE和 @TEXT:文本文件輸入輸出 MODEL: SETS: MYSET / @FILE(‘’) / : @FILE(‘’)。 ENDSETS MIN = @SUM( MYSET( I): SHIP( I) * COST( I))。 @FOR( MYSET( I): [CON1] SHIP( I) NEED( I)。 [CON2] SHIP( I) SUPPLY( I))。 DATA: COST = @FILE(‘’)。 NEED = @FILE(‘’)。 SUPPLY = @FILE(‘’)。 @TEXT(‘’)=SHIP, @DUAL(SHIP), @DUAL(CON1)。 ENDDATA END 、格式: Seattle,Detroit,Chicago,Denver~ COST,NEED,SUPPLY,SHIP~ 12,28,15,20~ 1600,1800,1200,1000~ 1700,1900,1300,1100 運行演示 2022/1/4 48 @OLE :與 EXCEL連接 MODEL: SETS: MYSET: COST,SHIP,NEED,SUPPLY。 ENDSETS MIN = @SUM( MYSET( I): SHIP( I) * COST( I))。 @FOR( MYSET( I): [CON1] SHIP( I) NEED( I)。 [CON2] SHIP( I) SUPPLY( I))。 DATA: MYSET =@OLE(39。D:\JXIE\BJ2022MCM\39。,39。CITIES39。)。 COST,NEED,SUPPLY =@OLE()。 @OLE(,39。SOLUTION39。)=SHIP。 ENDDATA END 須有下列名稱 (及數(shù) 據(jù) ): CITIES, COST, NEED, SUPPLY, SOLUTION ? 在 EXCEL中還可以通過 “ 宏 ” 自動調(diào)用 LINGO(略 ) ? 也可以將 EXCEL表格嵌入到 LINGO模型中 (略 ) 運行演示 2022/1/4 49 @ODBC :與數(shù)據(jù)庫連接 使用數(shù)據(jù)庫