pyfdm 1.2.0__tar.gz → 1.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyfdm-1.2.2/CHANGELOG.md +107 -0
- pyfdm-1.2.2/MANIFEST.in +3 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/PKG-INFO +4 -4
- {pyfdm-1.2.0 → pyfdm-1.2.2}/README.md +3 -3
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/__init__.py +1 -1
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/__init__.py +5 -5
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_aras.py +18 -7
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_codas.py +14 -3
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_mabac.py +6 -3
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_topsis.py +15 -6
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/helpers.py +25 -1
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm.egg-info/PKG-INFO +4 -4
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm.egg-info/SOURCES.txt +2 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyproject.toml +1 -1
- {pyfdm-1.2.0 → pyfdm-1.2.2}/setup.py +1 -1
- {pyfdm-1.2.0 → pyfdm-1.2.2}/LICENSE +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/TFN/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/TFN/tfn.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/correlations.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/expert/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/expert/collector.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/expert/exporter.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/expert/scales.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/multiple_tfn_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/s_norm_tfn_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/single_tfn_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/t_norm_tfn_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/tfn_criteria_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/graphs/tfn_membership_plot.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/group/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/group/aggregation.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/helpers.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/_base.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_aroman.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_cocoso.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_copras.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_edas.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_ervd.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_mairca.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_marcos.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_moora.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_ocra.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_piv.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_rafsi.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_rim.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_spotis.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_vikor.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_waspas.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_wpm.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/methods/f_wsm.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/step_logger.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/defuzzifications.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/distances.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/normalizations.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/utils/ranking.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/validator.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/objective.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/__init__.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/_base.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_ahp.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_bwm.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_fucom.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_lmaw.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_rancom.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm/weights/subjective/f_swara.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm.egg-info/dependency_links.txt +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm.egg-info/requires.txt +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/pyfdm.egg-info/top_level.txt +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/setup.cfg +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_aggregation.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_correlations.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_expert_collector.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_fuzzy_exporter.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_methods.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_ranking.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_scales.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_step_logger.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_validator.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_weights_objective.py +0 -0
- {pyfdm-1.2.0 → pyfdm-1.2.2}/tests/test_weights_subjective.py +0 -0
pyfdm-1.2.2/CHANGELOG.md
ADDED
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to pyfdm are documented here.
|
|
4
|
+
The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|
5
|
+
Versioning follows [Semantic Versioning](https://semver.org/).
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## [1.2.2] — 2026
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- **fTOPSIS**: Criterion types (`types`) were ignored when using type-agnostic normalizations (`vector_normalization`, `saw_normalization`, `sqrt_normalization`). Positive and negative ideal solutions are now constructed depending on criterion direction for these normalizations, while type-aware normalizations retain the classical ones/zeros reference points.
|
|
14
|
+
- **fCODAS**: Negative solution (NS) was always computed as the column-wise minimum, which produced incorrect rankings for cost criteria under type-agnostic normalizations. NS is now type-dependent when the selected normalization does not invert cost criteria.
|
|
15
|
+
- **fMABAC**: Cost criteria were treated as benefit criteria after type-agnostic normalization. Cost columns are now inverted after normalization when needed, so that higher values consistently represent better performance before computing the Border Approximation Area.
|
|
16
|
+
- **fARAS**: The ideal alternative row was always built using maximum values, and cost criteria were not handled correctly with type-agnostic normalizations (leading to preference scores > 1 and unchanged rankings). The ideal row is now type-aware, and cost columns are inverted after normalization when required so that the ideal alternative has the highest utility.
|
|
17
|
+
|
|
18
|
+
## [1.2.1] — 2026
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- Inclusion of the `CHANGELOG.md` file in build
|
|
23
|
+
|
|
24
|
+
## [1.2.0] — 2026
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
**Core architecture**
|
|
29
|
+
|
|
30
|
+
- `BaseFuzzyMethod` abstract base class (`pyfdm.methods.BaseFuzzyMethod`): all 21 MCDA method classes now inherit from it, providing a shared `rank()` implementation, consistent `__repr__`, and a `method_name` property.
|
|
31
|
+
- `rank_alternatives()` standalone ranking utility (`pyfdm.utils.rank_alternatives`): computes a ranking from any 1-D score vector with five tie-breaking strategies — `'average'` (default, identical to old `helpers.rank()` behaviour), `'min'`, `'max'`, `'dense'`, `'ordinal'`. Full input validation: raises on NaN, Inf, empty arrays, non-1-D input, non-numeric data. Runs in O(n log n).
|
|
32
|
+
- `StepLogger` class (`pyfdm.step_logger.StepLogger`): captures every intermediate matrix and vector computed by an MCDA method or subjective weighting method. Activated by passing a `StepLogger` instance as `logger=` in any method's `__init__`. Supports console tables, JSON, CSV, and Excel output, individually or combined.
|
|
33
|
+
- `logger=` keyword argument added to `__init__` on all 21 MCDA method classes. Accepts a `StepLogger` or `None`; raises `TypeError` on any other value.
|
|
34
|
+
- `intermediate_results` now are included in both fuzzy MCDA methods and fuzzy subjective weighting methods. Can be used to verify and check partial results from the calculation process.
|
|
35
|
+
|
|
36
|
+
**Validator improvements**
|
|
37
|
+
|
|
38
|
+
- `validate_matrix_shape`: now explicitly checks `m >= 2` alternatives and `n >= 1` criteria.
|
|
39
|
+
- `validate_tfn`: new check — every TFN `(l, m, u)` must satisfy `l <= m <= u`; NaN and Inf are rejected with descriptive messages.
|
|
40
|
+
- `validate_weights`: new check — 1-D weights must be non-negative; 2-D TFN weights must each satisfy `l <= m <= u`.
|
|
41
|
+
- `validate_types`: new check — values must be in `{1, −1}`.
|
|
42
|
+
- `validate_input`: explicit dimension-mismatch check between matrix, weights, and types.
|
|
43
|
+
- `validate_comparison_matrix`: new method for subjective weighting inputs (square `(n, n, 3)` TFN matrices).
|
|
44
|
+
- `validate_param_range`: new method to check if given parameter is in the required range.
|
|
45
|
+
- `validate_vectors`: new method to check rankings given as parameters for correlation and similarity coefficients.
|
|
46
|
+
- several functions for method-specific input data validation: `validate_ervd_input`, `validate_rim_input`, `validate_rafsi_input`, `validate_spotis_input`, `validate_lmaw_input`, `validate_bwm_input`
|
|
47
|
+
|
|
48
|
+
**New MCDA methods (6)**
|
|
49
|
+
|
|
50
|
+
- `fAROMAN` — fuzzy Alternative Ranking Order Method Accounting for two-step Normalization.
|
|
51
|
+
- `fERVD` — fuzzy Election based on Relative Value Distances. Supports custom reference points.
|
|
52
|
+
- `fMARCOS` — fuzzy Measurement of Alternatives and Ranking according to Compromise Solution.
|
|
53
|
+
- `fPIV` — fuzzy Proximity Indexed Value.
|
|
54
|
+
- `fRAFSI` — Fuzzy Ranking of Alternatives through Functional mapping of criterion Sub-Intervals into a Single Interval.
|
|
55
|
+
- `fRIM` — Fuzzy Reference Ideal Method.
|
|
56
|
+
|
|
57
|
+
**Subjective weighting methods (6)** — `pyfdm.weights.subjective`
|
|
58
|
+
|
|
59
|
+
- `fAHP` — Fuzzy Analytic Hierarchy Process with optional Consistency Ratio check.
|
|
60
|
+
- `fBWM` — Fuzzy Best-Worst Method with iterative gradient-descent solver.
|
|
61
|
+
- `fFUCOM` — Fuzzy Full Consistency Method.
|
|
62
|
+
- `fLMAW` — Fuzzy Logarithm Methodology of Additive Weights.
|
|
63
|
+
- `fRANCOM` — Fuzzy RANking COMparison; accepts tied rankings.
|
|
64
|
+
- `fSWARA` — Fuzzy Step-wise Weight Assessment Ratio Analysis.
|
|
65
|
+
|
|
66
|
+
**Objective weights reorganization** — `pyfdm.weights.objective`
|
|
67
|
+
|
|
68
|
+
- Existing functions (`equal_weights`, `shannon_entropy_weights`, `standard_deviation_weights`, `variance_weights`) are now also available under `pyfdm.weights.objective`. Direct imports from `pyfdm.weights` continue to work.
|
|
69
|
+
|
|
70
|
+
**Expert data collection and export** — `pyfdm.expert`
|
|
71
|
+
|
|
72
|
+
- `ExpertCollector`: collects per-expert integer ratings, validates them against a linguistic scale, and converts to TFN decision matrices.
|
|
73
|
+
- `FuzzyExporter`: exports collected data to CSV, JSON, or Excel (requires `openpyxl`).
|
|
74
|
+
- Built-in linguistic scales: `SCALE_1_5`, `SCALE_1_7`, `SCALE_1_9`.
|
|
75
|
+
- `get_tfn(rating, scale)` helper for single-value conversion.
|
|
76
|
+
|
|
77
|
+
**Group aggregation** — `pyfdm.group`
|
|
78
|
+
|
|
79
|
+
- `aggregate(matrices, method=...)`: geometric mean (recommended for fAHP), arithmetic mean, weighted average, OWA.
|
|
80
|
+
- Individual functions exported: `geometric_mean`, `arithmetic_mean`, `weighted_average`, `owa`.
|
|
81
|
+
|
|
82
|
+
**TFN utilities** — `pyfdm.utils`
|
|
83
|
+
|
|
84
|
+
- `normalize_weights(weights)`: moved here from `pyfdm.helpers`; old location emits `DeprecationWarning`.
|
|
85
|
+
- `crisp_to_tfn_weights(weights)`: expands crisp weights to degenerate TFNs `(w, w, w)`.
|
|
86
|
+
- `tfn_to_crisp(weights, method)`: defuzzifies TFN weights; supports `'graded_mean'`, `'mean'`, `'mean_area'`, `'centroid'`.
|
|
87
|
+
- `defuzzify_matrix(matrix, method)`: defuzzifies a full `(m, n, 3)` TFN matrix to crisp `(m, n)`.
|
|
88
|
+
|
|
89
|
+
**Packaging**
|
|
90
|
+
|
|
91
|
+
- `setup.py`: bumped to version `1.2.0`; added `extras_require = {'excel': ['openpyxl'], 'dev': ['pytest', 'openpyxl']}`.
|
|
92
|
+
- `docs/conf.py`: version updated to `1.2.0`, copyright year updated.
|
|
93
|
+
- `CHANGELOG.md`: this file added.
|
|
94
|
+
|
|
95
|
+
### Changed
|
|
96
|
+
|
|
97
|
+
- `helpers.rank()` now delegates to `rank_alternatives(method='average')`. Behaviour is identical for the default `descending=True` case; a three-way tie now correctly returns `2.0` (average of ranks 1, 2, 3) rather than the previously incorrect value from a broken formula.
|
|
98
|
+
- `BaseFuzzyMethod.rank()` delegates to `rank_alternatives` directly instead of re-importing from `helpers`, removing a circular-import risk.
|
|
99
|
+
- Sphinx `docs/`: all new packages, submodules, and methods have corresponding `.rst` files; `pyfdm.rst` and `pyfdm.methods.rst` updated to include them in the toctree.
|
|
100
|
+
|
|
101
|
+
### Deprecated
|
|
102
|
+
|
|
103
|
+
- `pyfdm.helpers.normalize_weights`: use `from pyfdm.utils import normalize_weights` instead. The old import path raises `DeprecationWarning` and will be removed in v1.3.0.
|
|
104
|
+
|
|
105
|
+
## [1.1.13] — 2024
|
|
106
|
+
|
|
107
|
+
Last stable release before the v1.2.0 overhaul. Contains 15 MCDA methods (ARAS, COCOSO, CODAS, COPRAS, EDAS, MABAC, MAIRCA, MOORA, OCRA, SPOTIS, TOPSIS, VIKOR, WASPAS, WPM, WSM), 4 objective weighting functions, 4 correlation coefficients, TFN arithmetic, and Sphinx documentation.
|
pyfdm-1.2.2/MANIFEST.in
ADDED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfdm
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python library for Fuzzy Decision Making based on Triangular Fuzzy Numbers
|
|
5
5
|
Home-page: https://github.com/jwieckowski/pyfdm
|
|
6
6
|
Author: Jakub Więckowski
|
|
@@ -40,7 +40,7 @@ Dynamic: requires-python
|
|
|
40
40
|
|
|
41
41
|
Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular Fuzzy Numbers (TFN).
|
|
42
42
|
|
|
43
|
-
**Version 1.2.
|
|
43
|
+
**Version 1.2.2** adds 6 new MCDA methods, 6 subjective weighting methods, an expert-data collection and export module, group aggregation, step-by-step intermediate result inspection, and a standalone ranking utility — on top of a refactored, more robust core architecture. See [What's new in 1.2.2](#whats-new-in-120) below.
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular
|
|
|
49
49
|
- [Installation](#installation)
|
|
50
50
|
- [Local development setup](#local-development-setup)
|
|
51
51
|
- [Testing](#testing)
|
|
52
|
-
- [What's new in 1.2.
|
|
52
|
+
- [What's new in 1.2.2](#whats-new-in-120)
|
|
53
53
|
- [Modules and functionalities](#modules-and-functionalities)
|
|
54
54
|
- [Usage examples](#usage-examples)
|
|
55
55
|
- [Citations](#citations)
|
|
@@ -156,7 +156,7 @@ All tests are expected to pass with zero `DeprecationWarning`s on a clean checko
|
|
|
156
156
|
|
|
157
157
|
---
|
|
158
158
|
|
|
159
|
-
# What's new in 1.2.
|
|
159
|
+
# What's new in 1.2.2
|
|
160
160
|
|
|
161
161
|
### Architecture
|
|
162
162
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular Fuzzy Numbers (TFN).
|
|
4
4
|
|
|
5
|
-
**Version 1.2.
|
|
5
|
+
**Version 1.2.2** adds 6 new MCDA methods, 6 subjective weighting methods, an expert-data collection and export module, group aggregation, step-by-step intermediate result inspection, and a standalone ranking utility — on top of a refactored, more robust core architecture. See [What's new in 1.2.2](#whats-new-in-120) below.
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
@@ -11,7 +11,7 @@ Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular
|
|
|
11
11
|
- [Installation](#installation)
|
|
12
12
|
- [Local development setup](#local-development-setup)
|
|
13
13
|
- [Testing](#testing)
|
|
14
|
-
- [What's new in 1.2.
|
|
14
|
+
- [What's new in 1.2.2](#whats-new-in-120)
|
|
15
15
|
- [Modules and functionalities](#modules-and-functionalities)
|
|
16
16
|
- [Usage examples](#usage-examples)
|
|
17
17
|
- [Citations](#citations)
|
|
@@ -118,7 +118,7 @@ All tests are expected to pass with zero `DeprecationWarning`s on a clean checko
|
|
|
118
118
|
|
|
119
119
|
---
|
|
120
120
|
|
|
121
|
-
# What's new in 1.2.
|
|
121
|
+
# What's new in 1.2.2
|
|
122
122
|
|
|
123
123
|
### Architecture
|
|
124
124
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
from .multiple_tfn_plot import multiple_tfn_plot
|
|
2
|
-
from .s_norm_tfn_plot import s_norm_tfn_plot
|
|
3
|
-
from .single_tfn_plot import single_tfn_plot
|
|
4
|
-
from .t_norm_tfn_plot import t_norm_tfn_plot
|
|
5
|
-
from .tfn_criteria_plot import tfn_criteria_plot
|
|
1
|
+
from .multiple_tfn_plot import multiple_tfn_plot
|
|
2
|
+
from .s_norm_tfn_plot import s_norm_tfn_plot
|
|
3
|
+
from .single_tfn_plot import single_tfn_plot
|
|
4
|
+
from .t_norm_tfn_plot import t_norm_tfn_plot
|
|
5
|
+
from .tfn_criteria_plot import tfn_criteria_plot
|
|
6
6
|
from .tfn_membership_plot import tfn_membership_plot
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
5
|
from ._base import BaseFuzzyMethod
|
|
6
|
-
from ..validator import Validator
|
|
7
6
|
from ..step_logger import StepLogger
|
|
8
|
-
from ..utils
|
|
7
|
+
from ..utils import sum_normalization, is_type_aware_normalization
|
|
9
8
|
|
|
10
9
|
class fARAS(BaseFuzzyMethod):
|
|
11
10
|
"""
|
|
@@ -157,11 +156,17 @@ class fARAS(BaseFuzzyMethod):
|
|
|
157
156
|
(matrix.shape[0]+1, matrix.shape[1], matrix.shape[2]), dtype=object)
|
|
158
157
|
exmatrix[1:] = matrix
|
|
159
158
|
|
|
160
|
-
|
|
161
|
-
np.max(np.max(matrix, axis=0), axis=1), 3
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
159
|
+
if is_type_aware_normalization(self.normalization):
|
|
160
|
+
ideal_row = np.repeat(np.max(np.max(matrix, axis=0), axis=1), 3).reshape(matrix.shape[1], matrix.shape[2])
|
|
161
|
+
else:
|
|
162
|
+
ideal_row = np.empty((matrix.shape[1], 3), dtype=float)
|
|
163
|
+
for j in range(matrix.shape[1]):
|
|
164
|
+
if types[j] == 1:
|
|
165
|
+
ideal_row[j] = np.max(matrix[:, j], axis=0)
|
|
166
|
+
else:
|
|
167
|
+
ideal_row[j] = np.min(matrix[:, j], axis=0)
|
|
168
|
+
|
|
169
|
+
exmatrix[0] = ideal_row
|
|
165
170
|
except Exception as e:
|
|
166
171
|
raise RuntimeError(f"Failed to build the extended matrix: {e}") from e
|
|
167
172
|
|
|
@@ -177,6 +182,12 @@ class fARAS(BaseFuzzyMethod):
|
|
|
177
182
|
except Exception as e:
|
|
178
183
|
raise RuntimeError(f"Normalization step failed: {e}") from e
|
|
179
184
|
|
|
185
|
+
if not is_type_aware_normalization(self.normalization):
|
|
186
|
+
for j in range(nmatrix.shape[1]):
|
|
187
|
+
if types[j] == -1:
|
|
188
|
+
col_max = np.max(nmatrix[:, j], axis=0)
|
|
189
|
+
nmatrix[:, j] = col_max - nmatrix[:, j]
|
|
190
|
+
|
|
180
191
|
self._log_step(
|
|
181
192
|
self.logger,
|
|
182
193
|
'Normalized matrix',
|
|
@@ -5,8 +5,10 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from ._base import BaseFuzzyMethod
|
|
7
7
|
from ..step_logger import StepLogger
|
|
8
|
-
from ..utils import
|
|
9
|
-
|
|
8
|
+
from ..utils import (
|
|
9
|
+
max_normalization, euclidean_distance,
|
|
10
|
+
hamming_distance, is_type_aware_normalization
|
|
11
|
+
)
|
|
10
12
|
|
|
11
13
|
class fCODAS(BaseFuzzyMethod):
|
|
12
14
|
"""
|
|
@@ -203,7 +205,16 @@ class fCODAS(BaseFuzzyMethod):
|
|
|
203
205
|
self._log_step(self.logger, 'Weighted normalized matrix', wmatrix, 'Element-wise product of normalized matrix and weights')
|
|
204
206
|
|
|
205
207
|
try:
|
|
206
|
-
|
|
208
|
+
if is_type_aware_normalization(self.normalization):
|
|
209
|
+
NS = np.min(wmatrix, axis=0)
|
|
210
|
+
else:
|
|
211
|
+
NS = np.empty((matrix.shape[1], 3), dtype=float)
|
|
212
|
+
for j in range(matrix.shape[1]):
|
|
213
|
+
col = wmatrix[:, j]
|
|
214
|
+
if types[j] == 1: # benefit → worst = min
|
|
215
|
+
NS[j] = np.min(col, axis=0)
|
|
216
|
+
else: # cost → worst = max
|
|
217
|
+
NS[j] = np.max(col, axis=0)
|
|
207
218
|
except Exception as e:
|
|
208
219
|
raise RuntimeError(f"Failed to compute the fuzzy negative solution: {e}") from e
|
|
209
220
|
|
|
@@ -5,9 +5,7 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from ._base import BaseFuzzyMethod
|
|
7
7
|
from ..step_logger import StepLogger
|
|
8
|
-
from ..utils import mean_defuzzification
|
|
9
|
-
from ..utils import minmax_normalization
|
|
10
|
-
|
|
8
|
+
from ..utils import mean_defuzzification, minmax_normalization, is_type_aware_normalization
|
|
11
9
|
|
|
12
10
|
class fMABAC(BaseFuzzyMethod):
|
|
13
11
|
"""
|
|
@@ -170,6 +168,11 @@ class fMABAC(BaseFuzzyMethod):
|
|
|
170
168
|
except Exception as e:
|
|
171
169
|
raise RuntimeError(f"Normalization step failed: {e}") from e
|
|
172
170
|
|
|
171
|
+
if not is_type_aware_normalization(self.normalization):
|
|
172
|
+
for j in range(nmatrix.shape[1]):
|
|
173
|
+
if types[j] == -1:
|
|
174
|
+
nmatrix[:, j] = 1 - nmatrix[:, j]
|
|
175
|
+
|
|
173
176
|
self._log_step(
|
|
174
177
|
self.logger,
|
|
175
178
|
'Normalized matrix',
|
|
@@ -5,7 +5,7 @@ from typing import Any
|
|
|
5
5
|
|
|
6
6
|
from ._base import BaseFuzzyMethod
|
|
7
7
|
from ..step_logger import StepLogger
|
|
8
|
-
from ..utils import linear_normalization, vertex_distance
|
|
8
|
+
from ..utils import linear_normalization, vertex_distance, is_type_aware_normalization
|
|
9
9
|
|
|
10
10
|
class fTOPSIS(BaseFuzzyMethod):
|
|
11
11
|
"""
|
|
@@ -144,9 +144,7 @@ class fTOPSIS(BaseFuzzyMethod):
|
|
|
144
144
|
If any computational stage fails.
|
|
145
145
|
"""
|
|
146
146
|
|
|
147
|
-
# -----------------------------
|
|
148
147
|
# Normalization
|
|
149
|
-
# -----------------------------
|
|
150
148
|
try:
|
|
151
149
|
nmatrix = self.normalization(matrix, types)
|
|
152
150
|
|
|
@@ -178,9 +176,20 @@ class fTOPSIS(BaseFuzzyMethod):
|
|
|
178
176
|
|
|
179
177
|
# Ideal solutions
|
|
180
178
|
try:
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
if is_type_aware_normalization(self.normalization):
|
|
180
|
+
ideal = np.ones((matrix.shape[1], matrix.shape[2]))
|
|
181
|
+
nideal = np.zeros((matrix.shape[1], matrix.shape[2]))
|
|
182
|
+
else:
|
|
183
|
+
ideal = np.empty((matrix.shape[1], 3))
|
|
184
|
+
nideal = np.empty((matrix.shape[1], 3))
|
|
185
|
+
|
|
186
|
+
for j in range(matrix.shape[1]):
|
|
187
|
+
if types[j] == 1: # benefit
|
|
188
|
+
ideal[j] = np.max(wmatrix[:, j], axis=0)
|
|
189
|
+
nideal[j] = np.min(wmatrix[:, j], axis=0)
|
|
190
|
+
else: # cost
|
|
191
|
+
ideal[j] = np.min(wmatrix[:, j], axis=0)
|
|
192
|
+
nideal[j] = np.max(wmatrix[:, j], axis=0)
|
|
184
193
|
except Exception as e:
|
|
185
194
|
raise RuntimeError(f"Failed to create fuzzy ideal solutions: {e}") from e
|
|
186
195
|
|
|
@@ -2,10 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
4
|
|
|
5
|
+
from .normalizations import (
|
|
6
|
+
vector_normalization,
|
|
7
|
+
saw_normalization,
|
|
8
|
+
sqrt_normalization,
|
|
9
|
+
)
|
|
10
|
+
|
|
5
11
|
__all__ = [
|
|
6
12
|
'normalize_weights',
|
|
7
13
|
'crisp_to_tfn_weights',
|
|
8
|
-
'generate_fuzzy_matrix'
|
|
14
|
+
'generate_fuzzy_matrix',
|
|
15
|
+
'is_type_aware_normalization'
|
|
9
16
|
]
|
|
10
17
|
|
|
11
18
|
def normalize_weights(weights: np.ndarray) -> np.ndarray:
|
|
@@ -101,3 +108,20 @@ def generate_fuzzy_matrix(
|
|
|
101
108
|
|
|
102
109
|
matrix = np.random.uniform(low=lower, high=upper, size=(m, n, 3))
|
|
103
110
|
return np.array([np.sort(row, axis=1) for row in matrix])
|
|
111
|
+
|
|
112
|
+
_TYPE_AGNOSTIC_NORMALIZATIONS = {
|
|
113
|
+
vector_normalization,
|
|
114
|
+
saw_normalization,
|
|
115
|
+
sqrt_normalization,
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
def is_type_aware_normalization(normalization) -> bool:
|
|
119
|
+
"""
|
|
120
|
+
Return True if the given normalization function takes criterion types
|
|
121
|
+
into account (i.e. inverts cost criteria).
|
|
122
|
+
|
|
123
|
+
Type-agnostic normalizations (vector, saw, sqrt) ignore ``types``
|
|
124
|
+
and therefore require the calling method to handle benefit/cost
|
|
125
|
+
direction when constructing ideal solutions.
|
|
126
|
+
"""
|
|
127
|
+
return normalization not in _TYPE_AGNOSTIC_NORMALIZATIONS
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: pyfdm
|
|
3
|
-
Version: 1.2.
|
|
3
|
+
Version: 1.2.2
|
|
4
4
|
Summary: Python library for Fuzzy Decision Making based on Triangular Fuzzy Numbers
|
|
5
5
|
Home-page: https://github.com/jwieckowski/pyfdm
|
|
6
6
|
Author: Jakub Więckowski
|
|
@@ -40,7 +40,7 @@ Dynamic: requires-python
|
|
|
40
40
|
|
|
41
41
|
Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular Fuzzy Numbers (TFN).
|
|
42
42
|
|
|
43
|
-
**Version 1.2.
|
|
43
|
+
**Version 1.2.2** adds 6 new MCDA methods, 6 subjective weighting methods, an expert-data collection and export module, group aggregation, step-by-step intermediate result inspection, and a standalone ranking utility — on top of a refactored, more robust core architecture. See [What's new in 1.2.2](#whats-new-in-120) below.
|
|
44
44
|
|
|
45
45
|
---
|
|
46
46
|
|
|
@@ -49,7 +49,7 @@ Python 3 package with Fuzzy Decision Making (PyFDM) methods based on Triangular
|
|
|
49
49
|
- [Installation](#installation)
|
|
50
50
|
- [Local development setup](#local-development-setup)
|
|
51
51
|
- [Testing](#testing)
|
|
52
|
-
- [What's new in 1.2.
|
|
52
|
+
- [What's new in 1.2.2](#whats-new-in-120)
|
|
53
53
|
- [Modules and functionalities](#modules-and-functionalities)
|
|
54
54
|
- [Usage examples](#usage-examples)
|
|
55
55
|
- [Citations](#citations)
|
|
@@ -156,7 +156,7 @@ All tests are expected to pass with zero `DeprecationWarning`s on a clean checko
|
|
|
156
156
|
|
|
157
157
|
---
|
|
158
158
|
|
|
159
|
-
# What's new in 1.2.
|
|
159
|
+
# What's new in 1.2.2
|
|
160
160
|
|
|
161
161
|
### Architecture
|
|
162
162
|
|
|
@@ -8,7 +8,7 @@ with open("CHANGELOG.md", "r", encoding="utf-8") as fh:
|
|
|
8
8
|
|
|
9
9
|
setuptools.setup(
|
|
10
10
|
name="pyfdm",
|
|
11
|
-
version="1.2.
|
|
11
|
+
version="1.2.2",
|
|
12
12
|
author="Jakub Więckowski",
|
|
13
13
|
author_email="j.wieckowski@il-pib.pl",
|
|
14
14
|
description="Python library for Fuzzy Decision Making based on Triangular Fuzzy Numbers",
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|