Rsymphony_solve_LP(Rsymphony)
Rsymphony_solve_LP()所属R语言包:Rsymphony
COIN-OR SYMPHONY Linear and Mixed Integer Programming Solver
COIN-OR SYMPHONY线性和混合整数规划求解
译者:生物统计家园网 机器人LoveR
描述----------Description----------
High level R interface to the COIN-OR SYMPHONY solver for linear as well as mixed integer linear programming problems (MILPs).
解线性和混合整数线性规划的问题(MILPs),高级别R接口的硬币或交响乐。
用法----------Usage----------
Rsymphony_solve_LP(obj, mat, dir, rhs, bounds = NULL, types = NULL,
max = FALSE)
参数----------Arguments----------
参数:obj
a vector with the objective coefficients
客观系数的矢量与
参数:mat
a vector or a matrix of the constraint coefficients
矢量或矩阵的约束系数
参数:dir
a character vector with the directions of the constraints. Each element must be one of "<", "<=", ">", ">=", "==" or "!=".
一个字符向量方向的约束。每个元素都必须有一个"<","<=",">",">=","=="或"!="。
参数:rhs
the right hand side of the constraints
的右手侧的约束
参数:bounds
NULL (default) or a list with elements upper and lower containing the indices and corresponding bounds of the objective variables. The default for each variable is a bound between 0 and Inf.
NULL(默认)或列表的元素upper和lower包含的指标和相应的目标变量的界限。每个变量的默认值是一个介于0和Inf约束。
参数:types
a character vector giving the types of the objective variables, with "C", "I", and "B" corresponding to continuous, integer, and binary, respectively, or NULL (default), taken as all-continuous. Recycled as needed.
字符向量给目标变量的类型,"C","I"和"B"对应于连续的,整数和二进制,分别或NULL(默认) ,视为所有连续。回收作为需要。
参数:max
a logical giving the direction of the optimization. TRUE means that the objective is to maximize the objective function, FALSE (default) means to minimize it.
一个逻辑给出的优化的方向。 TRUE是指,目标是最大化目标功能,FALSE的(默认),以尽量减少。
Details
详细信息----------Details----------
SYMPHONY is an open source solver for solving mixed integer linear programs (MILPs). The current version can be found at https://projects.coin-or.org/SYMPHONY. Package Rsymphony uses the C interface of the callable library provided by SYMPHONY, and supplies a high level solver function in R using the low level C interface.
Symphony是一个开放源码的求解,求解混合整数线性规划(MILPs)。目前的版本可以发现在https://projects.coin-or.org/SYMPHONY。套件Rsymphony使用C的SYMPHONY所提供的库可调用接口,并提供一个高层次求解器的功能,用低级别的C接口。
值----------Value----------
A list containing the optimal solution, with the following components.
甲列表,其中包含的最优解,与以下组件。
参数:solution
the vector of optimal coefficients
最优系数的矢量
参数:objval
the value of the objective function at the optimum
在最佳的目标函数的值
参数:status
an integer with status information about the solution returned: 0 if the optimal solution was found, a non-zero value otherwise.
返回与该溶液的状态有关下列内容的信息的整数:0,如果发现最优解,另有一个非零值。
(作者)----------Author(s)----------
Reinhard Harter, Kurt Hornik and Stefan Theussl
参考文献----------References----------
(https://projects.coin-or.org/SYMPHONY/wiki).
参见----------See Also----------
lp in package lpSolve; Rglpk_solve_LP in package Rglpk.
lp在包lpSolve,Rglpk_solve_LP的包Rglpk。
实例----------Examples----------
## Simple linear program.[#简单的线性规划。]
## maximize: 2 x_1 + 4 x_2 + 3 x_3[#最大化:2 X_1 + 4 X_2 + 3 x_3]
## subject to: 3 x_1 + 4 x_2 + 2 x_3 <= 60[#:3 X_1 + 4 X_2 + 2 x_3 <= 60。]
## 2 x_1 + x_2 + x_3 <= 40[#2 X_1 + X_2 + x_3 <= 40]
## x_1 + 3 x_2 + 2 x_3 <= 80[#X_1 + 3 X_2 + 2 x_3 <= 80]
## x_1, x_2, x_3 are non-negative real numbers[#X_1,X_2,x_3的非负实数]
obj <- c(2, 4, 3)
mat <- matrix(c(3, 2, 1, 4, 1, 3, 2, 2, 2), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(60, 40, 80)
max <- TRUE
Rsymphony_solve_LP(obj, mat, dir, rhs, max = max)
## Simple mixed integer linear program.[#简单的混合整数线性规划。]
## maximize: 3 x_1 + 1 x_2 + 3 x_3[#最大化:3 X_1 + 1 X_2 + 3 x_3]
## subject to: -1 x_1 + 2 x_2 + x_3 <= 4[#:-1 X_1 + 2 X_2 + x_3 <= 4。]
## 4 x_2 - 3 x_3 <= 2[#4 X_2 - 3 x_3 <= 2]
## x_1 - 3 x_2 + 2 x_3 <= 3[#X_1 - 3 X_2 + 2 x_3 <= 3]
## x_1, x_3 are non-negative integers[#X_1,x_3的非负整数]
## x_2 is a non-negative real number[图#X_2是一个非负实数]
obj <- c(3, 1, 3)
mat <- matrix(c(-1, 0, 1, 2, 4, -3, 1, -3, 2), nrow = 3)
dir <- c("<=", "<=", "<=")
rhs <- c(4, 2, 3)
max <- TRUE
types <- c("I", "C", "I")
Rsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max)
## Same as before but with bounds replaced by[#一样的,但有界取代]
## -Inf < x_1 <= 4[#-INF <X_1 <= 4]
## 0 <= x_2 <= 100[#0 <= X_2 <= 100]
## 2 <= x_3 < Inf[#2 = x_3 <天道酬勤]
bounds <- list(lower = list(ind = c(1L, 3L), val = c(-Inf, 2)),
upper = list(ind = c(1L, 2L), val = c(4, 100)))
Rsymphony_solve_LP(obj, mat, dir, rhs, types = types, max = max,
bounds = bounds)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|