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 102303372-input.csv "1,1,1,2,3" "+,+,-,+,+" 102303372-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 (example: 1,2,1,1)

  • <Impacts> Comma-separated impacts for each criterion Use + for benefit criteria and - for cost criteria (example: +,+,-,+)

  • <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.

Example: 102303372-input.csv

Model,Storage,Camera,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 for 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.2.tar.gz (3.7 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.2-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_atharva_102303372-1.0.2.tar.gz
Algorithm Hash digest
SHA256 12c27e05725f0e51834ab8d8fe61399ab50203753105a7940a3169a1659da451
MD5 2a0b65bd42ab8e05d53686b867fa7e5f
BLAKE2b-256 789e4cd325858e743028cdf3a065385ad89b48353ec1068dde898f09588335ef

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_atharva_102303372-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 9a47b0efb6c55713b2602e896ce5ffa7f568a2424a20880fb1d30c66a1486b47
MD5 6db56a5ec9a3d7500054200ff92d4664
BLAKE2b-256 a5d42b795918977e1a786c7730871b0783818aa74bb4dbd13cc42a18c9afd145

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