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-jatin_102203713 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.1.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.1-py3-none-any.whl (4.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsis_jatin_102203713-0.2.1.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.1.tar.gz
Algorithm Hash digest
SHA256 9a263523e7d06171d1331b774f701541bb028ba5f1514e6df1f436392da8c96f
MD5 43530b5a987f865b3984c35317673e7d
BLAKE2b-256 9a61ca919605d8c719ac229ec3e3bdef1d9f3adb05dc0970113121d04fc67c93

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_jatin_102203713-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8439e32fa57b67ef9176dcc1a5034f312a3cb6f864749e5b575cd767268c0d49
MD5 55a9a44e806d2eb3c7d4afe7836a77f1
BLAKE2b-256 dc3e7725a1e7cdd9871bf112d0db24e0bb8bed6613eadce82c6714ab826de306

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