Skip to main content

A command-line implementation of TOPSIS

Project description

TOPSIS – Raghav Pahwa (102303608)

Topsis - RaghavPahwa-102303608 is a Python library for solving Multiple Criteria Decision Making (MCDM) problems using the
Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).

TOPSIS is based on the concept that the chosen alternative should have the shortest distance from the positive ideal solution and the longest distance from the negative ideal solution.

This package provides a simple command-line interface to apply TOPSIS on any CSV dataset.


Installation

Use pip to install the package:

pip install Topsis-RaghavPahwa-102303608

Usage

Enter the CSV filename, followed by the weights vector and impacts vector:

topsis <InputFile.csv> <Weights> <Impacts> <OutputFile.csv>

Method 1: With Quotes (Recommended)

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

Method 2: Without Quotes

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

Note:
The second method does not allow spaces between values.
If your input contains spaces, always use double quotes (").

To view help:

topsis -h

Example

sample.csv

Model,Storage,Camera,Price,Looks
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 (output.csv)

   Topsis Score  Rank
1      0.534277     3
2      0.308368     5
3      0.691632     1
4      0.534737     2
5      0.401046     4

The alternative with Rank = 1 is the best choice according to TOPSIS.


Input File Requirements

  • The input file must be a CSV.
  • The first column should contain alternative names.
  • From the 2nd column onwards, all values must be numeric.
  • The number of:
    • Weights
    • Impacts
    • Criteria columns
      must be the same.
  • Impacts must be:
    • + for beneficial criteria
    • - for non-beneficial criteria
  • Weights must be numeric and greater than 0.

Algorithm

  1. Normalize the decision matrix
  2. Calculate the weighted normalized matrix
  3. Determine ideal best and ideal worst solutions
  4. Compute Euclidean distances
  5. Calculate performance scores
  6. Rank all alternatives

Author

Raghav Pahwa
Roll No: 102303608
Thapar Institute of Engineering and Technology


License

MIT License


Keywords

TOPSIS
MCDM
Multi-Criteria Decision Making
Decision Analysis
Optimization

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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_raghavpahwa_102303608-1.0.1.tar.gz
Algorithm Hash digest
SHA256 562496473615363d623ce6f3af061571946c664a293a692450e97201e4a7a6d1
MD5 b64ea6993e300284ee59b6458859c6c3
BLAKE2b-256 79cd1c56b1bda3ecfa762e8777155d2a6419fd4cce1c691d5c8a30a5f1246cce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_raghavpahwa_102303608-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5e67931627a46b60b922f68d9d9b0dab2e7156954c91c8a31ae83fe4d78356f3
MD5 be1ff7fa75560b1795e89a6088aea0f0
BLAKE2b-256 4cd229a661d7fc7d2b5059146a2100cb320cf7f38fea1897cf197c8c956722c1

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