Metadata-Version: 2.4
Name: topsis-Mridul
Version: 1.0.0
Summary: A Python implementation of the TOPSIS decision-making method
Home-page: https://github.com/mridulmahajan04/Topsis_Package/
Author: Mridul Mahajan
Author-email: Mridul Mahajan <mridulmahajan16@gmail.com>
Maintainer-email: Mridul Mahajan <mridulmahajan16@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/mridulmahajan04/Topsis_Package/
Project-URL: Repository, https://github.com/mridulmahajan04/Topsis_Package/
Project-URL: Bug Tracker, https://github.com/mridulmahajan04/Topsis_Package/issues
Keywords: topsis,decision-making,multi-criteria,ranking,optimization
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.6
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.19.0
Requires-Dist: pandas>=1.1.0
Dynamic: author
Dynamic: home-page
Dynamic: license-file
Dynamic: requires-python

TOPSIS (Technique for Order of Preference by Similarity to Ideal Solution)

TOPSIS is a Python library for implementing the Technique for Order of Preference by Similarity to Ideal Solution, a multi-criteria decision-making method. This library allows users to rank alternatives based on given criteria, weights, and impacts.

Installation

You can install the library via pip:

pip install topsis-Mridul

Usage

Command-line Usage

The library can be used directly from the command line. Here's the general syntax:

python <program.py> <InputDataFile> <Weights> <Impacts> <ResultFileName>

Example

Create an input file, data.csv:

Name,C1,C2,C3,C4
A,250,16,12,5
B,200,32,8,3
C,300,24,10,4
D,275,20,11,4
E,225,28,9,2

Run the command:

python topsis.py data.csv "0.25,0.25,0.25,0.25" "+,+,-,+" result.csv

The output result.csv will contain:

Name,C1,C2,C3,C4,Topsis Score,Rank
A,250,16,12,5,0.64,2
B,200,32,8,3,0.43,4
C,300,24,10,4,0.78,1
D,275,20,11,4,0.56,3
E,225,28,9,2,0.36,5

Python Library Usage

Importing the Library

You can also use the library directly in Python:

from topsis import Topsis

# Input data
data = "data.csv"
weights = [0.25, 0.25, 0.25, 0.25]
impacts = ["+", "+", "-", "+"]
result_file = "result.csv"

# Perform TOPSIS
Topsis(data, weights, impacts, result_file)
print(f"Results saved in {result_file}")

Parameters

InputDataFile: A CSV file with the first column as the name of the alternatives and the rest as numeric criteria.

Weights: A comma-separated string of numeric weights (e.g., "0.25,0.25,0.25,0.25").

Impacts: A comma-separated string of impacts for each criterion, either + (positive impact) or - (negative impact).

ResultFileName: The name of the output CSV file where results will be saved.

Features

Validate input file format and values.

Handle missing or invalid values gracefully.

Normalize and weight criteria.

Calculate TOPSIS scores and rankings.

Limitations

All criteria must be numeric.

The number of weights and impacts must match the number of criteria.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Feel free to open issues or create pull requests to improve the library!


