29 lines
793 B
Python
29 lines
793 B
Python
"""Domain and MetricBound dataclasses."""
|
||
|
||
from __future__ import annotations
|
||
|
||
from dataclasses import dataclass, field
|
||
|
||
|
||
@dataclass
|
||
class MetricBound:
|
||
"""Per-metric weight and normalization bounds within a domain."""
|
||
|
||
metric_name: str
|
||
weight: float # 0.0–1.0
|
||
norm_min: float # Below this → score 0 (or 1 if lower_is_better)
|
||
norm_max: float # Above this → score 1 (or 0 if lower_is_better)
|
||
unit: str = ""
|
||
lower_is_better: bool = False # Invert scale (e.g., cost: lower = better)
|
||
metric_id: int | None = None
|
||
|
||
|
||
@dataclass
|
||
class Domain:
|
||
"""A context frame that defines what 'good' means (e.g., urban_commuting)."""
|
||
|
||
name: str
|
||
description: str = ""
|
||
metric_bounds: list[MetricBound] = field(default_factory=list)
|
||
id: int | None = None
|