library(ror)
## Function needed to generate pareto-optimal alternatives
randomPointFromHypersphere <- function(ncrit) {
rns <- c()
while(TRUE) {
rns <- rnorm(ncrit)
if (all(rns > 0)) {
break
}
}
mul <- 1 / sqrt(sum(rns * rns))
return(rns * mul)
}
performances <- t(replicate(10, randomPointFromHypersphere(5))) # 10 alts, 5 crit
preferences <- matrix(c(1, 2, 4, 5, 7, 8, 1, 3), ncol=2, byrow=TRUE)
## RORSMAA gives the POIs and RAIs
ror <- rorsmaa(performances, preferences)
print(ror$poi)
print(ror$rai)
cat(ror$misses, "misses while generating 10k value functions
")Run the code above in your browser using DataLab