A Python package for TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) analysis
Project description
Topsis-Pratham-102303052
A Python package for performing TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) analysis on multi-criteria decision-making problems.
Author: Pratham Garg
Roll Number: 102303052
What is TOPSIS?
TOPSIS is a multi-criteria decision analysis method that helps in selecting the best alternative from a set of alternatives based on multiple criteria. It works by finding the alternative that is closest to the ideal solution and farthest from the negative-ideal solution.
Installation
pip install Topsis-Pratham-102303052
Usage
Command Line Interface
After installation, you can use the topsis command directly from the command line:
topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
Example
topsis data.csv "1,1,1,2" "+,+,-,+" output-result.csv
Parameters
-
InputDataFile: Path to the CSV file containing the decision matrix
- First column: Names of alternatives
- Remaining columns: Criteria values (must be numeric)
-
Weights: Comma-separated weights for each criterion
- Example: "1,1,1,2"
-
Impacts: Comma-separated impacts for each criterion
- Use '+' for benefit criteria (higher is better)
- Use '-' for cost criteria (lower is better)
- Example: "+,+,-,+"
-
OutputResultFileName: Path where the result file will be saved
Input File Format
The input CSV file should have the following structure:
| Fund Name | P1 | P2 | P3 | P4 | P5 |
|---|---|---|---|---|---|
| M1 | 0.67 | 0.45 | 6.5 | 42.6 | 12.56 |
| M2 | 0.6 | 0.36 | 3.6 | 53.3 | 14.47 |
| M3 | 0.79 | 0.61 | 6.4 | 63.1 | 17.84 |
Output File Format
The output file will contain all input columns plus two additional columns:
- Topsis Score: The calculated TOPSIS score for each alternative
- Rank: The rank of each alternative (1 = best)
Validation
The package performs the following validations:
- Correct number of parameters
- File existence check
- Minimum 3 columns in input file
- Numeric values in all columns except the first
- Matching number of weights, impacts, and criteria columns
- Valid impact values ('+' or '-')
Error Handling
The package provides clear error messages for:
- Missing or incorrect parameters
- File not found
- Non-numeric values in criteria columns
- Mismatch in number of weights/impacts/columns
- Invalid impact values
Algorithm
The TOPSIS algorithm follows these steps:
- Normalization: Vector normalization of the decision matrix
- Weighted Normalization: Multiply normalized values by weights
- Ideal Solutions: Determine ideal best and ideal worst solutions
- Distance Calculation: Calculate Euclidean distances from ideal solutions
- TOPSIS Score: Calculate relative closeness to ideal solution
- Ranking: Rank alternatives based on TOPSIS scores
License
MIT License
Author
Pratham Garg
Roll Number: 102303052
Email: pgarg7_be23@thapar.edu
Links
Mail Service Configuration
To enable automated email delivery of TOPSIS results:
- Navigate to the
backend/directory. - Open the
.envfile (created from.env.example). - Fill in your SMTP credentials:
SENDER_EMAIL: Your Gmail or SMTP email address.SENDER_PASSWORD: Your SMTP password or Gmail App Password.
- Restart the backend server.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Support
For issues and questions, please open an issue on the GitHub repository.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topsis_pratham_102303052-1.0.1.tar.gz.
File metadata
- Download URL: topsis_pratham_102303052-1.0.1.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e671bd586b1bb5fd19024f69a097436ee19f6fe81d566cb3bd68a19426a2cf9f
|
|
| MD5 |
6484247e5f6be43e7959766b421fe236
|
|
| BLAKE2b-256 |
7a007460b9b25340f90e46eb6414ab601e21b9e645f7464196fad2b68da73675
|
File details
Details for the file topsis_pratham_102303052-1.0.1-py3-none-any.whl.
File metadata
- Download URL: topsis_pratham_102303052-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.25
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
099013ab438827ffe4df2d7de3ae4863fbce774669063063851e512131a2453a
|
|
| MD5 |
cb6cde644002fcbd200483c20d0f7c6c
|
|
| BLAKE2b-256 |
168dc4645c8a58276319e47a8059420091f6aabe5a11a73511928f82b0033ac2
|