Skip to main content

Z-number data type for fuzzy arithmetic and multi-criteria decision making (TOPSIS, PROMETHEE)

Project description

Znum logo

Znum

A Python library for Z-number arithmetic and multi-criteria decision making (MCDM).

A Z-number is a fuzzy number with two components:

  • A: The main fuzzy set values (restriction on values)
  • B: The confidence/belief values (reliability of A)

Znum supports full mathematical operations (addition, subtraction, multiplication, division, power), comparison operators, and includes implementations of TOPSIS and PROMETHEE optimization methods.

Installation

pip install znum

Quick Start

from znum import Znum

# Create Z-numbers
z1 = Znum([1, 2, 3, 4], [0.1, 0.2, 0.3, 0.4])
z2 = Znum([2, 4, 8, 10], [0.5, 0.6, 0.7, 0.8])

# Arithmetic operations
z3 = z1 + z2
z4 = z1 * z2
z5 = z1 - z2
z6 = z1 / z2

# Comparison
print(z1 > z2)  # False
print(z1 < z2)  # True

# Power
z7 = z1 ** 2

MCDM Methods

TOPSIS

from znum import Znum, Topsis, MCDMUtils

# Create weights, alternatives, and criteria types
weights = [Znum([0.2, 0.3, 0.4, 0.5], [0.1, 0.2, 0.3, 0.4])]
alternatives = [[Znum([7, 8, 9, 10], [0.6, 0.7, 0.8, 0.9])]]
criteria_types = [MCDMUtils.CriteriaType.BENEFIT]

table = [weights, *alternatives, criteria_types]
topsis = Topsis(table)
result = topsis.solve()

# Access results
best_idx = topsis.index_of_best_alternative
worst_idx = topsis.index_of_worst_alternative
ranking = topsis.ordered_indices

PROMETHEE

from znum import Znum, Promethee, MCDMUtils

table = [weights, *alternatives, criteria_types]
promethee = Promethee(table)
sorted_alternatives = promethee.solve()

# Access results
best_idx = promethee.index_of_best_alternative
worst_idx = promethee.index_of_worst_alternative
ranking = promethee.ordered_indices

Development

# Install dependencies
pip install -e ".[dev]"

# Run tests
pytest

References

  • Zadeh, L.A. (2011). A Note on Z-numbers. Information Sciences, 181(14), 2923–2932. doi:10.1016/j.ins.2011.02.022
  • Li, Y., Herrera-Viedma, E., Pérez, I.J. et al. (2023). The arithmetic of triangular Z-numbers with reduced calculation complexity using an extension of triangular distribution. Information Sciences, 647, 119477. doi:10.1016/j.ins.2023.119477

License

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

znum-4.2.0.tar.gz (59.5 kB view details)

Uploaded Source

Built Distribution

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

znum-4.2.0-py3-none-any.whl (23.5 kB view details)

Uploaded Python 3

File details

Details for the file znum-4.2.0.tar.gz.

File metadata

  • Download URL: znum-4.2.0.tar.gz
  • Upload date:
  • Size: 59.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for znum-4.2.0.tar.gz
Algorithm Hash digest
SHA256 b0f68b73cd138e1131d06df38d8e353e51b0fce28b5b085fb816dcef017ec5c3
MD5 7fea0c514130037c94976a9cdb69ab6b
BLAKE2b-256 1d6ae150ffb07f99e3d069f1147cc2f69fe8128076e135910f72f0f3b5991f2c

See more details on using hashes here.

Provenance

The following attestation bundles were made for znum-4.2.0.tar.gz:

Publisher: publish.yml on MahammadNuriyev62/Znum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file znum-4.2.0-py3-none-any.whl.

File metadata

  • Download URL: znum-4.2.0-py3-none-any.whl
  • Upload date:
  • Size: 23.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for znum-4.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c39bc81b8ed75c14cc807958a99ca101e846e86078a9bd085aec3309287faa5b
MD5 c5a78b127b18a387e0bd4e5d0d37428a
BLAKE2b-256 b3fe1f1de148eb4b64b357a62fe63cc1bb4617a5bbc39c2ba32fc4e1bbbe64c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for znum-4.2.0-py3-none-any.whl:

Publisher: publish.yml on MahammadNuriyev62/Znum

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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