Topsis-Aastha-102313059 1.0.1
TOPSIS implementation as a Python package

# Topsis-Aastha-102313059

This Python package implements the TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) method for solving multi-criteria decision-making problems.  
It ranks alternatives based on their performance across multiple criteria.

---

## Introduction

In many real-world problems, decisions depend on multiple factors such as cost, performance, risk, and return.  
TOPSIS is a popular multi-criteria decision-making technique that identifies the best alternative by comparing distances from an ideal best and ideal worst solution.

The best alternative is:
- Closest to the positive ideal solution
- Farthest from the negative ideal solution

---

## TOPSIS Methodology

The TOPSIS approach consists of the following steps:

### Step 1: Construct Decision Matrix  
List alternatives and their performance under each criterion.

### Step 2: Normalize the Matrix  

rij = xij / √(∑xij²)

This removes scale differences among criteria.

### Step 3: Weighted Normalized Matrix  

vij = wj × rij

### Step 4: Determine Ideal Solutions  

Positive ideal solution = best values  
Negative ideal solution = worst values  

(based on benefit (+) or cost (−) criteria)

### Step 5: Distance Calculation  

Euclidean distance from ideal best and worst is calculated.

### Step 6: TOPSIS Score  

Score = Distance from worst / (Distance from best + Distance from worst)

### Step 7: Ranking  

Higher score indicates better alternative.

---

## Input Data Format

The Excel input file must contain:

| Fund Name | P1 | P2 | P3 | P4 | P5 |
|----------|----|----|----|----|----|
| Fund A |  |  |  |  |  |
| Fund B |  |  |  |  |  |

- First column contains alternatives  
- Remaining columns contain numeric criteria values

---

## Result Table (Sample Output)

| Fund Name | P1 | P2 | P3 | P4 | P5 | Topsis Score | Rank |
|----------|----|----|----|----|----|------------|------|
| M1 | 0.84 | 0.71 | 6.7 | 42.1 | 12.59 | 0.382109 | 6 |
| M2 | 0.91 | 0.83 | 7.0 | 31.7 | 10.11 | 0.366492 | 7 |
| M3 | 0.79 | 0.62 | 4.8 | 46.7 | 13.23 | 0.496361 | 4 |
| M4 | 0.78 | 0.61 | 6.4 | 42.4 | 12.55 | 0.324792 | 8 |
| M5 | 0.94 | 0.88 | 3.6 | 62.2 | 16.91 | 0.972128 | 1 |
| M6 | 0.88 | 0.77 | 6.5 | 51.5 | 14.91 | 0.547048 | 3 |
| M7 | 0.66 | 0.44 | 5.3 | 48.9 | 13.83 | 0.395015 | 5 |
| M8 | 0.93 | 0.86 | 3.4 | 37.0 | 10.55 | 0.560092 | 2 |

The results show that Fund M5 achieved the highest TOPSIS score and is ranked as the best alternative.

---

## Result Visualization

The TOPSIS scores can be visualized using a bar graph to compare the performance of alternatives.

- X-axis: Fund Names  
- Y-axis: TOPSIS Scores  

This provides a clear comparison of rankings.

---

## Installation

Install the package using:

pip install Topsis-Aastha-102313059


---

## Usage

Run the package from command line:

```bash
topsis <InputFile> <Weights> <Impacts> <OutputFile>

### Example:

topsis data.xlsx "1,1,1,1,1" "+,+,-,+,+" result.csv

---

## Requirements

- pandas  
- numpy  
- openpyxl  

---

## Conclusion

This package offers a simple and efficient implementation of the TOPSIS decision-making technique and can be used for financial analysis, performance evaluation, and other multi-criteria decision problems.