關(guān)于Lingo案例分析_第1頁
關(guān)于Lingo案例分析_第2頁
關(guān)于Lingo案例分析_第3頁
關(guān)于Lingo案例分析_第4頁
關(guān)于Lingo案例分析_第5頁
已閱讀5頁,還剩38頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、最小費(fèi)用運(yùn)輸問題單位 銷地運(yùn)價(jià)產(chǎn)地B1B2B3B4B5B6B7B8產(chǎn)量A16267425960A24953858255A35219743351A47673927143A52395726541A65522814352銷量3537223241324338280/302i.e:model:!6發(fā)點(diǎn)8收點(diǎn)運(yùn)輸問題;sets: warehouses/wh1.wh6/: capacity; vendors/v1.v8/: demand; links(warehouses,vendors): cost, volume;endsets!目標(biāo)函數(shù); min=sum(links: cost*volume);!需求

2、約束; for(vendors(J): sum(warehouses(I): volume(I,J)=demand(J);!產(chǎn)量約束; for(warehouses(I): sum(vendors(J): volume(I,J)=0, FLOOR returns the largest integer, I, such that I =X.LGM( X)This returns the natural (base e) logarithm of the gamma function of X (i.e., log of (X - 1)!). It is extended to noninteg

3、er values of X by linear interpolation.Note:伽瑪方程表達(dá)式為:(x)=e(-t)*t(x-1)dt (積分的下限式0,上限式+) 利用分部積分法(integration by parts)我們可以得到 (x)=(x-1)*(x-1) LOG( X)This returns the natural logarithm of X.MOD( X,Y)This returns the value of X modulo Y, or, in other words, the remainder of an integer divide of X by Y.PO

4、W( X,Y) This returns the value of X rasied to the Y power.SIGN( X)This returns -1 if X 0. Otherwise, it returns +1.SIN( X)This returns the sine of X, where X is the angle in radians.SMAX( X1, X2,., XN)This returns the maximum value of X1, X2, ., and XN.SMIN( X1, X2,., XN)This returns the minimum val

5、ue of X1, X2, ., and XN.SQR( X)This returns the value of X squared. SQRT( X)This returns the square root of X.TAN( X)This returns the tangent of X, where X is the angle in radians3.3 金融函數(shù)(Financial Functions)LINGO currently offers two financial functions. One computes the present value of an annuity

6、. The other returns the present value of a lump sum.FPA( I, N)This returns the present value of an annuity. That is, a stream of $1 payments per period at an interest rate of I for N periods starting one period from now. I is not a percentage, but a fraction representing the interest rate (e.g., you

7、 would use .1 to represent 10%). To get the present value of an annuity stream of $X payments, multiply the result by X.返回如下情形的凈現(xiàn)值:?jiǎn)挝粫r(shí)段利率為I,連續(xù)n個(gè)時(shí)段支付,每個(gè)時(shí)段支付單位費(fèi)用。若每個(gè)時(shí)段支付x單位的費(fèi)用,則凈現(xiàn)值可用x乘以fpa(I,n)算得。fpa的計(jì)算公式為。凈現(xiàn)值就是在一定時(shí)期內(nèi)為了獲得一定收益在該時(shí)期初所支付的實(shí)際費(fèi)用。年值,用A(Annuity)表示。它表示發(fā)生在每年的等額現(xiàn)金流量,即在某個(gè)特定時(shí)間序列內(nèi),每隔相同時(shí)間收入或支出的等額資金。在

8、工程經(jīng)濟(jì)分析計(jì)算中,如無特別說明,一般約定A 發(fā)生在期末,如第1 年末、第2 年末等。i.e:貸款買房問題 貸款金額50000元,貸款年利率5.31%,采取分期付款方式(每年年末還固定金額,直至還清)。問擬貸款10年,每年需償還多少元?LINGO代碼如下:50000 = x * fpa(.0531,10);結(jié)果:Feasible solution found. Total solver iterations: 0 Variable Value X 6573.069 Row Slack or Surplus 1 0.000000FPL( I, N)This returns the present

9、 value of a lump sum of $1 N periods from now if the interest rate is I per period. I is not a percentage, but a fraction representing the interest rate (e.g., you would use .1 to represent 10%). To get the present value of a lump sum of $X, multiply the result by X.返回如下情形的凈現(xiàn)值:?jiǎn)挝粫r(shí)段利率為I,第n個(gè)時(shí)段支付單位費(fèi)用。f

10、pl(I,n)的計(jì)算公式為。以上兩個(gè)函數(shù)存在的關(guān)系為:。3.4 概論函數(shù)(Probability Functions)LINGO has a number of probability related functions. There are examples that make use of most of these functions in Developing More Advanced Models and in Additional Examples of LINGO Modeling.PBN( P, N, X) 二項(xiàng)分布的累積分布函數(shù)This is the cumulative

11、binomial probability. It returns the probability that a sample of N items, from a universe with a fraction of P of those items defective, has X or less defective items. It is extended to non-integer values of X and N by linear interpolation.PCX( N, X) 自由度為n的2分布的累積分布函數(shù)This is the cumulative distribut

12、ion function for the Chi-squared distribution with N degrees of freedom. It returns the probability that an observation from this distribution is less-than-or-equal-to X.PEB( A, X) 當(dāng)?shù)竭_(dá)負(fù)荷為a,服務(wù)系統(tǒng)有x個(gè)服務(wù)器且允許無窮排隊(duì)時(shí)的Erlang繁忙概率This is Erlang抯 busy probability for a service system with X servers and an arrivi

13、ng load of A, with infinite queue allowed. The result of PEB can be interpreted as either the fraction of time all servers are busy or the fraction of customers that must wait in the queue. It is extended to noninteger values of X by linear interpolation. The arriving load, A, is the expected number

14、 of customers arriving per unit of time multiplied by the expected time to process one customer.PEL( A, X) 當(dāng)?shù)竭_(dá)負(fù)荷為a,服務(wù)系統(tǒng)有x個(gè)服務(wù)器且不允許排隊(duì)時(shí)的Erlang繁忙概率。This is Erlang抯 loss probability for a service system with X servers and an arriving load of A, no queue allowed. The result of PEL can be interpreted as ei

15、ther the fraction of time all servers are busy or the fraction of customers lost due to all servers being busy when they arrive. It is extended to noninteger values of X by linear interpolation. The arriving load, A, is the expected number of customers arriving per unit of time multiplied by the exp

16、ected time to process one customer.PFD( N, D, X) 自由度為n和d的F分布的累積分布函數(shù)。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. It returns the probability that an observation from this distribution is les

17、s-than-or-equal-to X.PFS( A, X, C)當(dāng)負(fù)荷上限為a,顧客數(shù)為c,平行服務(wù)器數(shù)量為x時(shí),有限源的Poisson服務(wù)系統(tǒng)的等待或返修顧客數(shù)的期望值。a是顧客數(shù)乘以平均服務(wù)時(shí)間,再除以平均返修時(shí)間。當(dāng)c和(或)x不是整數(shù)時(shí),采用線性插值進(jìn)行計(jì)算。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 l

18、imiting load A. It is extended to noninteger values of X and C by linear interpolation. A, the limiting load, is the number of customers multiplied by the mean service time divided by the mean repair time.PHG( POP, G, N, X) 超幾何(Hypergeometric)分布的累積分布函數(shù)。pop表示產(chǎn)品總數(shù),g是正品數(shù)。從所有產(chǎn)品中任意取出n(npop)件。pop,g,n和x都可以

19、是非整數(shù),這時(shí)采用線性插值進(jìn)行計(jì)算。This is the cumulative hypergeometric probability. It returns the probability that X or fewer items in the sample are good, given a sample without replacement of N items from a population of size POP where G items in the population are good. It is extended to noninteger values of P

20、OP, G, N, and X by linear interpolation.PPL( A, X)Poisson分布的線性損失函數(shù),即返回max(0,z-x)的期望值,其中隨機(jī)變量z服從均值為a的Poisson分布。This is the linear loss function for the Poisson distribution. It returns the expected value of MAX( 0, Z-X), where Z is a Poisson random variable with mean value A.PPS( A, X)均值為a的Poisson分布的累

21、積分布函數(shù)。當(dāng)x不是整數(shù)時(shí),采用線性插值進(jìn)行計(jì)算。This is the cumulative Poisson probability distribution. It returns the probability that a Poisson random variable, with mean value A, is less-than-or-equal-to X. It is extended to noninteger values of X by linear interpolation.PSL( X)單位正態(tài)線性損失函數(shù),即返回max(0,z-x)的期望值,其中隨機(jī)變量z服從標(biāo)準(zhǔn)

22、正態(tài)分布。This is the unit normal linear loss function. It returns the expected value of MAX( 0, Z-X), where Z is a standard normal random variable. In inventory modeling, PSL( X) is the expected amount that demand exceeds a level X, if demand has a standard normal distribution.PSN( X)標(biāo)準(zhǔn)正態(tài)分布的累積分布函數(shù)。This

23、is the cumulative standard normal probability distribution. A standard normal random variable has mean 0.0 and standard deviation 1.0 (the bell curve, centered on the origin). The value returned by PSN is the area under the curve to the left of the point on the ordinate indicated by X.PTD( N, X)自由度為

24、n的t分布的累積分布函數(shù)。This is the cumulative distribution function for the t distribution with N degrees of freedom. It returns the probability that an observation from this distribution is less-than-or-equal-to X.QRAND( SEED) 產(chǎn)生服從(0,1)區(qū)間的均勻擬隨機(jī)數(shù)。qrand只允許在模型的數(shù)據(jù)部分使用,它將用擬隨機(jī)數(shù)填滿集屬性。通常,聲明一個(gè)mn的二維表,m表示運(yùn)行實(shí)驗(yàn)的次數(shù),n表示每次實(shí)

25、驗(yàn)所需的隨機(jī)數(shù)的個(gè)數(shù)。在行內(nèi),隨機(jī)數(shù)是獨(dú)立分布的;在行間,隨機(jī)數(shù)是非常均勻的。這些隨機(jī)數(shù)是用“分層取樣”的方法產(chǎn)生的。The QRAND produces a sequence of quasi-random uniform numbers in the interval (0,1). QRAND is only permitted in a data section. It will fill an entire attribute with quasi-random numbers. Generally, you will be filling two-dimensional tables

26、 with, say, m rows and n variables. m represents the number of scenarios, or experiments, you want to run. n represents the number of random variables you need for each scenario or experiment. Within a row, the numbers are independently distributed. Among rows, the numbers are super uniformly distri

27、buted. That is, the numbers are more uniformly distributed than you would expect by chance. These numbers are generated by a form of stratified sampling. For example, suppose m = 4 and n = 2. Even though the numbers are random, you will find that there will be exactly one row in which both numbers a

28、re in the interval (0, .5), exactly one row in which both numbers are in (.5, 1), and two rows in which one number is less than .5 and the other is greater than .5. Using QRAND allows you to get much more accurate results for a given number of random numbers in a Monte Carlo model. If you want 8 ord

29、inary random numbers, then use QRAND(1,8) rather than QRAND(4,2). An example of QRAND follows:i.e:MODEL: DATA: M = 4; N = 2; SEED = 1234567; ENDDATA SETS: ROWS /1.M/; COLS /1.N/; TABLE( ROWS, COLS): X; ENDSETS DATA: X = QRAND( SEED); ENDDATAENDi.e:MODEL: DATA: M = 8; N = 1; SEED = 1234567; ENDDATA S

30、ETS: ROWS /1.M/; COLS /1.N/; TABLE( ROWS, COLS): X; ENDSETS DATA: X = QRAND( SEED); ENDDATAENDExample of QRAND functionIf you dont specify a seed value for QRAND, then LINGO will use the system clock to construct a seed value. 如果沒有為函數(shù)指定種子,那么LINGO將用系統(tǒng)時(shí)間構(gòu)造種子。rand(seed)This returns a pseudo-random numb

31、er between 0 and 1, depending deterministically on SEED.返回0和1間的偽隨機(jī)數(shù),依賴于指定的種子。典型用法是U(I+1)=rand(U(I)。注意如果seed不變,那么產(chǎn)生的隨機(jī)數(shù)也不變。利用rand產(chǎn)生15個(gè)標(biāo)準(zhǔn)正態(tài)分布的隨機(jī)數(shù)model:!產(chǎn)生一列正態(tài)分布的隨機(jī)數(shù);sets: series/1.15/: u, znorm;endsets !第一個(gè)均勻分布隨機(jī)數(shù)是任意的; u( 1) = rand( .1234); !產(chǎn)生其余的均勻分布的隨機(jī)數(shù); for(series( I)| I #GT# 1: u( I) = rand( u( I

32、- 1) ); for( series( I): !正態(tài)分布隨機(jī)數(shù); psn( znorm( I) = u( I); !ZNORM可以是負(fù)數(shù); free( znorm( I); );end3.5 變量界定函數(shù)(Variable Domain Functions)The default assumption for a variable is that it is continuous with a lower bound of 0. Variable domain functions place additional restrictions on the values that variab

33、les can assume. The functions and their effects are as follows:BIN( variable) 限制x為0或1This restricts variable to being a binary (0/1) integer value. BND( lower_bound, variable, upper_bound) 限制LxUThis limits variable to being greater-than-or-equal-to lower_bound and less-than-or-equal-to upper_bound.

34、FREE( variable) 取消對(duì)變量x的默認(rèn)下界為0的限制,即x可以取任意實(shí)數(shù)This removes the default lower bound of zero on variable, allowing it to take any positive or negative value. GIN( variable)限制x為整數(shù)This restricts variable to integer values (e.g., 0,1,2, .).You may use the FOR function to apply variable domain functions to al

35、l the elements of an attribute. Variable domain functions are discussed in detail in Using Variable Domain Functions.3.6 集操作函數(shù)(Set Handling Functions)LINGO offers several functions that assist with handling sets. The IN function determines if a set element is contained in a set. The INDEX function r

36、eturns the index of a primitive set element within its set. The SIZE function returns the number of elements in a set. Finally, the WRAP function is useful for wrapping set indices from one end of a time horizon to another in multiperiod planning models. These are described in more detail below.IN(

37、set_name, primitive_index_1 , primitive_index_2 .)如果元素在指定集中,返回1;否則返回0。This returns TRUE if the set member referenced by the index tuple (primitive_index_1, primitive_index_2, .) is contained in the set_name set. As the following example shows, the IN operator is useful for generating complements of

38、subsets in set membership conditions. i.e:全集為I,B是I的一個(gè)子集,C是B的補(bǔ)集。sets: I/x1.x4/; B(I)/x2/; C(I)|#not#in(B,&1):;endsetsINDEX( set_name, primitive_set_element)該函數(shù)返回在集set_name中原始集成員primitive_set_element的索引。如果set_name被忽略,那么LINGO將返回與primitive_set_element匹配的第一個(gè)原始集成員的索引。如果找不到,則產(chǎn)生一個(gè)錯(cuò)誤。This returns the index o

39、f the primitive set element primitive_set_element in the optionally supplied set set_name. If the set name is omitted, LINGO returns the index of the first primitive set element it finds with a name matching primitive_set_element. If LINGO is unable to find primitive_set_element, an error is generated. SIZE( set_name)該函數(shù)返回集set_n

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論