Skip to main content

pyrepo-mcda

GitHub PyPI Documentation License DOI

The Python 3 library for Multi-Criteria Decision Analysis.

Installation

pip install pyrepo-mcda

Usage

pyrepo-mcda can be used to rank alternatives after providing their performance values in the two-dimensional decision matrix matrix with alternatives in rows and criteria in columns, and criteria weights weights and types types in vectors. All criteria weights must sum to 1. Criteria types are equal to 1 for profit criteria and -1 for cost criteria. The TOPSIS method returns a vector with preference values pref assigned to alternatives. To rank alternatives according to TOPSIS preference values, we have to sort them in descending order because, in the TOPSIS method, the best alternative has the highest preference value. The alternatives are ranked using the rank_preferences method provided in the additions module of the pyrepo-mcda package. Parameter reverse = True means that alternatives are sorted in descending order. Here is an example of using the TOPSIS method:

import numpy as np
from pyrepo_mcda.mcda_methods import TOPSIS
from pyrepo_mcda import distance_metrics as dists
from pyrepo_mcda import normalizations as norms
from pyrepo_mcda.additions import rank_preferences

matrix = np.array([[256, 8, 41, 1.6, 1.77, 7347.16],
[256, 8, 32, 1.0, 1.8, 6919.99],
[256, 8, 53, 1.6, 1.9, 8400],
[256, 8, 41, 1.0, 1.75, 6808.9],
[512, 8, 35, 1.6, 1.7, 8479.99],
[256, 4, 35, 1.6, 1.7, 7499.99]])

weights = np.array([0.405, 0.221, 0.134, 0.199, 0.007, 0.034])
types = np.array([1, 1, 1, 1, -1, -1])

topsis = TOPSIS(normalization_method=norms.vector_normalization, distance_metric=dists.euclidean)
pref = topsis(matrix, weights, types)
rank = rank_preferences(pref, reverse = True)
print(rank)

License

pyrepo-mcda was created by Aleksandra Bączkiewicz. It is licensed under the terms of the MIT license.

Documentation

Documentation of this library with instruction for installation and usage is provided here

Release files for pyrepo-mcda 0.1.15

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pyrepo-mcda 0.1.15
File Size Uploaded
pyrepo_mcda-0.1.15.tar.gz 44.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pyrepo-mcda 0.1.15
File Interpreter ABI Platform
pyrepo_mcda-0.1.15-py3-none-any.whl Python 3 none any Details

Total release size: 94.7 kB

Release files / pyrepo_mcda-0.1.15.tar.gz

Download URL pyrepo_mcda-0.1.15.tar.gz
Size 44.1 kB
Tags Source
SHA-256 checksum
How to use checksums
9edd40a4241d1408f8951b398786473de78a22c7aa3dc9a7848c3e6d288a9a0c
BLAKE2b-256 checksum
How to use checksums
7cb92debe410bb8ecbcb02c4df7286d22a49887d104a2b7c5fb25b18e716d5f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release files / pyrepo_mcda-0.1.15-py3-none-any.whl

Download URL pyrepo_mcda-0.1.15-py3-none-any.whl
Size 50.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fce45611f89569f3aa6c43602edd9f87254d860cdd6272c71000a66c7f1bdab4
BLAKE2b-256 checksum
How to use checksums
2add7169cfe281ce8106c4ecc842eedd6635628fd43a83584fa27ef89c5a8ecb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.0

Release history Release notifications | RSS feed

This release

0.1.15 This release

2 release files

0.1.14

2 release files

0.1.13

2 release files

0.1.12

2 release files

0.1.11

2 release files

0.1.10

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page