Skip to main content

A Python package to perform TOPSIS (Technique for Order Preference by Similarity to Ideal Solution)

Project description

TOPSIS Method Implementation - Vaibhav Garg (102203381)

This Python package implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS) method for multi-criteria decision analysis.

Installation

You can install the package using pip:

pip install topsis_vaibhav_102203381

Usage

Input File Format

The input CSV file should have the following structure:

  • The first column should contain the names of the models.
  • The subsequent columns should contain the criteria values for each alternative.
  • The first row should contain the headers for each column.

Example:

Model Criteria 1 Criteria 2 Criteria 3 Criteria 4 Criteria 5 Criteria 6
m1 250 16 12 30 80 7
m2 200 14 8 35 70 5
m3 300 18 15 25 90 6

Weights:

Comma-separated values that indicate the weight of each criterion.

Example:

0.2, 0.1, 0.15, 0.1, 0.25, 0.2

Impacts:

Comma-separated string of + or - that indicate the direction of optimization for each criterion.

Example:

+, -, +, -, +, +

Where:

  • + indicates the criterion is to be maximized.
  • - indicates the criterion is to be minimized.

Command-line Usage

After installation, you can use the topsis command in the terminal to process the data:

topsis <input_file> <weights> <impacts> <output_file>
  • <input_file>: Path to the input CSV file.
  • <weights>: Comma-separated string of weights for the criteria.
  • <impacts>: Comma-separated string of '+' or '-' indicating the desirability of the criteria.
  • <output_file>: Path to the output CSV file to save the results.

Example:

topsis data.csv "0.2,0.1,0.15,0.1,0.25,0.2" "+,-,+,-,+,+" result.csv

This command will process the data.csv file using the specified weights and impacts and output the results to result.csv.

Example Explanation

Input Data (CSV):

Model Criteria 1 Criteria 2 Criteria 3 Criteria 4 Criteria 5 Criteria 6
m1 250 16 12 30 80 7
m2 200 14 8 35 70 5
m3 300 18 15 25 90 6

Weights:

0.2, 0.1, 0.15, 0.1, 0.25, 0.2

Impacts:

+, -, +, -, +, +

  • Criteria 1 and Criteria 3 are to be maximized (+).
  • Criteria 2 and Criteria 4 are to be minimized (-).
  • Criteria 5 and Criteria 6 are to be maximized (+).

Command to Execute:

topsis data.csv "0.2,0.1,0.15,0.1,0.25,0.2" "+,-,+,-,+,+" result.csv

Output Example:

Model Score Rank
m1 0.78 2
m2 0.65 3
m3 0.89 1

Notes

  • Ensure that the input file has at least three columns: one for alternatives and at least two for criteria.
  • All criteria columns should contain numeric values.
  • The number of weights and impacts must match the number of criteria.
  • Impacts should only be + or -.

License

This project is licensed under the MIT License. See the LICENSE file for details.

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_vaibhav_102203381-1.0.3.tar.gz (3.8 kB view details)

Uploaded Source

File details

Details for the file topsis_vaibhav_102203381-1.0.3.tar.gz.

File metadata

File hashes

Hashes for topsis_vaibhav_102203381-1.0.3.tar.gz
Algorithm Hash digest
SHA256 d09957b346d69de6b948b3edaa3185152f191deb6141f95e2115227f297cdbd3
MD5 8abc799c5087fcd5ab6fd9e40319d439
BLAKE2b-256 c41e56a06e70b409ef76fe2cbbd9981947c14aa57bf15b3f1b054c9702e315e3

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