TOPSIS command-line tool for multi-criteria decision making
Project description
topsis-harshleen-102303220
A Python command-line package implementing the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method for multi-criteria decision making (MCDM).
This package allows users to rank multiple alternatives based on several criteria by specifying weights and impacts, following standard TOPSIS methodology.
Table of Contents
- Introduction
- What is TOPSIS?
- Features
- Installation
- Usage
- Input File Format
- Weights and Impacts
- Algorithm Steps
- Output Format
- Validation and Error Handling
- Example
- Author
- License
Introduction
Decision making often involves evaluating multiple alternatives against several criteria.
TOPSIS is a well-known technique that helps identify the best alternative by comparing how close each option is to an ideal solution.
This package provides a command-line implementation of TOPSIS using Python and supports real-world datasets through CSV input files.
What is TOPSIS?
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) ranks alternatives based on:
- Minimum distance from the Ideal Best solution
- Maximum distance from the Ideal Worst solution
The alternative with the highest TOPSIS score is considered the best.
Features
- Command-line based TOPSIS implementation
- Supports any number of alternatives and criteria
- User-defined weights and impacts
- Automatic ranking of alternatives
- Input validation and error handling
- Outputs results in CSV format
- Compatible with large datasets
Installation
Install the package directly from PyPI:
pip install topsis-harshleen-102303220
Usage
Run the package using Python module execution:
bash
Copy code
python -m topsis_harshleen_102303220.topsis <InputDataFile> <Weights> <Impacts> <OutputFile>
Arguments
Argument Description
InputDataFile CSV file containing decision matrix
Weights Comma-separated numeric weights
Impacts Comma-separated + or -
OutputFile Name of output CSV file
Input File Format
The first column must contain alternative names
Remaining columns must contain numeric values
At least 3 columns are required
Example Input (data.csv)
csv
Copy code
Mobile,Price,Storage,Camera,Looks
Mobile 1,250,16,12,5
Mobile 2,200,16,8,3
Mobile 3,300,32,16,4
Mobile 4,275,32,8,4
Mobile 5,225,16,16,2
Weights and Impacts
Weights
Represent the importance of each criterion
Must be numeric
Provided as comma-separated values
Example:
text
Copy code
1,1,1,1
Impacts
+ indicates benefit criterion
- indicates cost criterion
Example:
text
Copy code
-,+,+,+
Algorithm Steps
Read and validate input data
Normalize decision matrix using vector normalization
Apply weights to normalized matrix
Determine ideal best and ideal worst solutions
Compute Euclidean distance from ideal solutions
Calculate TOPSIS performance score
Rank alternatives based on scores
Output Format
The output file is a CSV containing:
Original data
Topsis Score
Rank (Rank 1 = Best alternative)
Example Output
cs
Copy code
Mobile,Price,Storage,Camera,Looks,Topsis Score,Rank
Mobile 3,300,32,16,4,0.6916,1
Mobile 4,275,32,8,4,0.5348,2
Mobile 1,250,16,12,5,0.5343,3
Mobile 5,225,16,16,2,0.4010,4
Mobile 2,200,16,8,3,0.3083,5
Validation and Error Handling
The package performs the following checks:
Correct number of command-line arguments
Input file existence
Minimum number of columns
Numeric values in criteria columns
Matching count of weights, impacts, and criteria
Valid impact symbols (+ or -)
Meaningful error messages are displayed for incorrect inputs.
Example
bash
Copy code
python -m topsis_harshleen_102303220.topsis data.csv "1,1,1,1" "-,+,+,+" output.csv
Author
Harshleen
Roll Number: 102303220
B.Tech Computer Engineering
Thapar Institute of Engineering and Technology
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_harshleen_102303220-0.1.1.tar.gz.
File metadata
- Download URL: topsis_harshleen_102303220-0.1.1.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4890f27ddaa1422fdb72055153f66e9f5d2c3cf0b8563ca49b200fbac58a9f1e
|
|
| MD5 |
3c07f57ae6e324a588eade1d2e49a4cd
|
|
| BLAKE2b-256 |
4266519c88b223190716d8a7b8cfc08d7d4e9b889513932bde952d49c3caf819
|
File details
Details for the file topsis_harshleen_102303220-0.1.1-py3-none-any.whl.
File metadata
- Download URL: topsis_harshleen_102303220-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd4a9a3c3d3322872e61a30374db84b3802faa0d601e7de55128600ff1aefe46
|
|
| MD5 |
cb6bca8eb63b3035e2b885917c85cd04
|
|
| BLAKE2b-256 |
8cae20230fb470df8938ea9acf3771ee6d83d63dec6812c26d291d28e19ccc05
|