# Ranking of Alternatives with the RAFSI Method

# Introduction to the RAFSI Method

The RAFSI method is a multi-criteria decision-making technique developed by Malisa Zizovic in 2020. The `rafsi` package implements this method in R, allowing users to evaluate alternatives based on weighted criteria and generate a final ranking of alternatives.

## Example of Usage

In this example, we will use the RAFSI method to evaluate a set of alternatives based on specific criteria and calculate their final rankings.

    library(rafsi)

    # Define the dataset (rows: alternatives, columns: criteria)
    dataset <- matrix(c(
      180, 165, 160, 170, 185, 167,   # Criterion 1: Higher is better
      10.5, 9.2, 8.8, 9.5, 10, 8.9,   # Criterion 2: Lower is better
      15.5, 16.5, 14, 16, 14.5, 15.1, # Criterion 3: Lower is better
      160, 131, 125, 135, 143, 140,   # Criterion 4: Higher is better
      3.7, 5, 4.5, 3.4, 4.3, 4.1      # Criterion 5: Higher is better
    ), nrow = 6, ncol = 5, byrow = TRUE)

    # Set names for the alternatives (A1 to A6)
    rownames(dataset) <- c("A1", "A2", "A3", "A4", "A5", "A6")

    # Define the weights for each criterion
    weights <- c(0.35, 0.25, 0.15, 0.15, 0.10)

    # Define the type of each criterion: 'max' for benefit, 'min' for cost
    criterion_type <- c('max', 'min', 'min', 'max', 'max')

    # Define the ideal values (best-case scenario) for each criterion
    ideal <- c(200, 6, 10, 200, 8)

    # Define the anti-ideal values (worst-case scenario) for each criterion
    anti_ideal <- c(120, 12, 20, 100, 2)

    # Number of criteria (n_i) and number of alternatives (n_k)
    n_i <- 1
    n_k <- 6

    # Apply the RAFSI method
    result <- rafsi_method(dataset, weights, criterion_type, ideal, anti_ideal, n_i, n_k)

    # View the results
    print(result)
    #> $Standardized_matrix
    #>       [,1]       [,2]  [,3]   [,4]       [,5]
    #> A1  4.7500 133.500000 76.00  4.500 153.500000
    #> A2  3.9375   4.750000  0.60 -3.560   7.250000
    #> A3 -5.8750   3.416667  3.75 -3.175  11.000000
    #> A4 -5.5000   8.083333  3.55  4.000 108.500000
    #> A5  1.3125 108.500000 67.50  3.000   2.416667
    #> A6 -6.1875  -0.250000 -2.30 -3.785   2.750000
    #>
    #> $Normalized_matrix
    #>          [,1]         [,2]        [,3]       [,4]       [,5]
    #> A1  0.6785714  0.006420546  0.01127820  0.6428571 21.9285714
    #> A2  0.5625000  0.180451128  1.42857143 -0.5085714  1.0357143
    #> A3 -0.8392857  0.250871080  0.22857143 -0.4535714  1.5714286
    #> A4 -0.7857143  0.106038292  0.24144869  0.5714286 15.5000000
    #> A5  0.1875000  0.007899934  0.01269841  0.4285714  0.3452381
    #> A6 -0.8839286 -3.428571429 -0.37267081 -0.5407143  0.3928571
    #>
    #> $Ranking
    #>    Alternative    Ranking
    #> A1          A1  2.5300826
    #> A4          A4  1.4234412
    #> A2          A2  0.4835592
    #> A5          A5  0.1683143
    #> A3          A3 -0.1076394
    #> A6          A6 -1.2642399

Interpret the Results

The result provides the ranking of the alternatives based on their performance across all criteria, considering the weights and whether each criterion is treated as a benefit or a cost.

For more detailed information on the RAFSI method, you can refer to the original paper: https://doi.org/10.3390/math8061015.