semvec/pypi-packages huggingface dataset:
Topsis-RaghavPahwa-102303608 1.0.1
A command-line implementation of TOPSIS
License: MIT
Requires Python: >=3.7

# TOPSIS â€“ Raghav Pahwa (102303608)

**Topsis - RaghavPahwa-102303608** is a Python library for solving **Multiple Criteria Decision Making (MCDM)** problems using the  
**Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS)**.

TOPSIS is based on the concept that the chosen alternative should have the **shortest distance from the positive ideal solution** and the **longest distance from the negative ideal solution**.

This package provides a simple **command-line interface** to apply TOPSIS on any CSV dataset.

---

## Installation

Use `pip` to install the package:

```bash
pip install Topsis-RaghavPahwa-102303608
```

---

## Usage

Enter the CSV filename, followed by the weights vector and impacts vector:

```bash
topsis <InputFile.csv> <Weights> <Impacts> <OutputFile.csv>
```

### Method 1: With Quotes (Recommended)

```bash
topsis sample.csv "1,1,1,1" "+,-,+,+" result.csv
```

### Method 2: Without Quotes

```bash
topsis sample.csv 1,1,1,1 +,-,+,+ result.csv
```

**Note:**  
The second method does not allow spaces between values.  
If your input contains spaces, always use double quotes (`"`).

To view help:

```bash
topsis -h
```

---

## Example

### `sample.csv`

```csv
Model,Storage,Camera,Price,Looks
M1,16,12,250,5
M2,16,8,200,3
M3,32,16,300,4
M4,32,8,275,4
M5,16,16,225,2
```

### Input

```bash
topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
```

Where:

- Weights vector = `[0.25, 0.25, 0.25, 0.25]`
- Impacts vector = `[+, +, -, +]`

### Output (`output.csv`)

```text
   Topsis Score  Rank
1      0.534277     3
2      0.308368     5
3      0.691632     1
4      0.534737     2
5      0.401046     4
```

The alternative with **Rank = 1** is the **best choice** according to TOPSIS.

---

## Input File Requirements

- The input file must be a **CSV**.
- The **first column** should contain alternative names.
- From the **2nd column onwards**, all values must be **numeric**.
- The number of:
  - Weights  
  - Impacts  
  - Criteria columns  
  must be the same.
- Impacts must be:
  - `+` for beneficial criteria  
  - `-` for non-beneficial criteria
- Weights must be numeric and greater than 0.

---

## Algorithm

1. Normalize the decision matrix  
2. Calculate the weighted normalized matrix  
3. Determine ideal best and ideal worst solutions  
4. Compute Euclidean distances  
5. Calculate performance scores  
6. Rank all alternatives  

---

## Author

**Raghav Pahwa**  
Roll No: **102303608**  
Thapar Institute of Engineering and Technology  

---

## License

MIT License

---

## Keywords

TOPSIS  
MCDM  
Multi-Criteria Decision Making  
Decision Analysis  
Optimization