Skip to main content

A Python package for implementing the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method in Multi-Criteria Decision Making (MCDM)

Project description

TOPSIS Analysis Tool

This project implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS), a method for multi-criteria decision-making. The tool processes a decision matrix, applies specified weights and impacts for each criterion, and ranks the alternatives based on their performance. This Python package, developed under the acronym topsis_Vaibhav_102203877, was created as a University Student Project.

Features

  • Supports input of decision matrices in CSV or Excel formats (.xlsx, .xls).
  • Allows customization of weights and impacts for each criterion.
  • Generates ranked results as a CSV file.

Installation

  1. Clone the repository or download the script.
  2. Ensure Python (version 3.6 or later) is installed.
  3. Install the required dependencies using pip:
pip install numpy pandas openpyxl

Usage

The script uses command-line arguments to specify the input file, weights, impacts, and output file.

Command

topsis <input_file> <weights> <impacts> <output_file>

Parameters

  • <input_file>: Path to the decision matrix file. Accepts .csv, .xlsx, or .xls formats.
  • <weights>: Comma-separated weights for each criterion (e.g., 0.3,0.4,0.3).
  • <impacts>: Comma-separated impacts for each criterion (+ for beneficial, - for non-beneficial, e.g., +,+,-).
  • <output_file>: Path to save the output CSV file with rankings.

Example

Input File (data.csv):

Alternatives Criterion 1 Criterion 2 Criterion 3
A1 250 16 12
A2 200 20 10
A3 300 18 15

Command:

topsis data.csv 0.3,0.4,0.3 +,+,- output.csv

Output File (output.csv):

Alternatives Criterion 1 Criterion 2 Criterion 3 Rank
A1 250 16 12 2
A2 200 20 10 3
A3 300 18 15 1

Functions

topsis(data, weights, impacts)

Executes the TOPSIS algorithm and returns the rankings of the alternatives.

Parameters:

  • data: A 2D list or numpy array representing the decision matrix.
  • weights: A list of weights for each criterion.
  • impacts: A list of impacts (+ or -) for each criterion.

Returns:

  • A list of ranks for the alternatives.

excel_to_csv(excel_file, csv_output)

Converts an Excel file into a CSV file.

Parameters:

  • excel_file: Path to the Excel file.
  • csv_output: Path to save the converted CSV file.

Returns:

  • The path to the converted CSV file.

Notes

  • The number of weights and impacts must match the number of criteria in the decision matrix.
  • The decision matrix should not include alternative names in the criteria columns (e.g., the first column should list alternatives like A1, A2, etc.).

License

This project is licensed under the MIT License.


Let me know if you need further adjustments!

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

Uploaded Source

Built Distribution

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

File details

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

File metadata

File hashes

Hashes for Topsis_vaibhav_tandon_102203877-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0cc77036128f9811a3e6d347183d1923bf7299a84c84d8d58fa16f9d1b19f390
MD5 43ad133ecbe955b24cd6c1665511ed8f
BLAKE2b-256 7fa07b71b765b9ddfc7fb6385c7223822f64fba64e7735bee35c523622ef8c3a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for Topsis_vaibhav_tandon_102203877-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b4eaa3f983ec455205136ab2664034aefac887d8ee2a938e149342f6a581d683
MD5 41d0d82b30501ee5605d5c033d1079db
BLAKE2b-256 e83f24a484541a86aaa618f8c81e7af4a9f0a89933157e3add4497deaffdbe4c

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