Skip to main content

A Python package for TOPSIS

Project description

📊 TOPSIS-Devansh-102317041

A Python library for Multiple Criteria Decision Making (MCDM) using TOPSIS

PyPI version Python Version License: MIT


🎯 Overview

TOPSIS-Devansh-102317041 is a Python package that implements the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS) method for solving Multiple Criteria Decision Making (MCDM) problems.

This package simplifies the process of ranking alternatives based on multiple criteria


🧠 What is TOPSIS?

TOPSIS is a multi-criteria decision analysis method that:

  1. Identifies the ideal best and ideal worst alternatives
  2. Calculates the Euclidean distance from each alternative to both ideal solutions
  3. Ranks alternatives based on their relative closeness to the ideal solution

The alternative closest to the ideal best and farthest from the ideal worst is ranked highest.


📦 Installation

Install the package using pip:

pip install Topsis-Devansh-102317041

🚀 Usage

Basic Syntax

topsis <input_file.csv> <weights> <impacts> <output_file.csv>

Parameters

Parameter Description Format
input_file.csv Input CSV file with decision matrix .csv file
weights Comma-separated weights for each criterion "w1,w2,w3,..."
impacts Comma-separated impacts (+/-) for each criterion "+,-,+,..."
output_file.csv Output CSV file with rankings .csv file

Command Examples

With quotes (recommended):

topsis data.csv "1,1,1,1" "+,+,-,+" output.csv

⚠️ Note: Use quotes if your input contains spaces to avoid errors.

Help Command

topsis --help

💡 Example

Input File: sample.csv

A dataset comparing mobile phones based on different features:

Model Storage (GB) Camera (MP) Price ($) Looks (out of 5)
M1 16 12 250 5
M2 16 8 200 3
M3 32 16 300 4
M4 32 8 275 4
M5 16 16 225 2

Parameters

  • Weights: [0.25, 0.25, 0.25, 0.25] (Equal importance)
  • Impacts: [+, +, -, +]
    • + for Storage, Camera, and Looks (higher is better)
    • - for Price (lower is better)

Command

topsis sample.csv "0.25,0.25,0.25,0.25" "+,+,-,+" output.csv

Output: output.csv

Model Storage (GB) Camera (MP) Price ($) Looks (out of 5) TOPSIS Score Rank
M1 16 12 250 5 0.5343 3
M2 16 8 200 3 0.3084 5
M3 32 16 300 4 0.6916 1
M4 32 8 275 4 0.5347 2
M5 16 16 225 2 0.4010 4

Result: Model M3 ranks first with the highest TOPSIS score of 0.6916.


📄 Input File Format

Requirements

✅ CSV file format
✅ First row contains column headers
✅ First column contains alternative names/IDs
✅ All criteria values must be numeric
✅ No missing values
✅ At least 3 alternatives and 2 criteria

Sample Structure

Model,Criterion1,Criterion2,Criterion3
Alt1,value1,value2,value3
Alt2,value1,value2,value3
Alt3,value1,value2,value3

⚠️ Important Notes

  1. Headers and Index: The first column and first row are treated as labels and removed before processing
  2. Numeric Values Only: Ensure all criteria values are numeric (no categorical data)
  3. Weights Format: Weights should be positive numbers (will be normalized automatically)
  4. Impacts Format: Use only + (beneficial) or - (non-beneficial)
  5. Dimension Matching: Number of weights and impacts must match the number of criteria
  6. Minimum Data: At least 3 alternatives and 2 criteria required

📜 License

This project is licensed under the MIT License.


👨‍💻 Author

Devansh Chhabra
📧 Email: devanshchhabr@gmail.com


Project details


Release history Release notifications | RSS feed

This version

2.0

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_102317041-2.0.tar.gz (5.3 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_102317041-2.0-py3-none-any.whl (5.9 kB view details)

Uploaded Python 3

File details

Details for the file topsis_devansh_102317041-2.0.tar.gz.

File metadata

  • Download URL: topsis_devansh_102317041-2.0.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for topsis_devansh_102317041-2.0.tar.gz
Algorithm Hash digest
SHA256 b2bc4c45cc678e3fa16c00ef0361b19bba56a7cb6f97d899df104da4e065b214
MD5 50f466e2af67c0d83f635dc66d60dd43
BLAKE2b-256 e2fc61ba2b69801915b5044df197fd24635418171618ffe2bffad1e834a0db0d

See more details on using hashes here.

File details

Details for the file topsis_devansh_102317041-2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_devansh_102317041-2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 693e2df4000957ff11509c748956f69fbb26777fcb0c2ac48c85c05dd19b5a86
MD5 874049dda0fd213e94b0f3f71eb90f05
BLAKE2b-256 5a7e0b8ba167fbfdcd10c9d4b1b45df565dc28ee970698fa237721c12bd7d491

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