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.0.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.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_raghavpahwa_102303608-1.0.0.tar.gz
Algorithm Hash digest
SHA256 8aeae954e1d4bc4cb68cbeebdeae98e4bc345be79d43f95dcea6df1583c98496
MD5 b3a1a7f6f596afeb30ad9c7817304a00
BLAKE2b-256 143e5a3d5f5cd1922118f7db7030f4510bcdf93dd1f6da728bbbe8b8cd13a1d4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_raghavpahwa_102303608-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1d1493d4680c098042a855cbdae55f6a0878b944927448c7f2564e50cc6c8e30
MD5 3a8c892051f53f49bc2e8f49105977e4
BLAKE2b-256 e15148f3941ad3869f2aef161234f97aff15de51694a3bde5e62558e2dd5ff71

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