Skip to main content

A Python package to implement the TOPSIS method

Project description

TOPSIS Implementation Package

This package implements the Technique for Order Preference by Similarity to Ideal Solution (TOPSIS), a multi-criteria decision-making method widely used in ranking and evaluation problems.


What is TOPSIS?

TOPSIS is a decision-making method that ranks alternatives based on their closeness to the ideal solution and distance from the worst solution. It is commonly used in scenarios involving multiple criteria and alternatives.


Installation

To install the package from PyPI, run the following command:

pip install topsis-Pranav-102203059

Usage

After installation, you can use the package via the command line.

Command Line Syntax:

topsis <InputDataFile> <Weights> <Impacts> <ResultFileName>

Parameters:

  • <InputDataFile>: Path to the input file (e.g., data.csv or data.xlsx) containing the dataset.

    • The file must have:
      • At least 3 columns.
      • First column for the names/identifiers (e.g., alternatives like M1, M2, etc.).
      • Remaining columns with numeric values for criteria.
  • <Weights>: Comma-separated weights for the criteria (e.g., "1,1,1,2").

  • <Impacts>: Comma-separated impacts for the criteria. Use + for positive impact and - for negative impact (e.g., "+,+,-,+").

  • <ResultFileName>: Path for the output file to save the result (e.g., result.csv).


Example Usage:

  1. Input File: 102203059-data.xlsx

    Fund Name, P1, P2, P3, P4, P5
    M1, 0.84, 0.71, 6.7, 42.1, 12.59
    M2, 0.91, 0.83, 7.0, 31.7, 10.11
    M3, 0.79, 0.62, 4.8, 46.7, 13.23
    
  2. Command:

    topsis 102203059-data.xlsx "1,1,1,1,2" "+,+,-,+,+" 102203059-result.csv
    
  3. Output File: 102203059-result.csv

    Fund Name, P1, P2, P3, P4, P5, Topsis Score, Rank
    M1, 0.84, 0.71, 6.7, 42.1, 12.59, 0.7523, 1
    M2, 0.91, 0.83, 7.0, 31.7, 10.11, 0.6321, 2
    M3, 0.79, 0.62, 4.8, 46.7, 13.23, 0.5809, 3
    

How It Works

  1. Normalization:

    • The criteria values are normalized using vector normalization
  2. Weight Application:

    • Each normalized value is multiplied by its respective weight
  3. Determine Ideal Best and Worst:

    • Ideal Best (A⁺):
      • Maximum value for positive impact (+).
      • Minimum value for negative impact (-).
    • Ideal Worst (A⁻):
      • Minimum value for positive impact (+).
      • Maximum value for negative impact (-).
  4. Calculate Distances:

    • Euclidean distance from the ideal best and worst
  5. Calculate TOPSIS Score:

    • Calculate closeness to the ideal solution
  6. Rank Alternatives:

    • Rank alternatives based on the TOPSIS score in descending order.

Dependencies

Ensure the following Python libraries are installed:

  • pandas
  • numpy

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_pranav_102203059-1.0.tar.gz (3.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_Pranav_102203059-1.0-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

Details for the file topsis_pranav_102203059-1.0.tar.gz.

File metadata

  • Download URL: topsis_pranav_102203059-1.0.tar.gz
  • Upload date:
  • Size: 3.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for topsis_pranav_102203059-1.0.tar.gz
Algorithm Hash digest
SHA256 62530ceab8cbca7adbcb58ce0ed5754f5b10e71ae7b336212a8804689dd29daa
MD5 2e4f1b6035270d17594dc37e612b1a80
BLAKE2b-256 c4477c0d43bc6f92d091d6c1b9eb7f5e160bf2fba1793a79a267e459aa0499e2

See more details on using hashes here.

File details

Details for the file topsis_Pranav_102203059-1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_Pranav_102203059-1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2a145b6a8083ad9bf3d99863d3bf5540bfd57a9295e23a8058a8c7beeed1b45a
MD5 4ef0f79bd393566d6958ced65b1f1d87
BLAKE2b-256 2c4366d7c4197a7e6ca28c6d349ca63410a1bbee56d7e5833be93b9ff3076b0c

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