Skip to main content

A command-line implementation of TOPSIS (MCDM) in Python

Project description

Topsis-Siddharth-102303592

A Python command-line implementation of TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) for Multi-Criteria Decision Making (MCDM).

This project is built as:

Feature Description
Academic correctness Follows standard TOPSIS methodology
CLI Tool Fully executable from command line
Validation Strict input and argument validation
Distribution PyPI-ready Python package
Documentation Clear explanations with diagrams

📌 What is TOPSIS?

TOPSIS (Technique for Order Preference by Similarity to Ideal Solution) is a popular Multi-Criteria Decision Making (MCDM) technique.

🔑 Core Principle

The best alternative is the one that:

  • Is closest to the ideal best solution
  • Is farthest from the ideal worst solution

📊 Common Applications

Domain Usage
Engineering Component / design selection
Business Supplier & product evaluation
Finance Investment ranking
Analytics Model comparison

🧠 TOPSIS Algorithm Flow

flowchart TD
    A[Decision Matrix] --> B[Normalize Matrix]
    B --> C[Apply Weights]
    C --> D[Determine Ideal Best]
    C --> E[Determine Ideal Worst]
    D --> F[Distance from Ideal Best]
    E --> G[Distance from Ideal Worst]
    F --> H[TOPSIS Score]
    G --> H
    H --> I[Ranking]

🧩 Program Workflow (Software Perspective)

flowchart LR
    A[CLI Arguments] --> B[Input Validation]
    B --> C[Load CSV File]
    C --> D[TOPSIS Core Algorithm]
    D --> E[Compute Score & Rank]
    E --> F[Output CSV File]

🏗️ Module Interaction Diagram

flowchart LR
    cli[cli.py] --> validation[validation.py]
    cli --> core[core.py]
    validation --> core
    core --> cli

📦 Installation

Install the package from PyPI:

pip install Topsis-Siddharth-102303592

▶️ Usage (Command Line)

General Syntax

topsis <input_file> <weights> <impacts> <output_file>

Example

topsis sample.csv "0.4,0.4,0.2" "+,+,-" result.csv

📥 Input File Format

Requirements

Rule Description
File type CSV
Columns Minimum 3
Column 1 Alternative / identifier
Columns 2+ Numeric criteria only

Example Input

Name,C1,C2,C3
A,250,16,12
B,200,16,8
C,300,32,16
D,275,32,8

📤 Output File Format

Output Characteristics

Property Description
Original data Preserved
New columns Topsis Score, Rank
Ranking 1 = Best

Example Output

Name,C1,C2,C3,Topsis Score,Rank
A,250,16,12,0.2754,4
B,200,16,8,0.3196,3
C,300,32,16,0.6803,2
D,275,32,8,0.8895,1

⚠️ Error Handling & Validation

The program validates the following:

Validation Type Description
CLI arguments Correct number of arguments
Input file File existence
CSV format Minimum columns
Data values Numeric criteria only
Weights Numeric & count match
Impacts Only + or -

All errors are reported with clear, user-friendly messages.


📁 Project Structure

Topsis-Siddharth-102303592/
│── topsis_siddharth/
│   ├── cli.py          # Command-line interface
│   ├── core.py         # Core TOPSIS algorithm
│   ├── validation.py  # Input validation
│
│── tests/
│── README.md
│── pyproject.toml
│── LICENSE

👤 Author

Name Role
Siddharth Jaswal Computer Science Student

📄 License

This project is licensed under the MIT License.

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_siddharth_102303592-1.0.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_siddharth_102303592-1.0.0-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file topsis_siddharth_102303592-1.0.0.tar.gz.

File metadata

File hashes

Hashes for topsis_siddharth_102303592-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3d95016be3ce3db1150983fae9529cc25336aeba491f0d4b8ce7d7eb97e0e074
MD5 be74de89ce0f3c81cd185c900b33cbcb
BLAKE2b-256 f41f16ce2011c5a1824a1dee27d49c8f9fa2c88864312d59b67d8f76f6b97d75

See more details on using hashes here.

File details

Details for the file topsis_siddharth_102303592-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_siddharth_102303592-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2d082859ed4911bac0057ad188cda9af0e623b32c1275f0d4e685202b0b686eb
MD5 d04a425494ef1edd5632639321843db2
BLAKE2b-256 f88622bc1f6c8741c3bff5f484c629336a329a551e8eb68be0aee57f8c3847f4

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