Skip to main content

Educational TOPSIS implementation in Python

Project description

TOPSIS-Daksh-102303322

for: UCS654 submitted by: Daksh Garg Roll no: 102303322 Group: 3C24

topsis-daksh is a Python library for dealing with Multiple Criteria Decision Making (MCDM) problems by using Technique for Order of Preference by Similarity to Ideal Solution (TOPSIS).

Installation

Use the package manager pip to install topsis-daksh.

pip install topsis-daksh

How TOPSIS Works

The TOPSIS method evaluates each alternative by calculating:

● The shortest distance from the ideal best solution

● The farthest distance from the ideal worst solution

Each alternative is then assigned:

● A TOPSIS score

● A rank, where rank 1 represents the best alternative

Usage

Run the package using the command line interface (CLI). The syntax requires four arguments: the input data file, the weights, the impacts and the output file

topsis <InputDataFile> <Weights> <Impacts> <OutputFile>

Example:

topsis sample.csv "1,1,1,1" "+,-,+,+" output.csv

Important Notes on Syntax:

● Weights: Comma-separated numbers (e.g., 1,1,1,1).

● Impacts: Comma-separated signs (+ for beneficial criteria, - for non-beneficial criteria).

● Quotes: It is recommended to enclose your weights and impacts in double quotes (" ") to prevent errors if your input contains spaces.

Getting Help:

To view the help message and quick usage guide, run:

topsis /h

Example

sample.csv

A csv file showing data for different car models having varying features.

Model Price (In lakhs) Fuel Efficiency (Km/Lit) Comfort Looks
Car1 4 15 Good Average
Car2 8 16 Good Good
Car3 10 17 Excellent Excellent
Car4 3.5 16 Average Average

Note: Categorical values have been converted to numerical scales (Good=4, Average=3, Excellent=5).

weights vector = [ 0.25 , 0.25 , 0.25 , 0.25 ]

impacts vector = [ - , + , + , + ]

Note: Price is a cost (-) factor, while Efficiency, Comfort, and Looks are benefit (+) factors.

input:

topsis sample.csv "0.25,0.25,0.25,0.25" "-,+,+,+" output.csv

output:

Model  Price  Fuel Efficiency  Comfort  Looks  Topsis Score  Rank
 Car1    4.0               15        4      3      0.602439     1
 Car2    8.0               16        4      4      0.384213     4
 Car3   10.0               17        5      5      0.436903     3
 Car4    3.5               16        3      3      0.566388     2

Other Notes

● Input File Format: The input CSV must contain a header row. The first column is treated as the object/alternative name (e.g., Model Name, M1, M2) and will be preserved in the output but excluded from the mathematical calculations.

● Numeric Data Only: Ensure that all columns from the 2nd column onwards contain strictly numeric values. Categorical values (e.g., "Good", "Medium") must be converted to numerical scales before running the script.

● Consistency: The number of values in your weights and impacts parameters must match the number of criteria columns (total columns minus one).

Licence

MIT

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_daksh_102303322-1.0.1.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.

topsis_daksh_102303322-1.0.1-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file topsis_daksh_102303322-1.0.1.tar.gz.

File metadata

  • Download URL: topsis_daksh_102303322-1.0.1.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for topsis_daksh_102303322-1.0.1.tar.gz
Algorithm Hash digest
SHA256 7d561aa28df224c97d1fb22c0bee5ab454a146827a15aa25345f1b0f003042bd
MD5 29225ae4af11ec9ebd57cfddd7b1ace3
BLAKE2b-256 d85bdb78edb1cf154eae3e551e6e0a129cce78bac378bca1a68d097153e6a3ff

See more details on using hashes here.

File details

Details for the file topsis_daksh_102303322-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for topsis_daksh_102303322-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6b53f9609d47ce87f1611286aa737307ca4693bd7fd9e4e53f5b49ccd5dfc397
MD5 92c02fd5bd9ba98a488385c2c49828b3
BLAKE2b-256 40c58d71c2bc0a693f6bfb3f7fe00f79a736e904e9044fdec25aaadea72a419e

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