版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、最小费用运输问题单位 销地运价产地B1B2B3B4B5B6B7B8产量A16267425960A24953858255A35219743351A47673927143A52395726541A65522814352销量3537223241324338280/302i.e:model:!6发点8收点运输问题;sets: warehouses/wh1.wh6/: capacity; vendors/v1.v8/: demand; links(warehouses,vendors): cost, volume;endsets!目标函数; min=sum(links: cost*volume);!需求
2、约束; for(vendors(J): sum(warehouses(I): volume(I,J)=demand(J);!产量约束; 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:伽玛方程表达式为:(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 金融函数(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.返回如下情形的净现值:单位时段利率为I,连续n个时段支付,每个时段支付单位费用。若每个时段支付x单位的费用,则净现值可用x乘以fpa(I,n)算得。fpa的计算公式为。净现值就是在一定时期内为了获得一定收益在该时期初所支付的实际费用。年值,用A(Annuity)表示。它表示发生在每年的等额现金流量,即在某个特定时间序列内,每隔相同时间收入或支出的等额资金。在
8、工程经济分析计算中,如无特别说明,一般约定A 发生在期末,如第1 年末、第2 年末等。i.e:贷款买房问题 贷款金额50000元,贷款年利率5.31%,采取分期付款方式(每年年末还固定金额,直至还清)。问拟贷款10年,每年需偿还多少元?LINGO代码如下:50000 = x * fpa(.0531,10);结果: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.返回如下情形的净现值:单位时段利率为I,第n个时段支付单位费用。f
10、pl(I,n)的计算公式为。以上两个函数存在的关系为:。3.4 概论函数(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) 二项分布的累积分布函数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分布的累积分布函数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) 当到达负荷为a,服务系统有x个服务器且允许无穷排队时的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) 当到达负荷为a,服务系统有x个服务器且不允许排队时的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分布的累积分布函数。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)当负荷上限为a,顾客数为c,平行服务器数量为x时,有限源的Poisson服务系统的等待或返修顾客数的期望值。a是顾客数乘以平均服务时间,再除以平均返修时间。当c和(或)x不是整数时,采用线性插值进行计算。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)分布的累积分布函数。pop表示产品总数,g是正品数。从所有产品中任意取出n(npop)件。pop,g,n和x都可以
19、是非整数,这时采用线性插值进行计算。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分布的线性损失函数,即返回max(0,z-x)的期望值,其中随机变量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、积分布函数。当x不是整数时,采用线性插值进行计算。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)单位正态线性损失函数,即返回max(0,z-x)的期望值,其中随机变量z服从标准
22、正态分布。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)标准正态分布的累积分布函数。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分布的累积分布函数。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) 产生服从(0,1)区间的均匀拟随机数。qrand只允许在模型的数据部分使用,它将用拟随机数填满集属性。通常,声明一个mn的二维表,m表示运行实验的次数,n表示每次实
25、验所需的随机数的个数。在行内,随机数是独立分布的;在行间,随机数是非常均匀的。这些随机数是用“分层取样”的方法产生的。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. 如果没有为函数指定种子,那么LINGO将用系统时间构造种子。rand(seed)This returns a pseudo-random numb
31、er between 0 and 1, depending deterministically on SEED.返回0和1间的伪随机数,依赖于指定的种子。典型用法是U(I+1)=rand(U(I)。注意如果seed不变,那么产生的随机数也不变。利用rand产生15个标准正态分布的随机数model:!产生一列正态分布的随机数;sets: series/1.15/: u, znorm;endsets !第一个均匀分布随机数是任意的; u( 1) = rand( .1234); !产生其余的均匀分布的随机数; for(series( I)| I #GT# 1: u( I) = rand( u( I
32、- 1) ); for( series( I): !正态分布随机数; psn( znorm( I) = u( I); !ZNORM可以是负数; free( znorm( I); );end3.5 变量界定函数(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) 取消对变量x的默认下界为0的限制,即x可以取任意实数This removes the default lower bound of zero on variable, allowing it to take any positive or negative value. GIN( variable)限制x为整数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 集操作函数(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的一个子集,C是B的补集。sets: I/x1.x4/; B(I)/x2/; C(I)|#not#in(B,&1):;endsetsINDEX( set_name, primitive_set_element)该函数返回在集set_name中原始集成员primitive_set_element的索引。如果set_name被忽略,那么LINGO将返回与primitive_set_element匹配的第一个原始集成员的索引。如果找不到,则产生一个错误。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)该函数返回集set_n
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 初中信息技术基本知识概览
- 全国2024年1月高等教育自学考试犯罪学试题
- 内科护理(医学高级):传染病病人的护理考试题库
- 2026 学龄前自闭症早期感统课件
- 六年级期中数学总结
- 保温工程专业分包合同
- 出境动植物及其产品、其他检疫物的生产、加工、存放单位注册登-样表
- 2026年家庭防灾减灾应急手册
- 浙教版2026届中考英语最后冲刺模拟试卷含答案
- 2026届湖北省宜昌市五峰土家族自治县中考英语全真模拟试卷含答案
- 当代中国经济教学知识考试复习题库(附答案)
- 2025-2026学年统编版道德与法治八年级下册期中模拟检测试题(含答案)
- 髋臼骨折诊疗指南
- 2025年人寿保险公司基本法
- 发药差错防范培训
- 2026年中国银行金融科技岗笔试考前核心考点练习题及解析
- 市县医院骨科、麻醉科加速康复实施管理专家共识解读课件
- 2021北京市中考数学真题及答案解析
- (新教材)2026年人教版一年级下册数学 七 复习与关联 第3课时 图形的认识 课件
- MOOC 森林植物识别技术 -珍稀植物识别-南京森林警察学院 中国大学慕课答案
- GB/T 15543-2008电能质量三相电压不平衡
评论
0/150
提交评论