TOPSIS – Raghav Pahwa (102303608)
Topsis - RaghavPahwa-102303608 is a Python library for solving Multiple Criteria Decision Making (MCDM) problems using the
Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).
TOPSIS is based on the concept that the chosen alternative should have the shortest distance from the positive ideal solution and the longest distance from the negative ideal solution.
This package provides a simple command-line interface to apply TOPSIS on any CSV dataset.
Installation
Use pip to install the package:
pip install Topsis-RaghavPahwa-102303608
Usage
Enter the CSV filename, followed by the weights vector and impacts vector:
topsis <InputFile.csv> <Weights> <Impacts> <OutputFile.csv>
Method 1: With Quotes (Recommended)
topsis sample.csv "1,1,1,1" "+,-,+,+" result.csv
Method 2: Without Quotes
topsis sample.csv 1,1,1,1 +,-,+,+ result.csv
Note:
The second method does not allow spaces between values.
If your input contains spaces, always use double quotes (").
To view help:
topsis -h
Example
sample.csv
Model,Storage,Camera,Price,Looks
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 (output.csv)
Topsis Score Rank
1 0.534277 3
2 0.308368 5
3 0.691632 1
4 0.534737 2
5 0.401046 4
The alternative with Rank = 1 is the best choice according to TOPSIS.
Input File Requirements
- The input file must be a CSV.
- The first column should contain alternative names.
- From the 2nd column onwards, all values must be numeric.
- The number of:
- Weights
- Impacts
- Criteria columns
must be the same.
- Impacts must be:
+for beneficial criteria-for non-beneficial criteria
- Weights must be numeric and greater than 0.
Algorithm
- Normalize the decision matrix
- Calculate the weighted normalized matrix
- Determine ideal best and ideal worst solutions
- Compute Euclidean distances
- Calculate performance scores
- Rank all alternatives
Author
Raghav Pahwa
Roll No: 102303608
Thapar Institute of Engineering and Technology
License
MIT License
Keywords
TOPSIS
MCDM
Multi-Criteria Decision Making
Decision Analysis
Optimization
Release files for Topsis-RaghavPahwa-102303608 1.0.1
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_raghavpahwa_102303608-1.0.1.tar.gz | 4.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.5 kB
Release files / topsis_raghavpahwa_102303608-1.0.1.tar.gz
| Download URL | topsis_raghavpahwa_102303608-1.0.1.tar.gz |
|---|---|
| Size | 4.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
562496473615363d623ce6f3af061571946c664a293a692450e97201e4a7a6d1
|
|
BLAKE2b-256 checksum How to use checksums |
79cd1c56b1bda3ecfa762e8777155d2a6419fd4cce1c691d5c8a30a5f1246cce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|
Release files / topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl
| Download URL | topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5e67931627a46b60b922f68d9d9b0dab2e7156954c91c8a31ae83fe4d78356f3
|
|
BLAKE2b-256 checksum How to use checksums |
4cd229a661d7fc7d2b5059146a2100cb320cf7f38fea1897cf197c8c956722c1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.0
|