getAlternativesComparisons(RXMCDA)
getAlternativesComparisons()所属R语言包:RXMCDA
Get comparisons of alternatives
替代品比较
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Extracts <alternativesComparisons> from an XML tree written according to the XMCDA standard and stores the performances of the concerned alternatives.
提取<alternativesComparisons>编写的XML树根据XMCDA标准的和存储的性能有关的替代品。
用法----------Usage----------
getAlternativesComparisons(tree, performanceTable, mcdaConcept = NULL)
参数----------Arguments----------
参数:tree
Object containing the XMCDA XML tree.
Object,包含XMCDAXML树。
参数:performanceTable
A matrix containing the performance table to be considered, whose dimnames are the alternatives' IDs (rows) and the criteria's IDs (columns).
要考虑性能表的矩阵,,其dimnames的替代品的ID(行)和标准的ID(列)。
参数:mcdaConcept
A string containing the specific mcdaConcept attribute which should be searched for.
一个字符串,其中包含的具体mcdaConcept属性应搜索。
值----------Value----------
The function returns a list structured as follows:
该函数返回一个列表结构如下:
参数:–
The first elements contain the <alternativesComparisons> found in <tree> as matrices. These elements are named according to the mcdaConcept attribute if it can be found. Each line of each matrix corresponds to one constraint of the type "alternative a is preferred to alternative b with preference threshold delta". A line is structured as follows: the first n elements encode alternative a (via the values it takes in performanceTable), the next n elements encode alternative b, and the last element contains the preference threshold delta.
第一个元素包含了<alternativesComparisons> <tree>为矩阵。这些元素的命名是根据mcdaConcept属性,如果可以找到。每个矩阵的每一行对应于一个约束类型“可选择的最好备选方案B的偏好阈值Delta”。 A线的结构如下:第n个元素的编码替代(通过值,performanceTable),接下来的n个元素的备选方案B编码,和最后一个元素包含的偏好阈值增量。
参数:status
Either OK if all the <criteria> tags could be correctly read, or the description of the error.
无论是OK的,如果所有的<criteria>标签可以正确读出,或对错误的描述。
实例----------Examples----------
tree = newXMLDoc()
newXMLNode("xmcda:XMCDA", namespace = c("xsi" = "http://www.w3.org/2001/XMLSchema-instance", "xmcda" = "http://www.decision-deck.org/2009/XMCDA-2.1.0"), parent=tree)
root<-getNodeSet(tree, "/xmcda:XMCDA")
aC<-newXMLNode("alternativesComparisons", parent=root[[1]] , namespace=c())
pairs<-newXMLNode("pairs", parent=aC, namespace=c())
pair<-newXMLNode("pair", parent=pairs, namespace=c())
initial<-newXMLNode("initial", parent=pair)
newXMLNode("alternativeID", "a01", parent=initial, namespace=c())
terminal<-newXMLNode("terminal", parent=pair, namespace=c())
newXMLNode("alternativeID", "a02", parent=terminal, namespace=c())
value<-newXMLNode("value", parent=pair, namespace=c())
newXMLNode("real", "0.5", parent=value, namespace=c())
alternativesIDs <- c("a01","a02")
criteriaIDs <- c("g1","g2")
performance.table<-matrix(nrow=length(alternativesIDs),ncol=length(criteriaIDs),dimnames = list(alternativesIDs,criteriaIDs))
for (i in 1:length(alternativesIDs)){
for (j in 1:length(criteriaIDs)){
performance.table[i,j] = runif(1)
}
}
y<-getNodeSet(tree,"//alternativesComparisons")
x<-getAlternativesComparisons(y[[1]], performance.table)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|