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-102303322

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.3.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.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: topsis_daksh_102303322-1.0.3.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.3.tar.gz
Algorithm Hash digest
SHA256 6d675b6676687949d412fef929947e22392b417faf0ec8f50b8ae69356d15439
MD5 77d5f20f3a66a327258c0792920a8588
BLAKE2b-256 0678df68f586e5cb840fed1c4dd2f0c37112f3b5aeb9ca101e9134698a4afc3d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for topsis_daksh_102303322-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4f93f2818ccf98c36ecd89511a8cb1f2a5a294c5a0936664dbb8b50d9fd8aa3d
MD5 4e04b1dca5e25f8bf729d1c18d95d425
BLAKE2b-256 ea2ea394857dc6517658fa2364c55b8d87d1e16b43bbf0ad5e8c1debdb4e8c4d

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