domain-level constraints

This commit is contained in:
2026-03-04 16:53:58 -06:00
parent 00cc8dd9ef
commit 843baa15ad
11 changed files with 188 additions and 21 deletions

View File

@@ -3,7 +3,7 @@
from __future__ import annotations
from physcom.models.entity import Entity, Dependency
from physcom.models.domain import Domain, MetricBound
from physcom.models.domain import Domain, DomainConstraint, MetricBound
# ── Platforms — Ground ──────────────────────────────────────────
@@ -726,6 +726,7 @@ URBAN_COMMUTING = Domain(
MetricBound("availability", weight=0.15, norm_min=0.0, norm_max=1.0, unit="0-1"),
MetricBound("range_fuel", weight=0.10, norm_min=5000, norm_max=500000, unit="m"),
],
constraints=[DomainConstraint("medium", ["ground", "air"])],
)
INTERPLANETARY = Domain(
@@ -738,6 +739,7 @@ INTERPLANETARY = Domain(
MetricBound("cost_efficiency", weight=0.10, norm_min=1.0, norm_max=1e6, unit="$/m", lower_is_better=True),
MetricBound("range_degradation", weight=0.10, norm_min=8640000, norm_max=3.1536e9, unit="s"),
],
constraints=[DomainConstraint("medium", ["space"])],
)
MARITIME_SHIPPING = Domain(
@@ -750,6 +752,7 @@ MARITIME_SHIPPING = Domain(
MetricBound("safety", weight=0.20, norm_min=0.0, norm_max=1.0, unit="0-1"),
MetricBound("range_fuel", weight=0.15, norm_min=100000, norm_max=40000000, unit="m"),
],
constraints=[DomainConstraint("medium", ["water"])],
)
LAST_MILE_DELIVERY = Domain(
@@ -762,6 +765,7 @@ LAST_MILE_DELIVERY = Domain(
MetricBound("safety", weight=0.15, norm_min=0.0, norm_max=1.0, unit="0-1"),
MetricBound("environmental_impact", weight=0.10, norm_min=0, norm_max=5e-4, unit="kg/m", lower_is_better=True),
],
constraints=[DomainConstraint("medium", ["ground", "air"])],
)
CROSS_COUNTRY_FREIGHT = Domain(
@@ -774,6 +778,7 @@ CROSS_COUNTRY_FREIGHT = Domain(
MetricBound("range_fuel", weight=0.20, norm_min=100000, norm_max=5000000, unit="m"),
MetricBound("reliability", weight=0.10, norm_min=0.0, norm_max=1.0, unit="0-1"),
],
constraints=[DomainConstraint("medium", ["ground"])],
)
ALL_DOMAINS = [
@@ -831,5 +836,7 @@ def load_transport_seed(repo) -> dict:
repo.ensure_metric(mb.metric_name, unit=mb.unit)
if mb.lower_is_better:
repo.backfill_lower_is_better(domain.name, mb.metric_name)
# Backfill domain constraints
repo.replace_domain_constraints(domain)
return counts