Learn R Programming

MCDA (version 0.1.0)

TOPSIS: Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS) method

Description

TOPSIS is a multi-criteria decision analysis method which was originally developed by Hwang and Yoon in 1981.

Usage

TOPSIS(
  performanceTable,
  criteriaWeights,
  criteriaMinMax,
  positiveIdealSolutions = NULL,
  negativeIdealSolutions = NULL,
  alternativesIDs = NULL,
  criteriaIDs = NULL
)

Value

The function returns a vector containing the TOPSIS score for each alternative.

Arguments

performanceTable

Matrix or data frame containing the performance table. Each row corresponds to an alternative, and each column to a criterion. Rows (resp. columns) must be named according to the IDs of the alternatives (resp. criteria).

criteriaWeights

Vector containing the weights of the criteria. The elements are named according to the IDs of the criteria.

criteriaMinMax

Vector containing the preference direction on each of the criteria. "min" (resp. "max") indicates that the criterion has to be minimized (maximized). The elements are named according to the IDs of the criteria.

positiveIdealSolutions

Vector containing the positive ideal solutions for each criteria. The elements are named according to the IDs of the criteria.

negativeIdealSolutions

Vector containing the negative ideal solutions for each criteria. The elements are named according to the IDs of the criteria.

alternativesIDs

Vector containing IDs of alternatives, according to which the data should be filtered.

criteriaIDs

Vector containing IDs of criteria, according to which the data should be filtered.

References

Hwang, C.L.; Yoon, K. (1981). Multiple Attribute Decision Making: Methods and Applications. New York: Springer-Verlag. http://hodgett.co.uk/topsis-in-excel/

Examples

Run this code

performanceTable <- matrix(c(5490,51.4,8.5,285,6500,70.6,7,
                              288,6489,54.3,7.5,290),
                              nrow=3,
                              ncol=4,
                              byrow=TRUE)

row.names(performanceTable) <- c("Corsa","Clio","Fiesta")

colnames(performanceTable) <- c("Purchase Price","Economy",
                                   "Aesthetics","Boot Capacity")

weights <- c(0.35,0.25,0.25,0.15)

criteriaMinMax <- c("min", "max", "max", "max")

positiveIdealSolutions <- c(0.179573776, 0.171636015, 0.159499658, 0.087302767)
negativeIdealSolutions <- c(0.212610118, 0.124958799, 0.131352659, 0.085797547)

names(weights) <- colnames(performanceTable)
names(criteriaMinMax) <- colnames(performanceTable)
names(positiveIdealSolutions) <- colnames(performanceTable)
names(negativeIdealSolutions) <- colnames(performanceTable)

overall1 <- TOPSIS(performanceTable, weights, criteriaMinMax)

overall2 <- TOPSIS(performanceTable,
                       weights, 
                       criteriaMinMax,
                       positiveIdealSolutions,
                       negativeIdealSolutions)

overall3 <- TOPSIS(performanceTable,
                      weights,
                      criteriaMinMax,
                      alternativesIDs = c("Corsa","Clio"),
                      criteriaIDs = c("Purchase Price","Economy","Aesthetics"))

overall4 <- TOPSIS(performanceTable, 
                    weights,
                    criteriaMinMax,
                    positiveIdealSolutions,
                    negativeIdealSolutions,
                    alternativesIDs = c("Corsa","Clio"), 
                    criteriaIDs = c("Purchase Price","Economy","Aesthetics"))

Run the code above in your browser using DataLab