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 Nimish Agrawal
Roll No 102483077
Group 3C34

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-Nimish-102483077
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: Nimish Agrawal 📧 nimish4agrawal@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_nimish_102483077-1.0.2.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

topsis_nimish_102483077-1.0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file topsis_nimish_102483077-1.0.2.tar.gz.

File metadata

  • Download URL: topsis_nimish_102483077-1.0.2.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for topsis_nimish_102483077-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a451a3ca7eadf1e6fde0d1c8207ddf86b1ae5b87ce022e4e8088742f3e93e90e
MD5 98bd9ba8f1550d3e4fc74016a0be8614
BLAKE2b-256 ab70235ed15d7a87b6d0e11cad419485aa7d1d6fde7d4094f8f8cc369f3cc617

See more details on using hashes here.

File details

Details for the file topsis_nimish_102483077-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_nimish_102483077-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e69c4ce102a479ca7fc4a7c2e903a11372feb352da20500224abc3693199ce5a
MD5 7112e3c5f01c48c8e1c070d632e07e63
BLAKE2b-256 ad0b4b513b044fb90406b1fa25074d82fff3fb233a3adf97cf16edce74fa952b

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