Skip to main content

A Python package for TOPSIS

Project description

Topsis-Devansh-102218067

Topsis-Devansh-102218067 is a Python package for performing TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution), a multi-criteria decision-making method. This package is designed to help rank alternatives based on their distance from an ideal solution.

Table of Contents

Installation

Prerequisites

  • Python
  • pip (Python package installer)

Installation Commands

To install the package locally:

pip install topsis-Devansh-102218067

Once installed, the topsis command will be available for use in your command line.

Usage

Command-Line Interface (CLI)

You can run the TOPSIS analysis using the topsis command. The syntax is as follows:

Topsis <weights> <impacts> <InputFileName> <OutputFileName>
  • inputFileName: Path to the input CSV file containing the data.
  • weights: Comma-separated weights for each criterion (e.g., "0.3,0.2,0.5").
  • impacts: Comma-separated impacts for each criterion, where '+' denotes a beneficial criterion and '-' denotes a non-beneficial criterion (e.g., "+,+,-").
  • resultFileName: Path to the output CSV file where the results will be saved.

Example

Suppose you have a CSV file named data.csv with the following structure:

Ind,C1,C2,C3,C4
A1,250,16,12,5
A2,200,25,8,3
A3,300,20,10,4
A4,275,22,9,4.5

You can run the TOPSIS analysis with:

topsis "0.3,0.2,0.4,0.1" "+,+,-,+," data.csv result.csv

This command will generate a result.csv file with the TOPSIS scores and ranks.

Input File Format

  • The input file MUST be in CSV format.
  • The first column should contain labels for the alternatives (e.g., "A1", "A2").
  • The remaining columns should contain numeric data for the criteria.

Example:

Ind,C1,C2,C3,C4
A1,250,16,12,5
A2,200,25,8,3
A3,300,20,10,4
A4,275,22,9,4.5

Output File Format

The output file will be a CSV file with the original data plus two additional columns:

  • Topsis Score: The calculated TOPSIS score for each alternative.
  • Rank: The rank of each alternative based on the TOPSIS score.

Example:

Ind,C1,C2,C3,C4,Topsis Score,Rank
A1,250,16,12,5,0.68,2
A2,200,25,8,3,0.55,4
A3,300,20,10,4,0.78,1
A4,275,22,9,4.5,0.65,3

Error Handling

The program includes robust error handling for common issues:

  • File Not Found: An error message will be displayed if the input file is missing.
  • Non-Numeric Data: The program will check for non-numeric data in criteria columns.
  • Unequal Weights and Impacts: The number of weights and impacts must match the number of criteria.
  • Incorrect Impacts: Impacts must be either '+' 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-Devansh-102218067-0.4.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

topsis_Devansh_102218067-0.4-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file topsis-Devansh-102218067-0.4.tar.gz.

File metadata

  • Download URL: topsis-Devansh-102218067-0.4.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for topsis-Devansh-102218067-0.4.tar.gz
Algorithm Hash digest
SHA256 5e8f19b7b756bafbdf32c4f1ca0859a92442ad2f83c22206556c7651e9354215
MD5 346e523189496ff41c53d13e129610e0
BLAKE2b-256 fe1e2479d1db1d3a705a72499879272b0cbbdded8f491463e0e1969885321dbb

See more details on using hashes here.

File details

Details for the file topsis_Devansh_102218067-0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_Devansh_102218067-0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 0819ce5f75dfc1b5efde1a6a5a5d058efb486bfa3722d76c8522e0ba4dfaf7d5
MD5 2e278a3877fec2d346e0bb5bfcc38c01
BLAKE2b-256 8d2f230106fada8fc181ef73a518d19b1fa07441a29d6602bdc702f35f8943be

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