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.2.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.2-py3-none-any.whl (4.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsis_pranav_102203059-1.2.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.2.tar.gz
Algorithm Hash digest
SHA256 d1f06293a99f1bc360b2d3ed630e5484a4072a443d5b919ee9c32e8a1fb2eb2f
MD5 08a88a13a43ef91f9bc4daa6fe5ca4aa
BLAKE2b-256 0943db4253b1bae01430c29f5f4790246a8e2d3ff52f7b208a299944894f5ea2

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_Pranav_102203059-1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d2b2b6f8f429a89038d275a4125795f8772ea49a5f77f8fe9effdac6b4900fa7
MD5 ea6cd693272699c996ac0321a16ec9cb
BLAKE2b-256 becbb85fa2276ea50f49b449586b24a44f72f1b85d6e21952605390708d49b0d

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