mosek_write(Rmosek)
mosek_write()所属R语言包:Rmosek
Write problem to a model file
模型文件的写入问题
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Outputs a model of an optimization problem in any standard modeling fileformat (e.g. lp, opf, mps, mbt, etc.), controlled by a set of options. The modeling fileformat is selected based on the extension of the modelfile.
输出模型的优化问题,在任何标准的建模档案格式(如LP,OPF,公安部,主战坦克等),控制一组选项。选择的建模档案格式根据延长的modelfile。
用法----------Usage----------
mosek_write(problem, modelfile, opts = list())
参数----------Arguments----------
参数:problem
The optimization problem. <table summary="Rd table"> <tr> <td align="left"> problem </td><td align="left"> LIST </td><td align="left"> </td> </tr> <tr> <td align="left"> </td> </tr> </table>
最优化问题。 <table summary="Rd table"> <TR> <td ALIGN="LEFT">问题</ TD> <TD ALIGN="LEFT"> LIST </ TD> <TD ALIGN="LEFT"> </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>
参数:modelfile
The file to write the optimization model. <table summary="Rd table"> <tr> <td align="left"> modelfile </td><td align="left"> STRING (filepath) </td><td align="left"> </td> </tr> <tr> <td align="left"> </td> </tr> </table>
要写入的文件的优化模型。 <table summary="Rd table"> <TR> <td ALIGN="LEFT"> modelfile </ TD> <TD ALIGN="LEFT"> STRING(路径)</ TD> <TD ALIGN="LEFT"> < / TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>
参数:opts
The interface options. <table summary="Rd table"> <tr> <td align="left"> opts </td><td align="left"> LIST </td><td align="left"> (OPTIONAL) </td> </tr> <tr> <td align="left"> ..$verbose </td><td align="left"> NUMERIC </td><td align="left"> (OPTIONAL) </td> </tr> <tr> <td align="left"> ..$usesol </td><td align="left"> BOOLEAN </td><td align="left"> (OPTIONAL) </td> </tr> <tr> <td align="left"> ..$useparam </td><td align="left"> BOOLEAN </td><td align="left"> (OPTIONAL) </td> </tr> <tr> <td align="left"> ..$getinfo </td><td align="left"> BOOLEAN </td><td align="left"> (OPTIONAL) </td> </tr> <tr> <td align="left"> ..$scofile </td><td align="left"> STRING (filepath) </td><td align="left"> (MANDATORY IN SCOPT)</td> </tr> <tr> <td align="left"> </td> </tr> </table>
接口选项。 <table summary="Rd table"> <TR> <td ALIGN="LEFT"> OPTS </ TD> <TD ALIGN="LEFT"> LIST </ TD> <TD ALIGN="LEFT">(可选)< / TD> </ TR> <TR> <td ALIGN="LEFT">元详细</ TD> <td ALIGN="LEFT">数字</ TD> <TD ALIGN="LEFT">(可选) </ TD> </ TR> <TR> <td ALIGN="LEFT">元以UseSOL方式</ TD> <TD ALIGN="LEFT"> BOOLEAN </ TD> <TD ALIGN="LEFT">(OPTIONAL )</ TD> </ TR> <TR> <td ALIGN="LEFT">元useparam </ TD> <TD ALIGN="LEFT"> BOOLEAN </ TD> <TD ALIGN="LEFT">(可选)</ TD> </ TR> <TR> <td ALIGN="LEFT">元GetInfo的</ TD> <TD ALIGN="LEFT"> BOOLEAN </ TD> <TD ALIGN="LEFT"> (可选)</ TD> </ TR> <TR> <td ALIGN="LEFT">元scofile </ TD> <TD ALIGN="LEFT"> STRING(路径)</ TD> <TD对齐= “左”>(强制性SCOPT)</ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE>
Details
详细信息----------Details----------
The problem should be compliant with the input specification of function mosek. Please see this function for more details.
problem应该是符合输入规范功能mosek。此功能的更多详细信息,请参阅。
The modelfile should be an absolute or relative path to the model file. If the file extension is .opf, the model will be written in the Optimization Problem Format. Other formats include lp, mps and mbt.
modelfile应该是一个绝对或相对路径的模型文件。如果文件扩展名是.opf,该模型将被写入的优化问题的格式。其他格式包括LP,国会议员和主战坦克。
The amount of information printed by the interface can be limited by verbose (default=10). Whether to write the initial solution, if one such exists in the problem description, is indicated by usesol which by default is FALSE. Whether to write the full list of parameter settings, some of which may have been specified by the problem description, is indicated by useparam which by default is FALSE.
信息的接口打印量是有限的,verbose(默认为10)。无论是写最初的解决方案,如果这样一个存在问题的描述,表示usesol在默认情况下是FALSE。无论是写参数设置的完整列表,其中一些可能已被指定的问题说明,表示useparam在默认情况下是FALSE。
The option scofile is used in separable convex optimization to specify the absolute or relative path to the operator file.
scofile采用的是可分离凸优化到指定的操作文件的绝对或相对路径的选项。
值----------Value----------
参数:r
The returned result. <table summary="Rd table"> <tr> <td align="left"> r </td><td align="left"> LIST </td><td align="left"> </td> </tr> <tr> <td align="left"> ..$response </td><td align="left"> LIST </td><td align="left"> </td> </tr> <tr> <td align="left"> ....$code </td><td align="left"> NUMERIC </td><td align="left"> </td> </tr> <tr> <td align="left"> ....$msg </td><td align="left"> STRING </td><td align="left"> </td> </tr> <tr> <td align="left"> ..$iinfo/$dinfo </td><td align="left"> LIST </td><td align="left"> * </td> </tr> <tr> <td align="left"> ....$<MSK_INFO> </td><td align="left"> NUMERIC </td><td align="left"> * </td> </tr> <tr> <td align="left"> </td> </tr> </table> <table summary="Rd table"> <tr> <td align="left">*Starred items must be requested using an option.</td> </tr> </table>
返回的结果。 <table summary="Rd table"> <TR> <td ALIGN="LEFT"> R </ TD> <TD ALIGN="LEFT"> LIST </ TD> <TD ALIGN="LEFT"> </ TD> </ TR> <TR> <td ALIGN="LEFT">元响应</ TD> <TD ALIGN="LEFT"> LIST </ TD> <TD ALIGN="LEFT"> </ TD> </ TR文章<td ALIGN="LEFT"> .... $代码</ TD> <TD ALIGN="LEFT"> NUMERIC </ TD> <TD ALIGN="LEFT"> </ TD> </ TR> <TR> <td ALIGN="LEFT"> .... $味精</ TD> <TD ALIGN="LEFT"> STRING </ TD> <TD ALIGN="LEFT"> </ TD> </ TR> <TR> <td ALIGN="LEFT">元iinfo / $ dinfo </ TD> <TD ALIGN="LEFT"> LIST </ TD> <TD ALIGN="LEFT"> * </ TD> </ TR> <TR> <td ALIGN="LEFT"> .... $ <MSK_INFO> </ TD> <td ALIGN="LEFT">数字</ TD> <TD ALIGN="LEFT"> * </ TD> </ TR> <TR> <td ALIGN="LEFT"> </ TD> </ TR> </ TABLE> summary="Rd table"> <TR> TD对齐=“左边” *星号标记项目必须要求使用的选项。</ TD> </ TR> </ TABLE>
The result is a named list containing the response of the MOSEK Optimization Library when writing to the model file. A response code of zero is the signal of success.
其结果是命名列表,MOSEK优化库包含响应的模型文件写入时。零响应代码是成功的信号。
Setting option getinfo to TRUE extracts iinfo and dinfo.
设置选项“getinfo到TRUE,提取iinfo和dinfo。
参见----------See Also----------
mosek mosek_read
mosekmosek_read
实例----------Examples----------
lo1 <- list()
lo1$sense <- "max"
lo1$c <- c(3,1,5,1)
lo1$A <- Matrix(c(3,1,2,0,
2,1,3,1,
0,2,0,3), nrow=3, byrow=TRUE, sparse=TRUE)
lo1$bc <- rbind(blc = c(30,15,-Inf),
buc = c(30,Inf,25));
lo1$bx <- rbind(blx = c(0,0,0,0),
bux = c(Inf,10,Inf,Inf));
rr <- mosek_write(lo1, "lo1.opf")
if (!identical(rr$response$code, 0))
stop("Failed to write model file to current working directory")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|