simplex(boot)
simplex()所属R语言包:boot
Simplex Method for Linear Programming Problems
线性规划问题的单纯形法
译者:生物统计家园网 机器人LoveR
描述----------Description----------
This function will optimize the linear function a%*%x subject to the constraints A1%*%x <= b1, A2%*%x >= b2, A3%*%x = b3 and x >= 0. Either maximization or minimization is possible but the default is minimization.
此功能将优化的线性函数a%*%x受约束A1%*%x <= b1,A2%*%x >= b2,A3%*%x = b3和x >= 0。无论是最大化或最小化是可能的,但默认是最小化。
用法----------Usage----------
simplex(a, A1 = NULL, b1 = NULL, A2 = NULL, b2 = NULL, A3 = NULL,
b3 = NULL, maxi = FALSE, n.iter = n + 2 * m, eps = 1e-10)
参数----------Arguments----------
参数:a
A vector of length n which gives the coefficients of the objective function.
长度的向量n使目标函数的系数。
参数:A1
An m1 by n matrix of coefficients for the <= type of constraints.
一个m1n<=约束系数矩阵。
参数:b1
A vector of length m1 giving the right hand side of the <= constraints. This argument is required if A1 is given and ignored otherwise. All values in b1 must be non-negative.
长度的向量m1右侧的<=约束。如果A1否则忽略此参数是必需。 b1所有值必须非负。
参数:A2
An m2 by n matrix of coefficients for the >= type of constraints.
一个m2n>=约束系数矩阵。
参数:b2
A vector of length m2 giving the right hand side of the >= constraints. This argument is required if A2 is given and ignored otherwise. All values in b2 must be non-negative. Note that the constraints x >= 0 are included automatically and so should not be repeated here.
长度的向量m2右侧的>=约束。如果A2否则忽略此参数是必需。 b2所有值必须非负。注意约束x >= 0包括自动,所以不应重复在这里。
参数:A3
An m3 by n matrix of coefficients for the equality constraints.
一个m3n等式约束系数矩阵。
参数:b3
A vector of length m3 giving the right hand side of equality constraints. This argument is required if A3 is given and ignored otherwise. All values in b3 must be non-negative.
长度的向量m3给予平等约束的右侧。如果A3否则忽略此参数是必需。 b3所有值必须非负。
参数:maxi
A logical flag which specifies minimization if FALSE (default) and maximization otherwise. If maxi is TRUE then the maximization problem is recast as a minimization problem by changing the objective function coefficients to their negatives.
如果FALSE(默认)和最大化,否则指定最小的一个逻辑标志。如果maxi是TRUE然后最大化问题改写为一个最小化问题,目标函数系数通过改变他们的底片。
参数:n.iter
The maximum number of iterations to be conducted in each phase of the simplex method. The default is n+2*(m1+m2+m3).
在每个阶段的单纯形法进行的最大迭代次数。默认n+2*(m1+m2+m3)。
参数:eps
The floating point tolerance to be used in tests of equality.
在平等的测试要使用浮点公差。
Details
详情----------Details----------
The method employed by this function is the two phase tableau simplex method. If there are >= or equality constraints an initial feasible solution is not easy to find. To find a feasible solution an artificial variable is introduced into each >= or equality constraint and an auxiliary objective function is defined as the sum of these artificial variables. If a feasible solution to the set of constraints exists then the auxiliary objective will be minimized when all of the artificial variables are 0. These are then discarded and the original problem solved starting at the solution to the auxiliary problem. If the only constraints are of the <= form, the origin is a feasible solution and so the first stage can be omitted.
此功能采用的方法是两相的画面单纯形法。如果有>=或等式约束初始可行的解决方案是不容易找到。为了找到一个可行的解决方案是一个人工变量引入到每个>=或平等的约束和辅助目标函数定义为这些人工变量的总和。如果存在,那么一个可行的解决方案,以约束集的辅助目标时,将尽量减少人工变量0。然后这些被丢弃的辅助问题的解决方案开始,原来的问题就迎刃而解了。如果只限制<=形式的起源是一个可行的解决方案,第一阶段可以省略。
值----------Value----------
An object of class "simplex": see simplex.object.
一个类的对象"simplex":看到simplex.object。
注意----------Note----------
The method employed here is suitable only for relatively small systems. Also if possible the number of constraints should be reduced to a minimum in order to speed up the execution time which is approximately proportional to the cube of the number of constraints. In particular if there are any constraints of the form x[i] >= b2[i] they should be omitted by setting x[i] = x[i]-b2[i], changing all the constraints and the objective function accordingly and then transforming back after the solution has been found.
这里采用的方法是只适合比较小的系统。另外如果可能的话,人数的限制,应减少到最低限度,以加快执行时间,大约是成正比的一些制约因素的立方体。尤其是如果有任何约束的形式x[i] >= b2[i]他们应通过设置省略x[i] = x[i]-b2[i],改变所有的约束和相应的目标函数,然后回改造的解决方案后,已发现。
参考文献----------References----------
Numerical Linear Algebra and Optimization Vol. 1. Addison-Wesley.
Numerical Recipes: The Art of Scientific Computing (Second Edition). Cambridge University Press.
举例----------Examples----------
# This example is taken from Exercise 7.5 of Gill, Murray and Wright (1991).[这个例子是从吉尔,穆雷和赖特(1991)7.5运动。]
enj <- c(200, 6000, 3000, -200)
fat <- c(800, 6000, 1000, 400)
vitx <- c(50, 3, 150, 100)
vity <- c(10, 10, 75, 100)
vitz <- c(150, 35, 75, 5)
simplex(a = enj, A1 = fat, b1 = 13800, A2 = rbind(vitx, vity, vitz),
b2 = c(600, 300, 550), maxi = TRUE)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|