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

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for topsis_jatin_102203713-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d111aac805c888f81154cd34ce8a1af21ad05c0e9da3fce2cfccac7d5dc9d0f7
MD5 e8cd01fe072fa258f9e68a7548da4a04
BLAKE2b-256 93dd54b05a460f58b05cc340738cd0d12b5456621f86f4f776db1926861f1ee9

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_jatin_102203713-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea3dc9fc8c4507106b0e89b0f48855667386ec2d2d7a19ee6425da5c805ff098
MD5 f7e4c0ccf6cc9dbb9da9ccfbcd4797fd
BLAKE2b-256 69ff73addca8882104bc2ac6410ed3cadcff4533e992a7966188f62315343f77

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