A Python package for TOPSIS decision making
Project description
TOPSIS-Harshita-102303491
A Python library for solving Multiple Criteria Decision Making (MCDM) problems using the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).
Project Description
This package implements TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution), a multi-criteria decision analysis method. TOPSIS is based on the concept that the chosen alternative should have the shortest geometric distance from the positive ideal solution and the longest geometric distance from the negative ideal solution.
Installation
Use the package manager pip to install the package:
pip install topsis-harshita-102303491
Usage
Enter CSV filename followed by .csv extension, then enter the weights vector with vector values separated by commas, followed by the impacts vector with comma separated signs (+,-).
Method 1: With quotes
topsis sample.csv output.csv "1,1,1,1" "+,-,+,+" output.csv
Method 2: Without quotes
topsis sample.csv 1,1,1,1 +,-,+,+ output.csv
Note: The second representation does not provide for inadvertent spaces between vector values. So, if the input string contains spaces, make sure to enclose it between double quotes ("").
To view usage help, use:
topsis -h
Example
sample.csv
A CSV file showing data for different mobile handsets having 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 |
Input
topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv
Where:
- weights vector = [0.25, 0.25, 0.25, 0.25]
- impacts vector = [+, +, -, +]
Output
TOPSIS RESULTS
------------------------------
P-Score Rank
1 0.534277 3
2 0.308368 5
3 0.691632 1
4 0.534737 2
5 0.401046 4
The results show the TOPSIS score (P-Score) and rank for each alternative, where rank 1 indicates the best option.
Other Notes
- The first column and first row are removed by the library before processing, in attempt to remove indices and headers. So make sure the CSV follows the format as shown in sample.csv
- Make sure the CSV does not contain categorical values
- Ensure the number of weights and impacts matches the number of criteria (columns)
- Impacts must be either '+' (beneficial) or '-' (non-beneficial)
Input File Format Requirements
- The input file must be a CSV with the first column as object/alternative names
- From the 2nd column onwards, there must be numeric values only
- The number of weights, impacts, and columns (from 2nd column) must be the same
- Impacts must be either +ve ('+') or -ve ('-')
- Weights must be numeric and greater than 0
Algorithm
TOPSIS follows these steps:
- Normalize the decision matrix
- Calculate weighted normalized decision matrix
- Determine ideal best and ideal worst solutions
- Calculate Euclidean distances from ideal best and ideal worst
- Calculate performance score and rank alternatives
Author
Harshita
Roll No: 102303491
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Requirements
- Python >=3.6
Keywords
- TOPSIS
- MCDM
- Multi-Criteria Decision Making
- Decision Analysis
- Optimization
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_harshita_102303491-1.0.2.tar.gz.
File metadata
- Download URL: topsis_harshita_102303491-1.0.2.tar.gz
- Upload date:
- Size: 4.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3040cc512e383db298aa6812a7afb988135aff52ae5534f20a6ae2680627b944
|
|
| MD5 |
a878f9b38c446fcb410d7d1e1b24dabd
|
|
| BLAKE2b-256 |
56b8932d7d80c1db115e1e8e1dc28d2f970bfa0eb28d4b8b4d123c09e652a515
|
File details
Details for the file topsis_harshita_102303491-1.0.2-py3-none-any.whl.
File metadata
- Download URL: topsis_harshita_102303491-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d09970f6decbe162a61dae114ec49d65b6f525fb0fa91614f8f998daf7b23da1
|
|
| MD5 |
d0be2e200f6bb7650913f465ed70a8ae
|
|
| BLAKE2b-256 |
f858a0a390610742ac120ba3f5474fd625542aea59ad98b9893ab9b6e6d5d059
|