Skip to main content

Implementation of TOPSIS - Technique for Order of Preference by Similarity to Ideal Solution

Project description

Topsis-Shweta-2004

TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a multi-criteria decision-making method. This package implements TOPSIS in Python — it takes a decision matrix CSV, weights, and impacts, then returns a ranked result.

Installation

pip install Topsis-Shweta-2004

Usage

In Python:

from Topsis_Shweta_2004.topsis import topsis

topsis("data.csv", "1,1,1,2,1", "+,+,-,+,-", "result.csv")

Via Command Line:

python -m Topsis_Shweta_2004.topsis input.csv "1,1,1,2" "+,+,-,+" output.csv

Parameters:

Parameter Description
input Path to input CSV file
weights Comma-separated weights e.g. "1,1,2,1"
impacts Comma-separated impacts e.g. "+,+,-,+"
result Output CSV filename

Input Format

First column = object/alternative name. Remaining columns = numeric criteria.

Fund Name P1 P2 P3 P4 P5
M1 0.62 0.38 6.7 58.7 16.60
M2 0.93 0.86 5.5 47.9 13.80
M3 0.62 0.38 3.2 65.9 17.53

Output Format

Same as input with two additional columns: Topsis Score and Rank.

Fund Name P1 P2 P3 P4 P5 Topsis Score Rank
M1 0.62 0.38 6.7 58.7 16.60 0.3876 8.0
M2 0.93 0.86 5.5 47.9 13.80 0.5213 4.0

How TOPSIS Works

  1. Normalize the decision matrix
  2. Apply weights to each criterion
  3. Find Ideal Best & Worst solutions
  4. Calculate distance from ideal best and worst
  5. Rank alternatives by closeness to ideal solution

Error Handling

  • File not found → clear error message
  • Mismatched weights/impacts/columns → ValueError
  • Non-numeric values in criteria columns → ValueError

Requirements

  • Python 3
  • pandas
  • numpy

License

(c) 2024 Shweta — MIT License

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_shweta_2004-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

topsis_shweta_2004-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file topsis_shweta_2004-1.0.0.tar.gz.

File metadata

  • Download URL: topsis_shweta_2004-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0rc2

File hashes

Hashes for topsis_shweta_2004-1.0.0.tar.gz
Algorithm Hash digest
SHA256 74514dd93cd535a19035dd0a9e6dc1c50a8ca3af9a989d7c943e3b0c56003e8e
MD5 ea2cd0f4e9ebb6fb8c59295d7cc87d62
BLAKE2b-256 97340d00285b9ea382c1d2191c9aab4c71af6cfa03787f44025c7072d48f682f

See more details on using hashes here.

File details

Details for the file topsis_shweta_2004-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_shweta_2004-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1085f09f7a909cbfb8f7ba137933b486858b4c8195508aedda01419f5ea8ae94
MD5 94f54bde168eef5081b25bc1fca49b6f
BLAKE2b-256 5d5cf73a088381cca535b0167a615922f64941569733686f9c2657acb8bb6b01

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