A Python package for TOPSIS calculation
Project description
TOPSIS Package
A Python package for decision-making using the TOPSIS method.
What is TOPSIS?
The Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) is a multi-criteria decision analysis method.
It ranks alternatives based on their closeness to the ideal solution and farthest from the worst solution, making it an excellent tool for decision-making problems.
Features
- Simple and efficient implementation of the TOPSIS algorithm.
- Accepts a decision matrix via a CSV file.
- Supports customizable weights and impacts for criteria.
- Outputs the TOPSIS scores and ranks into an easy-to-read CSV file.
Installation
You can install the package from PyPI using:
pip install 102217211-Ashmeet-topsis==1.1.0
How to Use
Run the Package
You can run the TOPSIS package directly from the command line using:
python -m 102217211_Ashmeet_topsis <input_file> <weights> <impacts> <output_file>
Parameters
<input_file>: Path to the CSV file containing the decision matrix.<weights>: Comma-separated weights for each criterion (e.g.,0.2,0.1,0.43,0.3).<impacts>: Comma-separated impacts for each criterion (e.g.,+,+,-,-, where+indicates a benefit criterion and-indicates a cost criterion).<output_file>: Path to the output CSV file where the results will be saved.
Example Usage
Input CSV (input.csv)
Fund Name,P1,P2,P3,P4,P5
M1,0.91,0.83,6,53,15.19
M2,0.88,0.77,4.1,61.1,16.71
M3,0.67,0.45,3.5,59.4,16.01
M4,0.83,0.69,4.8,44.9,12.81
M5,0.74,0.55,6.7,66.3,18.57
M6,0.6,0.36,4,37.8,10.69
M7,0.72,0.52,4.4,40.7,11.59
M8,0.73,0.53,4.4,66.8,18.12
Command
python -m 102217211_Ashmeet_topsis "input.csv" "0.2,0.1,0.4,0.3,0.1" "-,+,+,-,+" "output.csv"
Output CSV (output.csv)
Fund Name,P1,P2,P3,P4,P5,TOPSIS Score,Rank
M1,0.91,0.83,6,53,15.19,0.7521,2
M2,0.88,0.77,4.1,61.1,16.71,0.8256,1
M3,0.67,0.45,3.5,59.4,16.01,0.4823,6
M4,0.83,0.69,4.8,44.9,12.81,0.6332,4
M5,0.74,0.55,6.7,66.3,18.57,0.6789,3
M6,0.6,0.36,4,37.8,10.69,0.3145,8
M7,0.72,0.52,4.4,40.7,11.59,0.4012,7
M8,0.73,0.53,4.4,66.8,18.12,0.5798,5
How It Works
- Normalization: The decision matrix is normalized to bring all criteria onto a comparable scale.
- Weighting: Each criterion is multiplied by its corresponding weight.
- Ideal Solutions: Calculates the ideal best and worst solutions based on the impacts.
- Distance Calculation: Computes the distance of each alternative from the ideal best and worst solutions.
- Ranking: Scores and ranks alternatives based on their relative closeness to the ideal solution.
License
This project is licensed under the MIT License. See the LICENSE file for details.
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 102217211_Ashmeet_topsis-1.1.0.tar.gz.
File metadata
- Download URL: 102217211_Ashmeet_topsis-1.1.0.tar.gz
- Upload date:
- Size: 4.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
496ae7343dfb8252012eaf4bba8170b1a65555221799b66e2fc22d07311fdccc
|
|
| MD5 |
81a6b8bef459ee5bc51dea3785ccc95d
|
|
| BLAKE2b-256 |
472af553955d5c2d6c1477c89ab80c6364f87a1175e499f3262df9973fed598b
|
File details
Details for the file 102217211_Ashmeet_topsis-1.1.0-py3-none-any.whl.
File metadata
- Download URL: 102217211_Ashmeet_topsis-1.1.0-py3-none-any.whl
- Upload date:
- Size: 5.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64e2bc18349a3597d910b7b071d6ba28daae8ffb98af051fb756c373fb094572
|
|
| MD5 |
d67b5b7a6caa128f277b99bc85006af0
|
|
| BLAKE2b-256 |
3ca266e93a07a7aafe71ff775bee04442b4a0c85fa3929d98d789e283fbff027
|