Skip to main content

Implementation of the TOPSIS Algorithm

Project description

TOPSIS-Harshit-102303276

A Python package to implement the Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS). This command-line tool takes a dataset of alternatives and criteria, applies weights and impacts, and calculates a ranking score for each alternative.

Installation

You can install this package via pip:

pip install topsis-harshit-102303276

Usage

The package can be used through the command line. It requires an input CSV or Excel file containing your data, a string of weights, a string of impacts, and the name of the output file.

Command Syntax

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

Arguments

  1. InputDataFile: Path to the .csv or .xlsx file.

    • The file must contain 3 or more columns.
    • First column: Object/Model Name (e.g., M1, M2, M3). This column is not used in calculations but is preserved in the output.
    • Remaining columns: Numeric values representing the criteria for each object.
  2. Weights: Comma-separated numbers indicating the importance of each criterion (e.g., "1,1,1,1").

  3. Impacts: Comma-separated signs (+ or -) indicating the desired direction of the criterion.

    • +: Higher value is better (Profit).
    • -: Lower value is better (Cost).
  4. ResultFileName: Name of the output CSV file where results will be saved.

Example

Let's assume we want to rank 5 different mobile phone models based on 4 criteria: Price, Storage, Camera, and Looks.

1. Input Data (data.csv)

Model Price Storage Camera Looks
M1 250 16 12 5
M2 200 16 8 3
M3 300 32 16 4
M4 275 32 8 4
M5 225 16 16 2
  • Criteria Analysis:
  • Price: Lower is better (- impact).
  • Storage: Higher is better (+ impact).
  • Camera: Higher is better (+ impact).
  • Looks: Higher is better (+ impact).

2. Execution

Run the following command in your terminal:

topsis data.csv "1,1,1,1" "-,+,+,+" result.csv
  • Weights: 1,1,1,1 (All criteria are equally important).
  • Impacts: -,+,+,+ (Price is negative impact, others are positive).

3. Output Data (result.csv)

The tool generates a new file result.csv containing the original data with two additional columns: Topsis Score and Rank.

Model Price Storage Camera Looks Topsis Score Rank
M1 250 16 12 5 0.534277 3
M2 200 16 8 3 0.308368 5
M3 300 32 16 4 0.691632 1
M4 275 32 8 4 0.534737 2
M5 225 16 16 2 0.492650 4

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_harshit_102303276-0.1.0.tar.gz (2.8 kB view details)

Uploaded Source

Built Distribution

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

topsis_harshit_102303276-0.1.0-py3-none-any.whl (4.0 kB view details)

Uploaded Python 3

File details

Details for the file topsis_harshit_102303276-0.1.0.tar.gz.

File metadata

  • Download URL: topsis_harshit_102303276-0.1.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for topsis_harshit_102303276-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bc90a4e3855bd7efc6e89566d4ebb78497d54f4316b54d3e553d5c8819044887
MD5 e24e69cf8e816390cdfaaa66235827ad
BLAKE2b-256 4d3262172daf21efc02eb9606526b56e716f761fa7bdeafacaec251c8a791287

See more details on using hashes here.

File details

Details for the file topsis_harshit_102303276-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: topsis_harshit_102303276-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for topsis_harshit_102303276-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b13c69670edbd99d49e41821a389556193ecb5416618dfda44d6b38924a0bbbb
MD5 bca2d2d983c58a1f850b0c1cf474e142
BLAKE2b-256 ba051525667b39bb860c03868a7e43304bd396f668913550ea835530379344bc

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