Skip to main content

Topsis-Aindri-102316039

A Python package implementing TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) for multi-criteria decision making.

What is TOPSIS?

TOPSIS is a multi-criteria decision analysis method that helps rank alternatives based on their similarity to the ideal solution. It calculates:

  • The distance of each alternative from the ideal best solution
  • The distance from the ideal worst solution
  • A score that represents relative closeness to the ideal solution

The alternative with the highest TOPSIS score is ranked first.

Installation

pip install Topsis-Aindri-102316039

Usage

Command Line Interface

python -m topsis_aindri_102316039.topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>

Or if installed via pip:

topsis <InputDataFile> <Weights> <Impacts> <OutputResultFileName>

Example

python -m topsis_aindri_102316039.topsis data.csv "1,1,1,2" "+,+,-,+" result.csv

Input File Format

The input CSV file must have:

  • First column: Names/identifiers of alternatives
  • Remaining columns: Numeric criteria values

Example (data.csv):

Model,Price,Storage,Camera,Looks
M1,250,16,12,5
M2,200,16,8,3
M3,300,32,16,4
M4,275,32,8,4
M5,225,16,16,2

Parameters

  • Weights: Comma-separated numeric values representing the importance of each criterion (e.g., 1,1,1,2)
  • Impacts: Comma-separated + or - signs indicating whether higher values are beneficial (+) or detrimental (-) for each criterion (e.g., +,+,-,+)

Output

The output CSV file will contain all original columns plus:

  • Topsis Score: Calculated TOPSIS score (0-1, higher is better)
  • Rank: Ranking based on TOPSIS score (1 is best)

Python API

You can also use TOPSIS programmatically:

from topsis_aindri_102316039 import topsis

topsis("data.csv", "1,1,1,2", "+,+,-,+", "result.csv")

Input Validation

The package validates:

  • ✅ Correct number of parameters (4 required)
  • ✅ Input file existence
  • ✅ Minimum 3 columns in input file
  • ✅ Numeric values in all criteria columns (2nd column onwards)
  • ✅ Equal number of weights, impacts, and criteria
  • ✅ Impacts are either '+' or '-'

Requirements

  • Python >= 3.6
  • pandas >= 1.0.0
  • numpy >= 1.18.0

Author

Aindri Singh
Roll No: 102316039
Email: asingh2_be23@thapar.edu
GitHub: @aindrisingh

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contributing

Contributions, issues, and feature requests are welcome!

Acknowledgments

  • Based on the TOPSIS method developed by Hwang and Yoon (1981)
  • Created as part of UCS654 Assignment 2

Metadata

Release files for Topsis-Aindri-102316039 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for Topsis-Aindri-102316039 1.0.0
File Size Uploaded
topsis_aindri_102316039-1.0.0.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for Topsis-Aindri-102316039 1.0.0
File Interpreter ABI Platform
topsis_aindri_102316039-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 12.4 kB

Release files / topsis_aindri_102316039-1.0.0.tar.gz

Download URL topsis_aindri_102316039-1.0.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
612bb79ca42bc215d6d3fc8923419c012c88fa815b36deebacfd27193ac6b80b
BLAKE2b-256 checksum
How to use checksums
e0d3e11a5050ede61593e1994a6d3eb62e9721fa39cececb5c49f7eca5f8dbca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release files / topsis_aindri_102316039-1.0.0-py3-none-any.whl

Download URL topsis_aindri_102316039-1.0.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
024fe7a8200dcd21bf5dcac26f93eb68ef5b2155d5b0dad2be8839f9a71d73ad
BLAKE2b-256 checksum
How to use checksums
ec26833d9be645dc8a562740a1990f0d8de209d1017bb60aa49c0bb13f883d25
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page