TOPSIS implementation using Python
Project description
TOPSIS Package
Overview
This package implements the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS), a widely used Multi-Criteria Decision Making (MCDM) method. It ranks alternatives based on their distance from an ideal best and an ideal worst solution.
The package is designed to work directly from the command line and processes data provided in CSV format.
Features
- Accepts CSV input files with multiple decision criteria
- Supports user-defined weights for each criterion
- Supports benefit (
+) and cost (-) impacts - Generates a ranked output file with TOPSIS scores
- Handles invalid inputs with clear error messages
Installation
Install the package using pip:
pip install Topsis-Atharva-102303372
Usage
Run the package from the command line using:
python -m topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>
Example
python -m topsis 102303372-input.csv "1,1,1,2,3" "+,+,-,+,+" 102303372-output.csv
Parameters
-
<InputDataFile>Path to the CSV file containing the decision matrix. The first column must contain alternative names, and the remaining columns must contain numeric criteria values. -
<Weights>Comma-separated weights corresponding to each criterion (example:1,2,1,1) -
<Impacts>Comma-separated impacts for each criterion Use+for benefit criteria and-for cost criteria (example:+,+,-,+) -
<ResultFileName>Name of the output CSV file where results will be saved
Sample Input File
The input CSV file should contain alternatives in the first column, followed by numerical values for each criterion.
Example: 102303372-input.csv
Model,Storage,Camera,Price,Looks
A1,64,48,32000,4
A2,128,64,45000,5
A3,64,32,28000,3
A4,256,108,60000,5
A5,128,48,40000,4
Output
The output CSV file contains the original data along with the following additional columns:
- Topsis Score
- Rank
The alternative with Rank 1 is considered the best choice.
Example Output
Model,Storage,Camera,Price,Looks,Topsis Score,Rank
A2,128,64,45000,5,0.812,1
A5,128,48,40000,4,0.684,2
A1,64,48,32000,4,0.552,3
A4,256,108,60000,5,0.421,4
A3,64,32,28000,3,0.305,5
Error Handling
The package checks for:
- Missing or invalid input files
- Non-numeric values in criteria columns
- Mismatch between number of criteria, weights, and impacts
- Invalid impact symbols (must be
+or-)
Appropriate error messages are displayed for each case.
Author
Atharva Pandey
License
This project is intended for academic and educational use.
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_atharva_102303372-1.0.2.tar.gz.
File metadata
- Download URL: topsis_atharva_102303372-1.0.2.tar.gz
- Upload date:
- Size: 3.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
12c27e05725f0e51834ab8d8fe61399ab50203753105a7940a3169a1659da451
|
|
| MD5 |
2a0b65bd42ab8e05d53686b867fa7e5f
|
|
| BLAKE2b-256 |
789e4cd325858e743028cdf3a065385ad89b48353ec1068dde898f09588335ef
|
File details
Details for the file topsis_atharva_102303372-1.0.2-py3-none-any.whl.
File metadata
- Download URL: topsis_atharva_102303372-1.0.2-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a47b0efb6c55713b2602e896ce5ffa7f568a2424a20880fb1d30c66a1486b47
|
|
| MD5 |
6db56a5ec9a3d7500054200ff92d4664
|
|
| BLAKE2b-256 |
a5d42b795918977e1a786c7730871b0783818aa74bb4dbd13cc42a18c9afd145
|