topsis
mcda.topsis
TOPSIS aggregation: rank tools by their distance from the ideal solution.
Functions
| Name | Description |
|---|---|
| topsis | Compute TOPSIS relative-closeness scores per tool. |
topsis
mcda.topsis.topsis(normalized, weights)
Compute TOPSIS relative-closeness scores per tool.
The input is the matrix produced by min_max_normalize: values in [0, 1] with every column oriented so higher is better. The function multiplies each column by its weight to obtain the weighted matrix V. The ideal solution A+ is the per-metric maximum of V; the anti-ideal A- is the per-metric minimum. Each tool’s score is its relative closeness to the ideal:
closeness(i) = D-(i) / (D+(i) + D-(i))
where D+(i) and D-(i) are the Euclidean distances from tool i to A+ and A-. Higher closeness is better.
The computation is delegated to pymcdm.methods.TOPSIS with an identity normalization, so pymcdm runs directly on beam’s already normalized matrix, and with all criteria typed as profit (+1) because the matrix is oriented higher is better. The native loop has been replaced by that call.
For a single tool, or when all tools are identical on every metric, D+ + D- is zero and closeness is undefined. pymcdm returns a not-a-number there, so beam intercepts that case and returns 0.5 in those rows, the same convention as before, so the caller still gets a usable vector.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
normalized |
np.ndarray | Shape (n_tools, n_metrics), values in [0, 1]. |
required |
weights |
np.ndarray | Shape (n_metrics,), non-negative; typically sums to 1. |
required |
Returns
| Type | Description |
|---|---|
| np.ndarray | Shape (n_tools,), closeness in [0, 1]. |