topsis-tavish-102303246 0.1.1
A Python package for Topsis method implementation
Requires Python: >=3.11

# TOPSIS-Tavish-102303246

This Python-based package provides an implementation of the **Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS)**. It is designed as a command-line application that evaluates multiple options against several criteria, incorporates user-defined weights and impacts, and produces a relative performance score along with a final ranking for each option.

[Click Here](https://topsis-website.vercel.app/) for a live demo.

## Installation

Install the package using `pip` as shown below:

```bash
pip install topsis-tavish-102303246
```

## How to Use

The tool is operated from the terminal. To run it, you need an input dataset (CSV or Excel format), a list of criterion weights, a list of impacts, and an output filename where results will be stored.

### Command Format

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

### Parameter Details

1. **InputFile**
   - Path to a `.csv` or `.xlsx` file.
   - The dataset must include **at least three columns**.
   - The **first column** should contain identifiers for the alternatives (e.g., A1, A2, A3).
     This column is excluded from calculations but retained in the output.
   - All remaining columns must contain numerical values representing evaluation criteria.

2. **Weights**
   - A comma-separated list of numerical values representing the relative importance of each criterion
     (example: `"2,1,3,1"`).

3. **Impacts**
   - A comma-separated list using `+` or `-` symbols to indicate whether higher or lower values are preferred.
     - `+` → Higher values are desirable
     - `-` → Lower values are desirable

4. **OutputFile**
   - Name of the CSV file where the computed TOPSIS scores and rankings will be saved.

## Demonstration Example

Assume we want to compare **four laptop models** using **four evaluation parameters**: **Cost**, **Battery Life**, **Performance**, and **Weight**.

### 1. Sample Input (`laptops.csv`)

| Laptop | Cost | Battery | Performance | Weight |
| ------ | ---- | ------- | ----------- | ------ |
| L1     | 700  | 8       | 7           | 2.2    |
| L2     | 650  | 6       | 6           | 2.5    |
| L3     | 800  | 9       | 9           | 2.0    |
| L4     | 720  | 7       | 8           | 2.3    |

**Decision Logic**:

- **Cost**: Lower is preferable (`-`)
- **Battery Life**: Higher is preferable (`+`)
- **Performance**: Higher is preferable (`+`)
- **Weight**: Lower is preferable (`-`)

### 2. Running the Tool

Execute the following command:

```bash
topsis laptops.csv "1,1,2,1" "-,+,+,-" output.csv
```

- **Weights**: Performance is given more importance than the other criteria.
- **Impacts**: Cost and Weight are treated as minimizing factors.

### 3. Generated Output (`output.csv`)

The resulting file includes the original dataset along with two additional fields: **TOPSIS Score** and **Rank**.

| Laptop | Cost | Battery | Performance | Weight | TOPSIS Score | Rank |
| ------ | ---- | ------- | ----------- | ------ | ------------ | ---- |
| L1     | 700  | 8       | 7           | 2.2    | 0.521        | 3    |
| L2     | 650  | 6       | 6           | 2.5    | 0.312        | 4    |
| L3     | 800  | 9       | 9           | 2.0    | 0.742        | 1    |
| L4     | 720  | 7       | 8           | 2.3    | 0.603        | 2    |