Skip to main content

A Python implementation of the TOPSIS decision-making method.

Project description

TOPSIS Package

A Python package for ranking alternatives using the TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) method.

Installation

Install the package via pip:

pip install TopsisPackage_102216017

Usage

Command-Line Interface (CLI)

Run the TOPSIS method from the command line:

topsis <input_file.csv> [weights] [impacts]

Parameters:

  • <input_file.csv>: Path to the CSV file containing the data.
  • [weights]: List of weights for criteria, e.g., [0.4,0.3,0.3].
  • [impacts]: List of impacts, where + is for beneficial criteria and - is for non-beneficial criteria.

Example:

topsis data.csv [0.5,0.3,0.2] [+, -, +]

Using in Python Code

You can use the package programmatically in Python:

from TopsisPackage_102216017 import Topsis

# Input data: rows = alternatives, columns = criteria
data = [
    [250, 16, 12],
    [200, 16, 8],
    [300, 32, 16]
]
weights = [0.4, 0.3, 0.3]  # Criteria weights
impacts = ['+', '-', '+']   # '+' = beneficial, '-' = non-beneficial

# Create a Topsis object and calculate scores and ranks
topsis = Topsis(data, weights, impacts)
scores, ranks = topsis.rank()

print("Scores:", scores)  # Performance scores
print("Ranks:", ranks)    # Rankings

Input File Format

The input CSV file should have the following structure:

Alternative Criterion1 Criterion2 Criterion3
A1 250 16 12
A2 200 16 8
A3 300 32 16

Notes:

  • First column: Names of alternatives (e.g., A1, A2).
  • Remaining columns: Numerical values for each criterion.

License

This project is licensed under the 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

topsispackage_102216017-1.0.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsispackage_102216017-1.0.0.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.5

File hashes

Hashes for topsispackage_102216017-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3bed1ce01ebf401aa5a64a6a0d63c33577609fc1782749a3f7f1cb082c24d5f1
MD5 0ec3fb12eade183c72959a51cbea4995
BLAKE2b-256 3767b5bdf7f3fe0042f8ca356a4c5c10bb6f511340883a75e77998eba85410e8

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for TopsisPackage_102216017-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c4ea5db4ed536a4ad4f7c91fe92560cf785a586749640038ec90977c6a7c6d53
MD5 5ed9e01f95ee4b66c762051dcccbeb33
BLAKE2b-256 7842c5f3087388d9fa8d5205dca17d3abddb25384fc4e0b1b3826277af49e117

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