Skip to main content

TOPSIS implementation as a Python package

Project description

TOPSIS Implementation


Overview

This Python package provides a clear and practical implementation of the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method for Multi-Criteria Decision Making (MCDM).

Using this package, users can rank multiple alternatives based on several numerical criteria by assigning weights and impacts (benefit or cost) to each criterion. The package is designed as a command-line tool and works directly with CSV files.


Project Information

Field Details
Course Project-1
Author Kalpesh Paliwal
Roll No 102317087
Group 3Q14

Features

  • Easy-to-use command-line interface
  • Supports customizable weights and impacts
  • Handles benefit (+) and cost (-) criteria
  • Accepts CSV input and produces CSV output
  • Automatically computes TOPSIS score and rank

Installation

Use the Python package manager pip to install the package:

pip install Topsis-Kalpesh-102317087
topsis <input_file.csv> <weights> <impacts>

Arguments

Argument Description
<input_file.csv> Path to CSV file. First column must contain alternative names. Remaining columns must contain numerical criteria values.
<weights> Comma-separated weights for each criterion (example: 0.2,0.2,0.2,0.2,0.2).
<impacts> Comma-separated impacts for each criterion (+ for benefit, - for cost).

Example

The following dataset evaluates different investment funds based on five parameters.

Fund P1 P2 P3 P4 P5
M1 0.74 0.55 3.1 64.7 17.27
M2 0.66 0.44 4.3 60.0 16.35
M3 0.62 0.38 3.9 46.1 12.75
M4 0.83 0.69 4.9 33.0 9.86
M5 0.75 0.56 5.6 40.8 11.93
M6 0.87 0.76 6.6 38.8 11.76
M7 0.88 0.77 6.5 36.5 11.16
M8 0.78 0.61 6.7 35.9 11.00

Weights and Impacts

Weights

0.2,0.2,0.2,0.2,0.2

Impacts

+,+,+,-,-

Execution Command

topsis data.csv "0.2,0.2,0.2,0.2,0.2" "+,+,+,-,-"

Output

The output file (output.csv) contains the original data along with two additional columns.

Fund P1 P2 P3 P4 P5 Topsis Score Rank
M1 … … … … … 0.5123 6
M2 … … … … … 0.4786 8
M3 … … … … … 0.5639 5
M4 … … … … … 0.7214 1
M5 … … … … … 0.6042 4
M6 … … … … … 0.6897 2
M7 … … … … … 0.6588 3
M8 … … … … … 0.4951 7

Output Columns

Column Meaning
Topsis Score Calculated TOPSIS performance score
Rank Rank based on TOPSIS score (1 = best)

Input File Requirements

  • Input file must be a valid CSV
  • First column must contain alternative names
  • All remaining columns must contain numerical values
  • No categorical or missing values allowed

Error Handling

The package validates inputs and raises errors for:

  • Mismatch between the number of criteria and weights
  • Mismatch between the number of criteria and impacts
  • Invalid impact values (only + or - allowed)
  • Incorrect CSV structure

License

This project is licensed under the MIT License.
See the LICENSE file for details.

Contact

For questions or feedback, please contact: Kalpesh Paliwal 📧 klpshplwl455@gmail.com

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_kalpesh_102317087-1.0.6.tar.gz (4.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_kalpesh_102317087-1.0.6-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file topsis_kalpesh_102317087-1.0.6.tar.gz.

File metadata

File hashes

Hashes for topsis_kalpesh_102317087-1.0.6.tar.gz
Algorithm Hash digest
SHA256 568c2a924013e3c040c8604e7559c713230b39253e0992cc8f76523f59adb5c4
MD5 34291faaee01f9a981ed74f4e9211114
BLAKE2b-256 ec4cfec5fcfc21d5273470140b530844d83cb75ce9649927adc862281ff7416a

See more details on using hashes here.

File details

Details for the file topsis_kalpesh_102317087-1.0.6-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_kalpesh_102317087-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 271f3f6e0e5a22eee1d87b659a42e9c6ebad8265dc98173562bcc0d7c77bcde1
MD5 53860d51d00cb9ea9aa8037f569b8ec2
BLAKE2b-256 2cf3318c2be1da1e2abb9646435e1f46be33dfc30c6f83955c5468b453a64f63

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