A Python implementation of the TOPSIS decision-making method.
Project description
TOPSIS Package
A Python package for ranking alternatives using the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method.
Installation
Install the package via pip:
pip install TopsisPackage_102216017
Usage
Command-Line Interface (CLI)
Run the TOPSIS method from the command line:
topsis <input_file.csv> [weights] [impacts]
Parameters:
<input_file.csv>: Path to the CSV file containing the data.[weights]: List of weights for criteria, e.g.,[0.4,0.3,0.3].[impacts]: List of impacts, where+is for beneficial criteria and-is for non-beneficial criteria.
Example:
topsis data.csv [0.5,0.3,0.2] [+, -, +]
Using in Python Code
You can use the package programmatically in Python:
from TopsisPackage_102216017 import Topsis
# Input data: rows = alternatives, columns = criteria
data = [
[250, 16, 12],
[200, 16, 8],
[300, 32, 16]
]
weights = [0.4, 0.3, 0.3] # Criteria weights
impacts = ['+', '-', '+'] # '+' = beneficial, '-' = non-beneficial
# Create a Topsis object and calculate scores and ranks
topsis = Topsis(data, weights, impacts)
scores, ranks = topsis.rank()
print("Scores:", scores) # Performance scores
print("Ranks:", ranks) # Rankings
Input File Format
The input CSV file should have the following structure:
| Alternative | Criterion1 | Criterion2 | Criterion3 |
|---|---|---|---|
| A1 | 250 | 16 | 12 |
| A2 | 200 | 16 | 8 |
| A3 | 300 | 32 | 16 |
Notes:
- First column: Names of alternatives (e.g., A1, A2).
- Remaining columns: Numerical values for each criterion.
License
This project is licensed under the MIT License.
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 topsispackage_102216017-1.0.0.tar.gz.
File metadata
- Download URL: topsispackage_102216017-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3bed1ce01ebf401aa5a64a6a0d63c33577609fc1782749a3f7f1cb082c24d5f1
|
|
| MD5 |
0ec3fb12eade183c72959a51cbea4995
|
|
| BLAKE2b-256 |
3767b5bdf7f3fe0042f8ca356a4c5c10bb6f511340883a75e77998eba85410e8
|
File details
Details for the file TopsisPackage_102216017-1.0.0-py3-none-any.whl.
File metadata
- Download URL: TopsisPackage_102216017-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4ea5db4ed536a4ad4f7c91fe92560cf785a586749640038ec90977c6a7c6d53
|
|
| MD5 |
5ed9e01f95ee4b66c762051dcccbeb33
|
|
| BLAKE2b-256 |
7842c5f3087388d9fa8d5205dca17d3abddb25384fc4e0b1b3826277af49e117
|