It does the mathematics of topsis
Project description
TOPSIS Python Tool
Overview
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a widely used method in multi-criteria decision analysis (MCDA). It helps in ranking alternatives based on several criteria, each of which might have a different level of importance (weight) and impact (positive or negative).
This Python tool implements the TOPSIS algorithm to rank alternatives based on input data, weights, and impacts. It provides results including rankings, distances from both the ideal and worst solutions, and the corresponding TOPSIS score for each option.
Features
- Ranking: Automatically ranks alternatives based on selected criteria.
- Customizable Inputs: Allows users to specify custom weights and impacts for each criterion.
- Ideal Solution Calculation: Computes the Euclidean distance from both the ideal best and worst solutions.
- CSV Support: Read data from CSV files and output the results into CSV format.
Installation
To install the tool, use the following pip command:
pip install Topsis-Ria-102203069
Usage
Running from Command Line Once the package is installed, you can run the TOPSIS method directly from the command line by following this structure:
python -m topsis.topsis input_data.csv "1,1,2,2,1" "+,+,-,-,-" result.csv
Parameters
The command-line interface expects the following arguments:
input_data.csv (Required): The path to the input CSV file containing the data. The first column should list the alternatives (e.g., Option1, Option2, etc.), and the remaining columns should represent the criteria values for each alternative.
-
"1,1,2,2,1" (Required): A string of comma-separated values representing the weights assigned to each criterion. Higher values indicate more important criteria.
-
**"+,+,-,-,-" **(Required): A string of comma-separated values indicating the impact type for each criterion. + means a higher value is better for that criterion, and - means a lower value is better for that criterion.
-
result.csv (Required): The path to the output CSV file where the results will be stored. The resulting file will contain columns for each option, including:
Option name
Distance from the Ideal Best Distance from the Ideal Worst TOPSIS Score Rank
Explanation of Results
- ** Distance from Ideal Best:** The Euclidean distance between each alternative and the ideal best solution. The ideal best is the alternative with the highest value in all positively impactful criteria and the -lowest in all negatively impactful ones.
- Distance from Ideal Worst: The Euclidean distance between each alternative and the ideal worst solution. The ideal worst is the alternative with the lowest value in positively impactful criteria and the highest in negatively impactful ones.
- TOPSIS Score: A score that reflects how close each alternative is to the ideal solution. A higher score means the alternative is closer to the ideal best.
- Rank: The ranking of each alternative based on the TOPSIS score, with 1 being the best.
License
© 2025 Ria Goyal
This project is licensed under the MIT license. See LICENSE for more details.
Additional Information
This tool requires Python version 3.6 or higher. Make sure your input data is clean and only includes numerical values in the criteria columns. The input CSV file must have the alternatives listed in the first column, followed by the numerical values for each criterion.
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_ria_102203069-1.0.0.tar.gz.
File metadata
- Download URL: topsis_ria_102203069-1.0.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e088e01bbb48d570e81dc6f8077e20a93556ab258009601756a05b1d9203b12a
|
|
| MD5 |
db31608a42607a7d7b62e8d76d17f6e7
|
|
| BLAKE2b-256 |
e01213ad76df7a4bc31431744be3eeb21671befa639391384da0b7b0a6b54351
|
File details
Details for the file Topsis_Ria_102203069-1.0.0-py3-none-any.whl.
File metadata
- Download URL: Topsis_Ria_102203069-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5ac362e893dd1c620db01fd73db9221a15e27cae3c7215b2c19f5e13996decbb
|
|
| MD5 |
7e63af5a89f88cd357e46dc3eb19e1e9
|
|
| BLAKE2b-256 |
e50622d2679c840f4bf527a474b5c95e203ec99a69e0ae77c4c87c30935b7756
|