Skip to main content

TOPSIS Command-Line Tool

Project Description

The TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) command-line tool implements the TOPSIS method, which is used in multi-criteria decision-making (MCDM) problems. The method ranks alternatives based on their relative closeness to the ideal solution. This package allows users to perform TOPSIS analysis on a dataset provided in a CSV format, specifying weights and impacts for each criterion.

Features

  • Normalizes the data to compare different criteria on the same scale.
  • Applies weights to different criteria.
  • Identifies the ideal and worst solutions for each criterion based on impact direction (+ for benefit, - for cost).
  • Ranks the alternatives based on their closeness to the ideal solution.

Installation

  1. Clone the repository or download the script.

  2. Ensure you have the necessary Python dependencies installed:

    pip install numpy pandas
    

How to Use

Command-Line Usage

The tool can be run via the command line and accepts four arguments:

  1. input_file: Path to the input CSV file containing the data.
  2. weights: Comma-separated list of weights for each criterion.
  3. impacts: Comma-separated list of impacts (+ or -) for each criterion.
  4. output_file: Path to save the output CSV file with the rankings and performance scores.

Input Data Format

The input CSV file must have the following structure:

ID Criterion 1 Criterion 2 Criterion 3 ...
1 value value value ...
2 value value value ...
... ... ... ... ...
  • The first column (ID) should be an identifier for the alternatives.
  • The subsequent columns should represent the criteria for each alternative.
  • The number of criteria should be at least two.

Running the Script

Once the input CSV file is ready, you can run the script via the command line:

python topsis.py input_file.csv "0.4,0.3,0.3" "+,+,-" output_file.csv
  • input_file.csv: Path to the input CSV file containing the data.
  • "0.4,0.3,0.3": A comma-separated list of weights for each criterion.
  • "+,+,-": A comma-separated list of impacts for each criterion (+ indicates a benefit, - indicates a cost).
  • output_file.csv: Path to save the output CSV file with the rankings and performance scores.

Output

The output file (output_file.csv) will contain the following columns:

  • ID: The alternative identifier.
  • The original criteria columns.
  • Score: The performance score for each alternative.
  • Rank: The rank based on the performance score (1 being the best).

Example

For an input CSV file:

ID Criterion 1 Criterion 2 Criterion 3
1 7 8 6
2 9 7 8
3 6 5 7

And the following arguments:

python topsis.py input_file.csv "0.5,0.3,0.2" "+,-,+"

Release files for topsis-payal-102203203 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for topsis-payal-102203203 0.0.2
File Size Uploaded
topsis_payal_102203203-0.0.2.tar.gz 3.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for topsis-payal-102203203 0.0.2
File Interpreter ABI Platform
topsis_payal_102203203-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / topsis_payal_102203203-0.0.2.tar.gz

Download URL topsis_payal_102203203-0.0.2.tar.gz
Size 3.2 kB
Tags Source
SHA-256 checksum
How to use checksums
b5f6687a744b0c09af218e2350086e5d8a4f9d93e7a5b9d60acf1286b424e15f
BLAKE2b-256 checksum
How to use checksums
0cbdb050ed6bb23aefb16a47ec90e28f66eff2a390d2f02b568962dcf075397a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.4

Release files / topsis_payal_102203203-0.0.2-py3-none-any.whl

Download URL topsis_payal_102203203-0.0.2-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
95838a077b38383517ff1397bc68ec6ea16c5975235153b498ddf774579ad8ca
BLAKE2b-256 checksum
How to use checksums
27f80ba6fd3f0c709d6a9e99908b30e9ebd46fc4f221019c6769a1c5cd18c7f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page