Znum.config()context manager — Unified configuration for Z-number computation. ReplacesZnum.fast()as the primary configuration entry point. Acceptsfast_triangle,min_b, and the newsort_a_weightparameter.sort_a_weightparameter — Controls how much the A (restriction/value) component weighs against B (reliability) inSort.solver_maincomparisons. Default0.5preserves the original equal weighting. Higher values (e.g.,0.7) make the actual value dominate, preventing B mismatches from masking real value differences in constraint checks.Znum.fast()preserved — Now a convenience alias forZnum.config(fast_triangle=True, ...). Fully backward compatible.
When comparing Z-numbers with mismatched B values (e.g., a summed total with degraded B vs a crisp limit with B=1.0), the original equal weighting allowed B differences to override clear A differences. A value 33 minutes over a time budget could be ranked as "smaller" simply because its B was lower. sort_a_weight=0.7 fixes this by weighting A at 70%, ensuring that actual value dominance is preserved while B still contributes to the comparison.
with Znum.config(fast_triangle=True, min_b=True, sort_a_weight=0.7):
result = z1 + z2 # fast analytical + min_b
is_over = total > limit # A weighted 70%, B weighted 30%min_bparameter onZnum.fast()— Whenmin_b=True, arithmetic operations usemin(B1, B2)element-wise instead of convolution/LP-based B computation. Prevents B reliability degradation through repeated operations (Aliev et al. 2017).
Znum.fast()now uses Li et al. 2023 analytical method — For triangular Z-numbers, B computation uses extended triangular distribution convolutions instead of LP. ~5x faster, deterministic, and produces narrower B spread than LP for high-B inputs. Non-triangular Z-numbers fall back to LP automatically.- New module
tri_math.py— Implements the full analytical pipeline: extended triangular PDF, convolution, and closed-form B computation. - New properties —
is_triangular,A_tri,B_trifor detecting and decomposing triangular Z-numbers. - Removed old fast_b mode — The v3
B = min(B1, B2)heuristic is replaced by the analytically grounded Li et al. method.test_fast_b.pydeleted, replaced bytest_tri_analytical.py(68 tests).
Li, Y. 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
- Separated A and B computation —
math_ops.pyrewritten with clear phases:_compute_a_pairs,_merge_rows,_extract_trapezoidfor A;_compute_b_columns,_compute_prob_pos,_compute_result_B_lpfor B. Old internal methods (get_matrix_main,get_minimized_matrix,get_Q_from_matrix,get_prob_pos) removed. - Added
Znum.fast()context manager — Thread-safe opt-in for fast B computation viathreading.local(). Supports nesting and exception safety.
- Replaced scipy with highspy — Calls the HiGHS LP solver directly instead of going through scipy's Python wrapper. Same solver, same results, ~3x faster arithmetic operations. Dependency shrinks from 46MB (scipy) to 2.5MB (highspy).
- LP model reuse — Builds the HiGHS model once per
get_matrixcall and re-solves by changing only the RHS, avoiding redundant model construction.
- scipy>=1.10.0
+ highspy>=1.7.0Beastrenamed toMCDMUtils— All references toBeastmust be updated.shouldNormalizeWeightrenamed tonormalize_weights— AffectsTopsisandPrometheeconstructors.distanceTyperenamed todistance_type— AffectsTopsisconstructor.- Removed
Znum.Topsis,Znum.Sort,Znum.Promethee,Znum.Beast,Znum.Math,Znum.Dist— Import these directly fromznuminstead of accessing them as class attributes. - Removed
Vikormodule — It had incorrect return values and no test coverage. - Removed
IncompatibleABPartsException— It was never raised anywhere. - Removed
Typeclass (znum/ztype.py) — Shape properties (is_trapezoid,is_triangle,is_even) are now directly onZnum.
- Fixed
Topsis.ordered_indicessorting in wrong direction — Was sorting worst-first instead of best-first. The coresolver_main()was unaffected. - Fixed division-by-zero risks in
sort.py,topsis.py, andutils.pywith proper guards. - Fixed silent B-value mutation — Now emits a
UserWarningwhen near-zero B values are adjusted to avoid degenerate LP solutions. - Fixed decorator wrappers — Added
@functools.wrapsand switched toisinstance()checks in validators.
- Constant Z-number LP shortcut — Ideal Z-numbers (used in Hellinger distance) now solve 1 LP instead of 10, reducing TOPSIS Hellinger runtime by ~27%.
- Promethee symmetry exploitation — Preference table computation now uses upper-triangle iteration, cutting Sort comparisons in half (~22% faster).
- Full type hints on all public APIs.
- Docstrings on all public classes and methods.
- Consistent snake_case naming throughout.
- Magic numbers replaced with named constants.
PrometheeAPI aligned withTopsis(addedresultproperty and guards on all accessor properties).