A Python package for TOPSIS multi-criteria decision making
Project description
Topsis-Vaibhav-102316130
A Python package for calculating TOPSIS score and ranking alternatives using the Technique for Order Preference by Similarity to Ideal Solution.
What is TOPSIS?
TOPSIS is a multi-criteria decision-making method used to rank alternatives based on their closeness to the ideal best solution and distance from the ideal worst solution.
The alternative with the highest TOPSIS score gets Rank 1.
Installation
pip install Topsis-Vaibhav-102316130
Usage
Run the package from the command line using:
python -m topsis_vaibhav_102316130.topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>
Example
python -m topsis_vaibhav_102316130.topsis data.csv "1,1,1,1" "-,+,+,+" output-result.csv
Input CSV Format
The input file must be a CSV file.
The input CSV must contain three or more columns.
The first column should contain the name or identifier of the alternative.
From the second column to the last column, all values must be numeric.
Example input file:
Model,Price,Storage,Camera,Looks
M1,250,16,12,5
M2,200,16,8,3
M3,300,32,16,4
M4,275,32,8,4
M5,225,16,16,2
Weights
Weights must be numeric and comma-separated.
Example:
1,1,1,1
The number of weights must be equal to the number of criteria columns.
Criteria columns are all columns from the second column to the last column.
Impacts
Impacts must be comma-separated.
Each impact must be either + or -.
Use + when a higher value is better.
Use - when a lower value is better.
Example:
-,+,+,+
The number of impacts must be equal to the number of criteria columns.
Output
The output file will be generated as a CSV file.
The output CSV contains all original columns plus two extra columns:
- Topsis Score
- Rank
Example output:
Model,Price,Storage,Camera,Looks,Topsis Score,Rank
M1,250,16,12,5,0.5342768571821003,3
M2,200,16,8,3,0.3083677687324685,5
M3,300,32,16,4,0.6916322312675315,1
M4,275,32,8,4,0.534736584486838,2
M5,225,16,16,2,0.40104612151678615,4
Error Handling
This package checks for:
- Correct number of command-line arguments
- File not found error
- Input file must contain three or more columns
- Values from the second column onward must be numeric
- Number of weights must match the number of criteria columns
- Number of impacts must match the number of criteria columns
- Impacts must be either
+or- - Weights and impacts must be separated by commas
Author
Vaibhav Gupta
Roll Number: 102316130
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_vaibhav_102316130-1.0.0.tar.gz.
File metadata
- Download URL: topsis_vaibhav_102316130-1.0.0.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
905af2559292d86d8adf116d24cc73f5d55ea15b4182f9026b68ac3527f14980
|
|
| MD5 |
91859c0776c2e677a2584cbb7df8fe2d
|
|
| BLAKE2b-256 |
da3286d2bb2c79300d8fa93abadce5fc8d8719b33a22c64528f57b1c4e730f6e
|
File details
Details for the file topsis_vaibhav_102316130-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_vaibhav_102316130-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
89a77c655838fd31c7eb3904ed6d4403a0840dd315e6c945e368d6e670601ab5
|
|
| MD5 |
4e65035d7e427dd0da286bf403e77d0d
|
|
| BLAKE2b-256 |
6939a53247dbe85170db79657bd7f74f6ebf573d4881cd85ba2c042986e0e131
|