Skip to main content

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

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis_aindri_102316039-1.0.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsis_aindri_102316039-1.0.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file topsis_aindri_102316039-1.0.0.tar.gz.

File metadata

  • Download URL: topsis_aindri_102316039-1.0.0.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for topsis_aindri_102316039-1.0.0.tar.gz
Algorithm Hash digest
SHA256 612bb79ca42bc215d6d3fc8923419c012c88fa815b36deebacfd27193ac6b80b
MD5 faf94535dabd8235a1d4ca094554796f
BLAKE2b-256 e0d3e11a5050ede61593e1994a6d3eb62e9721fa39cececb5c49f7eca5f8dbca

See more details on using hashes here.

File details

Details for the file topsis_aindri_102316039-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_aindri_102316039-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 024fe7a8200dcd21bf5dcac26f93eb68ef5b2155d5b0dad2be8839f9a71d73ad
MD5 f7d0a6cb8ef3d1effd98c671304177d5
BLAKE2b-256 ec26833d9be645dc8a562740a1990f0d8de209d1017bb60aa49c0bb13f883d25

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page