Skip to main content

This is a package for TOPSIS score calculation

Project description

PROJECT DESCRIPTION

TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution) is a method used to evaluate and rank alternatives by comparing them to an ideal solution. It calculates how close each option is to the best possible outcome and how far it is from the worst. By considering multiple criteria and their importance, TOPSIS helps make clear and logical decisions, often used in areas like project selection, resource allocation, and performance evaluation. Its simplicity and effectiveness make it a popular choice for solving complex problems.

How does it work?

Suppose you are deciding between various smartphone models by comparing features such as price, storage, camera quality, and design. Rather than guessing, TOPSIS processes the data by normalizing it, weighting each criterion based on its importance (e.g., prioritizing camera quality over design), and determining the distance of each model from the optimal solution. The model nearest to the "perfect scenario" receives the highest rank.

Prerequisites

To get started, ensure you have the following:

  • Python: Version 3.7 or higher (preferably).
  • Pandas: For data handling and manipulation.
  • NumPy: For numerical calculations.

To install the dependencies, just run:

pip install pandas
pip install numpy

How to run the script?

Command-Line Execution

Here is the command you will use to run the script:

topsis <inputFileName> <Weights> <Impacts> <resultFileName>

Where: inputFileName: is your CSV file that holds the data. It should have one column for alternatives and the rest for decision-making criteria (e.g., price, storage, camera). Weights: is a comma-separated string that specifies the importance (weight) of each criterion. Impacts: is another comma-separated string, indicating whether a criterion is beneficial (+) or non-beneficial (-). resultFileName: is where you want to save the output, containing the scores and ranks.

Example

Let us say we have a CSV file named input_data.csv and we want to weigh the features as 20%, 30%, 30%, and 20%, respectively, with the first three being beneficial and the last one (Looks) being non-beneficial.

Run:

topsis input_data.csv "0.2,0.3,0.3,0.2" "+,+,+,-" result.csv

This command will process the data, calculate the scores, and save the results in a file called result.csv.

Input File Structure

The CSV file should look like this:

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

Here, each row represents a different alternative (e.g., smartphone model) and each column represents a decision-making criterion.

Output Format

After running the decision-making script, the output includes the calculated Score and Rank for each model:

Model Price Storage Camera Looks Score Rank
M1 250 16 12 5 0.4459 4
M2 200 16 8 3 0.3700 5
M3 300 32 16 4 0.6299 1
M4 275 32 8 4 0.4936 2
M5 225 16 16 2 0.4758 3

Explanation

  • Score: The score is calculated based on a weighted evaluation of the decision-making criteria.
  • Rank: Models are ranked based on their scores, with 1 being the highest rank.

License

This project is licensed under the MIT License. Feel free to use, modify, or contribute!

Project details


Release history Release notifications | RSS feed

This version

1.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

topsis_102217115-1.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

topsis_102217115-1.1-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file topsis_102217115-1.1.tar.gz.

File metadata

  • Download URL: topsis_102217115-1.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for topsis_102217115-1.1.tar.gz
Algorithm Hash digest
SHA256 ecc18bbcb9475010f9104b091d310510f5f979f94a9297413fbc7c30c718d9d2
MD5 a4d7f56721b15774d9227cac42a0e33e
BLAKE2b-256 835ad9efb705155d3e3f1e157b37b05768b947e1911214754e219e2b34c27e76

See more details on using hashes here.

File details

Details for the file topsis_102217115-1.1-py3-none-any.whl.

File metadata

  • Download URL: topsis_102217115-1.1-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.12.0

File hashes

Hashes for topsis_102217115-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b079fcc41a18c58d80ce457aee26641d2f14ffa1f85f61ee77563c8444e487b2
MD5 acffc5409671a7a6b55d8e617ad9ac15
BLAKE2b-256 cdeb4bdcf016760590983132e898b5023992c3ce3007819d1298e22ea8bdda3e

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