Skip to main content

TOPSIS implementation using Python

Project description

TOPSIS Package

Overview

This package implements the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS), a widely used Multi-Criteria Decision Making (MCDM) method. It ranks alternatives based on their distance from an ideal best and an ideal worst solution.

The package is designed to work directly from the command line and processes data provided in CSV format.


Features

  • Accepts CSV input files with multiple decision criteria
  • Supports user-defined weights for each criterion
  • Supports benefit (+) and cost (-) impacts
  • Generates a ranked output file with TOPSIS scores
  • Handles invalid inputs with clear error messages

Installation

Install the package using pip:

pip install Topsis-Atharva-102303372

Usage

Run the package from the command line using:

python -m topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>

Example

python -m topsis input.csv "1,1,1,2,3" "+,+,-,+,+" output.csv

Parameters

  • <InputDataFile> Path to the CSV file containing the decision matrix. The first column must contain alternative names, and the remaining columns must contain numeric criteria values.

  • <Weights> Comma-separated weights corresponding to each criterion.

  • <Impacts> Comma-separated impacts for each criterion (+ for benefit, - for cost).

  • <ResultFileName> Name of the output CSV file where results will be saved.


Sample Input File

The input CSV file should contain alternatives in the first column, followed by numerical values for each criterion.

Model Storage (GB) Camera (MP) Price (₹) Looks
A1 64 48 32000 4
A2 128 64 45000 5
A3 64 32 28000 3
A4 256 108 60000 5
A5 128 48 40000 4

Output

The output CSV file contains the original data along with the following additional columns:

  • Topsis Score
  • Rank

The alternative with Rank 1 is considered the best choice.

Example Output

Model Storage Camera Price Looks Topsis Score Rank
A2 128 64 45000 5 0.812 1
A5 128 48 40000 4 0.684 2
A1 64 48 32000 4 0.552 3
A4 256 108 60000 5 0.421 4
A3 64 32 28000 3 0.305 5

Error Handling

The package checks for:

  • Missing or invalid input files
  • Non-numeric values in criteria columns
  • Mismatch between number of criteria, weights, and impacts
  • Invalid impact symbols (must be + or -)

Appropriate error messages are displayed in each case.


Author

Atharva Pandey


License

This project is intended for academic and educational use.

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

Uploaded Source

Built Distribution

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

topsis_atharva_102303372-1.0.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_atharva_102303372-1.0.3.tar.gz
Algorithm Hash digest
SHA256 4d1f0e3c1734b55205278253ca568f0716400c63c27b8797ab33ae8c67d95b89
MD5 3f83fd8431d1d692a03e7296c0160c05
BLAKE2b-256 327f5c166b6b8216e5eb6e7570687ffb87527c9e7ccdb950169b677cdde9e091

See more details on using hashes here.

File details

Details for the file topsis_atharva_102303372-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_atharva_102303372-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c70cf24d86bb5b3ce8bb48ea2442c9d6692e0f648fccc90939221debd4ca7ab6
MD5 bbe30c8474e1bd63c9408a3124641fac
BLAKE2b-256 9c34d31ad835a599b2b91d725b83916d194f8870534bd2dc855979594169c8a1

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