Skip to main content

TOPSIS decision making package

Project description

TOPSIS-Keshav-102303520

A Python library for solving Multiple Criteria Decision Making (MCDM) problems using the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).

Project Description

This package implements TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution), a multi-criteria decision analysis method. TOPSIS is based on the concept that the chosen alternative should have the shortest geometric distance from the positive ideal solution and the longest geometric distance from the negative ideal solution.

Installation

Use the package manager pip to install the package:

pip install topsis-keshav-102303520

Usage

Enter CSV filename followed by .csv extension, then enter the weights vector with vector values separated by commas, followed by the impacts vector with comma separated signs (+,-).

Method 1: With quotes

topsis sample.csv "1,1,1,1" "+,-,+,+" output.csv

Method 2: Without quotes

topsis sample.csv 1,1,1,1 +,-,+,+ output.csv

Note: The second representation does not provide for inadvertent spaces between vector values. So, if the input string contains spaces, make sure to enclose it between double quotes ("").

To view usage help, use:

topsis -h

Example

sample.csv

A CSV file showing data for different mobile handsets having varying features:

Model Storage space(in gb) Camera(in MP) Price(in $) Looks(out of 5)
M1 16 12 250 5
M2 16 8 200 3
M3 32 16 300 4
M4 32 8 275 4
M5 16 16 225 2

Input

topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv

Where:

  • weights vector = [0.25, 0.25, 0.25, 0.25]
  • impacts vector = [+, +, -, +]

Output

TOPSIS RESULTS
------------------------------
Model  P-Score  Rank
   M3  0.691632    1
   M4  0.534737    2
   M1  0.534277    3
   M5  0.401046    4
   M2  0.308368    5

The results show the TOPSIS score (P-Score) and rank for each alternative, where rank 1 indicates the best option.

Other Notes

  • The first column and first row are removed by the library before processing, in attempt to remove indices and headers. So make sure the CSV follows the format as shown in sample.csv
  • Make sure the CSV does not contain categorical values
  • Ensure the number of weights and impacts matches the number of criteria (columns)
  • Impacts must be either '+' (beneficial) or '-' (non-beneficial)

Input File Format Requirements

  1. The input file must be a CSV with the first column as object/alternative names
  2. From the 2nd column onwards, there must be numeric values only
  3. The number of weights, impacts, and columns (from 2nd column) must be the same
  4. Impacts must be either +ve ('+') or -ve ('-')
  5. Weights must be numeric and greater than 0

Algorithm

TOPSIS follows these steps:

  1. Normalize the decision matrix
  2. Calculate weighted normalized decision matrix
  3. Determine ideal best and ideal worst solutions
  4. Calculate Euclidean distances from ideal best and ideal worst
  5. Calculate performance score and rank alternatives

Features

  • ✅ Easy to use command-line interface
  • ✅ Handles multiple criteria decision making
  • ✅ Automatic validation of inputs
  • ✅ Generates ranked results with TOPSIS scores
  • ✅ Exports results to CSV format
  • ✅ Comprehensive error handling

Requirements

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

Author

Keshav Sharma
Roll No: 102303520 Email: ksharma5_be23@thapar.edu

Contributing

Pull requests are welcome. For major changes, pleases open an issue first to discuss what you would like to change.

Keywords

  • TOPSIS
  • MCDM
  • Multi-Criteria Decision Making
  • Decision Analysis
  • Optimization
  • Python
  • Data Science

Version History

  • 1.0.0 (Initial Release)
    • Basic TOPSIS implementation
    • Command-line interface
    • CSV input/output support
    • Input validation
    • Error handling

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_keshav_102303520-1.0.1.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

topsis_keshav_102303520-1.0.1-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file topsis_keshav_102303520-1.0.1.tar.gz.

File metadata

  • Download URL: topsis_keshav_102303520-1.0.1.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for topsis_keshav_102303520-1.0.1.tar.gz
Algorithm Hash digest
SHA256 39d9daeed64bdab3128dcc6da2c246c1090729564d47e8a04d32e3ad20881772
MD5 56586f0761ce2defdfc8a10507f2fd0c
BLAKE2b-256 adc2bb56cfd231e18b9a294716b947c262356560038014cdd05157efaa087340

See more details on using hashes here.

File details

Details for the file topsis_keshav_102303520-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_keshav_102303520-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 790b71fa9b0f9810e1ca6d2096397b1e9bd46aea33059bf5e1e4ea201c531963
MD5 7de00a26089abde1056298ea3712303e
BLAKE2b-256 9ce05dbf181c1cd0d4ac7256250e8749e612a4cc4497318d8344456fbeb24026

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