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.
Release files for topsis-anshul-102303930 1.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| topsis_anshul_102303930-1.0.2.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| topsis_anshul_102303930-1.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / topsis_anshul_102303930-1.0.2.tar.gz
| Download URL | topsis_anshul_102303930-1.0.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
9cc69affddadd1d3e7053f1a78f6223f303a42907049e2cbb48231364f1b4960
|
|
BLAKE2b-256 checksum How to use checksums |
879a02e0574ebded237a3911e883c03d3986205f54f5187236a96685d52621cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / topsis_anshul_102303930-1.0.2-py3-none-any.whl
| Download URL | topsis_anshul_102303930-1.0.2-py3-none-any.whl |
|---|---|
| Size | 5.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1d3583de1dc42aee7b005e559a0eb3b1422d37999246ef755c21b685bf3798df
|
|
BLAKE2b-256 checksum How to use checksums |
45617db00be8f9898e94cc5e4a0182e03e1be2919ba91db55438971b758f3825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|