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.1.tar.gz (4.9 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.1-py3-none-any.whl (6.1 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for topsis_siddharth_102303592-1.0.1.tar.gz
Algorithm Hash digest
SHA256 813f2a3892c8a59005bf804819443aa4495b16ee16b1f0fe4455a7df1875748d
MD5 750b99246b8c7a7f2d0ea7a14d7bec45
BLAKE2b-256 5b4d60ae4481900daa447c9b5b1195fb1d33a65b9227858b008a706f780f9693

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_siddharth_102303592-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3973d79cc772da2bf51fcfb0c030ee54a83c5077d6076a95b47b582f12309290
MD5 e2072dbf0b74af937e315ef89869c39a
BLAKE2b-256 527f0f349ee33855ea8c1e269a60da9d0c63d6802161e3403e88e08748017926

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