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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file topsis_siddharth_102303592-1.0.1.tar.gz.
File metadata
- Download URL: topsis_siddharth_102303592-1.0.1.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
813f2a3892c8a59005bf804819443aa4495b16ee16b1f0fe4455a7df1875748d
|
|
| MD5 |
750b99246b8c7a7f2d0ea7a14d7bec45
|
|
| BLAKE2b-256 |
5b4d60ae4481900daa447c9b5b1195fb1d33a65b9227858b008a706f780f9693
|
File details
Details for the file topsis_siddharth_102303592-1.0.1-py3-none-any.whl.
File metadata
- Download URL: topsis_siddharth_102303592-1.0.1-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3973d79cc772da2bf51fcfb0c030ee54a83c5077d6076a95b47b582f12309290
|
|
| MD5 |
e2072dbf0b74af937e315ef89869c39a
|
|
| BLAKE2b-256 |
527f0f349ee33855ea8c1e269a60da9d0c63d6802161e3403e88e08748017926
|