TOPSIS Library
Overview
The TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) library provides an implementation of the TOPSIS decision-making method. This technique is used to rank alternatives based on multiple criteria by comparing their distance from an ideal best and an ideal worst solution.
Features
- Normalize decision matrices
- Apply weights and impacts to criteria
- Calculate rankings and performance scores
Installation
Install the library via pip:
pip install topsis-library
Usage
Here’s a quick guide to using the library:
from topsis.topsis import topsis
# Define the decision matrix
# Each row is an alternative, and each column is a criterion
data = [
[250, 16, 12, 5],
[200, 16, 8, 3],
[300, 32, 16, 4],
[275, 32, 8, 4],
[225, 16, 16, 2]
]
# Define weights for each criterion
weights = [0.25, 0.25, 0.25, 0.25]
# Define impacts for each criterion ('+' for benefit, '-' for cost)
impacts = ['+', '+', '-', '+']
# Calculate rankings and scores
rankings, scores = topsis(data, weights, impacts)
print("Rankings:", rankings)
print("Scores:", scores)
Output Example
Rankings: [3, 1, 4, 2, 5]
Scores: [0.7722, 0.5634, 0.8523, 0.6472, 0.4321]
How It Works
- Normalization: The decision matrix is normalized to make criteria comparable.
- Weight Application: Each criterion is weighted to reflect its importance.
- Ideal Solutions: The algorithm calculates the ideal best and worst values for each criterion.
- Distance Calculation: Distances from the ideal best and worst solutions are computed.
- Performance Scores: Scores are calculated based on proximity to the ideal solutions.
- Ranking: Alternatives are ranked based on their scores.
Testing
Run unit tests to ensure functionality:
python -m unittest discover tests
Author
Raghav Manchanda
Metadata
Release files for 102203162-topsis 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| 102203162_topsis-0.2.0.tar.gz | 2.4 kB | Without provenance | Details for 102203162_topsis-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| 102203162_topsis-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for 102203162_topsis-0.2.0-py3-none-any.whl |
Total release size: 4.5 kB
Release files / 102203162_topsis-0.2.0.tar.gz
| Download URL | 102203162_topsis-0.2.0.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca911369c76c19f25398b977a17b53815ede6a5193d34ad8310c33c19f64207b
|
|
BLAKE2b-256 checksum How to use checksums |
409315a877d6a956d53fd236ae409df8cb7a36a5b57f6230ac933760b295254c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Release files / 102203162_topsis-0.2.0-py3-none-any.whl
| Download URL | 102203162_topsis-0.2.0-py3-none-any.whl |
|---|---|
| Size | 2.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e968f3a481b9cfc62ef91e6683720ba0a24aee6828eeb52d34417edb6578c3a5
|
|
BLAKE2b-256 checksum How to use checksums |
7ad1b7683304af2a2fee54de4ae6d57d3adb989301e8e9009e3195098c8768cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.4
|
Security for 102203162-topsis 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.