TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) implementation in Python
Project description
topsis_kashish_102316021
TOPSIS - Technique for Order of Preference by Similarity to Ideal Solution
TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a multi-criteria decision-making method used to rank alternatives based on multiple criteria.
The best alternative is the one that:
- Has the shortest distance from the ideal best solution
- Has the farthest distance from the ideal worst solution
This project provides a command-line implementation of the TOPSIS method in Python.
Installation
Install from PyPI
pip install topsis_kashish_102316021
Install Locally (from project directory)
pip install .
Usage
Command Line
topsis_kashish_102316021 <input_file> <weights> <impacts> <output_file>
Parameters
input_file→ CSV file containing alternatives and criteriaweights→ Comma-separated numeric weights (e.g.,"1,1,1,1,1")impacts→ Comma-separated impacts:+for benefit criteria-for cost criteria
output_file→ Output CSV file containing results
Example
topsis_kashish_102316021 data.csv "1,1,1,1,1" "+,+,-,+,+" result.csv
Python API Usage
You can also use the package inside Python:
from topsis_kashish_102316021 import topsis
topsis(
"data.csv",
["1", "1", "1", "1", "1"],
["+", "+", "-", "+", "+"],
"result.csv"
)
Input Format
- The first column must contain alternative names.
- Remaining columns must contain numeric criteria values.
- No missing values are allowed.
Example Input File
Object,Criteria1,Criteria2,Criteria3,Criteria4,Criteria5
Option1,25,50,12,200,45
Option2,30,60,10,180,50
Option3,20,45,15,220,40
Output Format
The output CSV file includes:
- Original data
Topsis Score(value between 0 and 1; higher is better)Rank(1 indicates the best alternative)
Example Output
Object,Criteria1,Criteria2,Criteria3,Criteria4,Criteria5,Topsis Score,Rank
Option1,25,50,12,200,45,0.534,3
Option2,30,60,10,180,50,0.782,1
Option3,20,45,15,220,40,0.654,2
Validation Checks
The program validates:
- Number of weights must match number of criteria
- Number of impacts must match number of criteria
- Impacts must be either
+or- - Criteria columns must contain numeric values only
Technologies Used
- Python
- NumPy
- Pandas
- setuptools
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_kashish_102316021-1.0.0.tar.gz.
File metadata
- Download URL: topsis_kashish_102316021-1.0.0.tar.gz
- Upload date:
- Size: 4.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14c7accb6cebf8a2bcb3af0285009d2f903c696d43d3cc335e450f65b453fba3
|
|
| MD5 |
cf4924d1b243f9de546771a6f69f2d50
|
|
| BLAKE2b-256 |
2c65584378b5a095d4ae647551607f3ce68c827b8a1337d061401b2b2c4c8e72
|
File details
Details for the file topsis_kashish_102316021-1.0.0-py3-none-any.whl.
File metadata
- Download URL: topsis_kashish_102316021-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c31bfb54d89b8e88b4c44818d2e4e6ecf75f96711ac3d7a8254b118e28218fa1
|
|
| MD5 |
15ff27c358a562a23596064c48e1a63c
|
|
| BLAKE2b-256 |
b562fd01d8799f2173ad80b1466981ee8a46f6a7a070891f82a286c6fdfa07aa
|