Skip to main content

TOPSIS CLI tool

Project description

TOPSIS Package

Project description

TOPSIS Implementation

Overview

This Python package provides a straightforward implementation of the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method for multi-criteria decision-making. With this tool, you can rank alternatives based on multiple criteria using weights and impacts for each criterion.

Features

  • Easy-to-use command-line interface.
  • Supports customizable weights and impacts for criteria.
  • Outputs a ranked list of alternatives with TOPSIS scores.
  • Handles CSV input and output for seamless integration with data workflows.

Usage

Command-Line Interface

To execute TOPSIS, use the following command:

python topsis.py <input_file> <weights> <impacts> <output_file>
Arguments
  • <input_file>: Path to the CSV file containing the input data. The first column should contain alternative names, and subsequent columns should contain numerical criteria values.
  • <weights>: Comma-separated weights for each criterion (e.g., 1,2,3).
  • <impacts>: Comma-separated impacts for each criterion (+ for benefit criteria, - for cost criteria, e.g., +, +, -, +).
  • <output_file>: Path to the CSV file where the results will be saved.
Example

Suppose you have the following input file (data.csv):

Alternative Criterion 1 Criterion 2 Criterion 3
A1 250 16 12
A2 200 20 8
A3 300 12 15
A4 275 14 10

To rank the alternatives with weights 1,1,1 and impacts +,+,-, run:

python topsis.py data.csv 1,1,1 +,+,- results.csv

The output (results.csv) will include the TOPSIS scores and ranks:

Alternative Criterion 1 Criterion 2 Criterion 3 Topsis Score Rank
A1 250 16 12 0.6547 2
A2 200 20 8 0.3001 4
A3 300 12 15 0.8234 1
A4 275 14 10 0.4921 3
Input File Requirements
  • The input file must be a CSV with at least three columns.
  • The first column should contain the names of the alternatives.
  • The remaining columns should contain numerical values for criteria.
Output File

The output file will contain the original data along with two additional columns:

  • Topsis Score: The calculated TOPSIS score for each alternative.
  • Rank: The rank of each alternative based on the TOPSIS score (1 = best).

Error Handling

The package validates inputs and raises errors for:

  • Input files with fewer than three columns.
  • Mismatched lengths of weights or impacts compared to the criteria.
  • Invalid impact values (must be + or -).

License

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

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

Contact

For questions or feedback, please contact mrinankjit@gmail.com.

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_mrinank_102303235-0.0.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

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

topsis_mrinank_102303235-0.0.1-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file topsis_mrinank_102303235-0.0.1.tar.gz.

File metadata

File hashes

Hashes for topsis_mrinank_102303235-0.0.1.tar.gz
Algorithm Hash digest
SHA256 4397b55e67058136f6c0f6992431aa8e968adcc383043439c1acacbc368010b8
MD5 a9955d7fadb5728d3d9028fff09f8ad4
BLAKE2b-256 cc678283de1f2d73ec11613128298c216221f7cf694611ec598de3f37783c12c

See more details on using hashes here.

File details

Details for the file topsis_mrinank_102303235-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_mrinank_102303235-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 7297a430c609839e14d8a9f9c3795799b35e65dde0440a0a652170fce3c202ba
MD5 f255f393cad9ad74324247e7877b6fe2
BLAKE2b-256 297a2a5994c8068ce831c007a137cf4324c2a93ee1ade0511c6efe7c9a881d7f

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