A command-line implementation of TOPSIS
Project description
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
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_raghavpahwa_102303608-1.0.1.tar.gz.
File metadata
- Download URL: topsis_raghavpahwa_102303608-1.0.1.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
562496473615363d623ce6f3af061571946c664a293a692450e97201e4a7a6d1
|
|
| MD5 |
b64ea6993e300284ee59b6458859c6c3
|
|
| BLAKE2b-256 |
79cd1c56b1bda3ecfa762e8777155d2a6419fd4cce1c691d5c8a30a5f1246cce
|
File details
Details for the file topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl.
File metadata
- Download URL: topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e67931627a46b60b922f68d9d9b0dab2e7156954c91c8a31ae83fe4d78356f3
|
|
| MD5 |
be1ff7fa75560b1795e89a6088aea0f0
|
|
| BLAKE2b-256 |
4cd229a661d7fc7d2b5059146a2100cb320cf7f38fea1897cf197c8c956722c1
|