A Python package for TOPSIS multi-criteria decision making
Project description
Topsis-Anshul-102303930
📌 Description
This package implements the TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) method, a multi-criteria decision-making (MCDM) approach used to rank alternatives based on their distance from an ideal best and an ideal worst solution.
TOPSIS is widely used in various domains including:
- Product selection and comparison
- Supplier evaluation
- Project prioritization
- Performance assessment
- Resource allocation
⚙️ Installation
Install the package using pip:
pip install Topsis-Anshul-102303930
🚀 Usage
After installation, the topsis command becomes available in your terminal.
Basic Syntax
topsis <input_csv> <weights> <impacts> <output_csv>
Parameters
| Parameter | Description |
|---|---|
input_csv |
Path to the CSV file containing the decision matrix |
weights |
Comma-separated numerical weights for each criterion |
impacts |
Comma-separated impacts (+ for benefit, - for cost) |
output_csv |
Path where the output CSV file will be saved |
Example Commands
With quotes:
topsis sample.csv "1,1,1,1" "+,-,+,+" output.csv
Without quotes:
topsis sample.csv 1,1,1,1 +,-,+,+ output.csv
📊 Example
Input File (sample.csv)
A CSV file showing data for different mobile handsets with varying features:
Model,Storage space(in gb),Camera(in MP),Price(in $),Looks(out of 5)
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
Decision Criteria
Weights Vector: [0.25, 0.25, 0.25, 0.25]
Impacts Vector: [+, +, -, +]
- Storage space: + (more is better)
- Camera: + (more is better)
- Price: - (less is better)
- Looks: + (more is better)
Command
topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
Output
The output file will contain the original data with two additional columns:
TOPSIS RESULTS
-----------------------------
Model Storage space(in gb) Camera(in MP) Price(in $) Looks(out of 5) P-Score Rank
M1 16 12 250 5 0.534277 3
M2 16 8 200 3 0.308368 5
M3 32 16 300 4 0.691632 1
M4 32 8 275 4 0.534737 2
M5 16 16 225 2 0.401046 4
Interpretation: M3 ranks highest (Rank 1) with the best TOPSIS score of 0.691632, making it the optimal choice among the alternatives.
📋 Input File Requirements
- CSV Format: The input file must be in CSV format
- First Column: Should contain the names/identifiers of alternatives
- Remaining Columns: Should contain numerical values for each criterion
- No Missing Values: All cells must have valid numerical data (except the first column)
- Minimum Criteria: At least 2 criteria columns are required
⚠️ Important Notes
- The number of weights must match the number of criteria columns
- The number of impacts must match the number of criteria columns
- Weights should be positive numbers
- Impacts should be either
+(benefit) or-(cost) - All criterion values must be numeric
🔧 How TOPSIS Works
- Normalize the decision matrix
- Apply weights to the normalized matrix
- Identify ideal best and ideal worst solutions
- Calculate the distance of each alternative from ideal best and ideal worst
- Compute the performance score (closeness coefficient)
- Rank alternatives based on performance scores
📝 License
This project is licensed under the MIT License.
👤 Author
Anshul
Roll Number: 102303930
🤝 Contributing
Contributions, issues, and feature requests are welcome!
📧 Contact
For any queries or suggestions, please feel free to reach out.
Note: This package was created as part of an academic project for UCS654 - Prescriptive Analytics.
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_anshul_102303930-1.0.2.tar.gz.
File metadata
- Download URL: topsis_anshul_102303930-1.0.2.tar.gz
- Upload date:
- Size: 5.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cc69affddadd1d3e7053f1a78f6223f303a42907049e2cbb48231364f1b4960
|
|
| MD5 |
c3db16e1a7a8453f764f55eba3b8ab54
|
|
| BLAKE2b-256 |
879a02e0574ebded237a3911e883c03d3986205f54f5187236a96685d52621cb
|
File details
Details for the file topsis_anshul_102303930-1.0.2-py3-none-any.whl.
File metadata
- Download URL: topsis_anshul_102303930-1.0.2-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d3583de1dc42aee7b005e559a0eb3b1422d37999246ef755c21b685bf3798df
|
|
| MD5 |
583ca9d48efae905f2470894464a01ce
|
|
| BLAKE2b-256 |
45617db00be8f9898e94cc5e4a0182e03e1be2919ba91db55438971b758f3825
|