Skip to content

Commit 05ddff2

Browse files
committed
Cleanup
1 parent 573b822 commit 05ddff2

1 file changed

Lines changed: 5 additions & 32 deletions

File tree

climada/engine/option_appraisal/MCDM/criterion.py

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
import logging
2222
from dataclasses import dataclass, field
23-
from typing import List, Optional, Set, Union
23+
from typing import List, Optional, Sequence, Set, Union
2424

2525
import numpy as np
2626
import pandas as pd
@@ -153,11 +153,12 @@ def display(self) -> str:
153153
for crit in sorted(active, key=lambda c: -total_weights[c.name]):
154154
total = total_weights[crit.name]
155155
effective = total / total_sum if total_sum > 0 else 0.0
156-
bar = _weight_bar(effective, width=len(active))
156+
bar = _weight_bar(effective, width=len(active) * 2)
157157
lines.append(
158-
f" {crit.name:<{max_len+4}} {bar} "
158+
f" {crit.name:<{max_len+4}} "
159159
f"base={crit.weight:.5f} total={total_weights[crit.name]:.5f} "
160-
f"effective={effective:.5f}"
160+
f"effective={effective:.5f} "
161+
f"{bar}"
161162
)
162163

163164
lines.append("")
@@ -336,34 +337,6 @@ def _check_consistency(criteria):
336337
if not all([criteria[0].space is criterion.space for criterion in criteria]):
337338
raise ValueError("Criteria must share the same space of categories.")
338339

339-
def criteria_total_weights(
340-
self,
341-
categories_influence: float = 0.5,
342-
base_weight_influence: float = 0.5,
343-
active_only: bool = True,
344-
) -> dict[str, float]:
345-
"""Compute weighted combination of base weight and category-derived weight.
346-
347-
Parameters
348-
----------
349-
categories_influence : float
350-
Weight given to category-derived score. Must sum to 1 with
351-
``base_weight_influence``.
352-
base_weight_influence : float
353-
Weight given to the criterion's base weight.
354-
active_only : bool
355-
If True (default), only criteria with non-zero total weight are returned.
356-
357-
Returns
358-
-------
359-
dict[str, float]
360-
Mapping of criterion name to total weight.
361-
"""
362-
if categories_influence + base_weight_influence != 1.0:
363-
raise ValueError(
364-
"categories_influence and base_weight_influence must sum to 1."
365-
)
366-
367340
def criteria_total_weights(
368341
self,
369342
categories_influence: float = 0.5,

0 commit comments

Comments
 (0)