Skip to main content

TOPSIS mcdm

Project description

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" "+,-,+"

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_payal_102203203-0.0.2.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

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

topsis_payal_102203203-0.0.2-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file topsis_payal_102203203-0.0.2.tar.gz.

File metadata

  • Download URL: topsis_payal_102203203-0.0.2.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.11.4

File hashes

Hashes for topsis_payal_102203203-0.0.2.tar.gz
Algorithm Hash digest
SHA256 b5f6687a744b0c09af218e2350086e5d8a4f9d93e7a5b9d60acf1286b424e15f
MD5 02e65516508ba787571c1961a84e7451
BLAKE2b-256 0cbdb050ed6bb23aefb16a47ec90e28f66eff2a390d2f02b568962dcf075397a

See more details on using hashes here.

File details

Details for the file topsis_payal_102203203-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_payal_102203203-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 95838a077b38383517ff1397bc68ec6ea16c5975235153b498ddf774579ad8ca
MD5 4469bc3a028c6571cb67a643e98c9bd6
BLAKE2b-256 27f80ba6fd3f0c709d6a9e99908b30e9ebd46fc4f221019c6769a1c5cd18c7f8

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