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
Metadata
Release files for znum 4.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| znum-4.3.0.tar.gz | 60.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| znum-4.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 85.1 kB
Release files / znum-4.3.0.tar.gz
| Download URL | znum-4.3.0.tar.gz |
|---|---|
| Size | 60.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ca5dc689fda015163191544424b567ed9aa9947a13844d332cdc128bea0b0664
|
|
BLAKE2b-256 checksum How to use checksums |
c79a518b42dc823c3afdbb3e4f143d5d10713fc59b5da041ce0e9e7d225fa4a7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.
Transparency logRelease files / znum-4.3.0-py3-none-any.whl
| Download URL | znum-4.3.0-py3-none-any.whl |
|---|---|
| Size | 24.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
95d8ef3e8ebde81568a5997fe8d6083e328d0a6833f8dea9ae21ec7a07d28beb
|
|
BLAKE2b-256 checksum How to use checksums |
4d0376c0cce90878aed1a67a810e3ebe7f99ba9a5ae25e5e3d1f847f4011c5a8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 31, 2026.
Transparency log