Skip to main content

Technique for Order Preference by Similarity to Ideal Solution(TOPSIS) Package

Project description

TOPSIS Analysis Tool

This project implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) for multi-criteria decision making. The tool takes a decision matrix, applies weights and impacts for each criterion, and ranks the alternatives based on their relative performance. This python package was built under acronym topsis-varun-102217105 as University Student Project.

Features

  • Supports decision matrix input via CSV or Excel files (.xlsx, .xls).
  • Allows customizable weights and impacts for each criterion.
  • Outputs ranked results in a CSV file.

Installation

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

Usage

The script accepts 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 input decision matrix file. Accepts .csv, .xlsx, or .xls files.
  • <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 containing ranks.

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 <input_file> <weights> <impacts> <output_file>

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)

Performs TOPSIS analysis and returns the ranks of the alternatives.

Parameters:

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

Returns:

  • List of ranks for the alternatives.

excel_to_csv(excel_file, csv_output)

Converts an Excel file to 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

  • Ensure that the weights and impacts match the number of criteria in the decision matrix.
  • The decision matrix should not include the alternative names in the criteria columns (e.g., the first column in the input file should contain names like A1, A2, etc.).

License

This project is licensed under the MIT License.

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_varun_102217105-0.2.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

topsis_varun_102217105-0.2.0-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

Details for the file topsis_varun_102217105-0.2.0.tar.gz.

File metadata

  • Download URL: topsis_varun_102217105-0.2.0.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for topsis_varun_102217105-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2834f6ed0bd8cc3124aa022e9ac6a01fa8f1802538a6d903eed0ecfd5e51b85e
MD5 c2cd3577eaaa25a93123ad633ffa3b7b
BLAKE2b-256 61f952e6e173ec36b4d5f4604705923568762a2f0f8da4d83306a4a8241d4109

See more details on using hashes here.

File details

Details for the file topsis_varun_102217105-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_varun_102217105-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d39672c6eda5069d8c96f9bbcf3fd72812d27d78607ef7c41828e64cf3c3734
MD5 7e1b19979eb6d5a97ea7834ad93c527a
BLAKE2b-256 b72d638ae86822bf93b2df57db61a1f44f16b56e489d2981878096ecb141f0a1

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