43 lines
1.6 KiB
Python
43 lines
1.6 KiB
Python
"""One curated, deterministic composition policy; all times are quarter-note beats."""
|
|
from __future__ import annotations
|
|
|
|
import dataclasses
|
|
import hashlib
|
|
import json
|
|
|
|
@dataclasses.dataclass(frozen=True)
|
|
class Policy:
|
|
acoustic_activity: float = 1.125
|
|
electric_activity: float = 1.375
|
|
active_occupancy: float = 0.75
|
|
arrival_occupancy: float = 0.9
|
|
weights: tuple[tuple[str, float], ...] = (('activity', 4), ('occupancy', 4), ('fidelity', 3), ('landmarks', 3), ('register', 1), ('contour', 1), ('connection', 1), ('repetition', 1), ('movement', 0.5), ('harmonic_exposure', 2), ('draft_preservation', 3), ('development', 2), ('direction', 1), ('join_coherence', 2), ('ending_integration', 2))
|
|
beam_width: int = 64
|
|
extensions: int = 32
|
|
retrieval: int = 32
|
|
alternatives: int = 4
|
|
long_note: float = 2.0
|
|
stopping_note: float = 1.0
|
|
suspension_preparation: float = 0.5
|
|
suspension_resolution: float = 1.0
|
|
replan_attempts: int = 2
|
|
anchor_lines: int = 8
|
|
draft_frontier: int = 16
|
|
phrase_alternatives: int = 8
|
|
join_alternatives: int = 8
|
|
revision_sweeps: int = 2
|
|
join_window: float = 2.0
|
|
|
|
# Preserve the former default root seeds while decoupling them from policy edits.
|
|
SEED_NAMESPACE = 'a85abb240d7cfa9d054375b654bcb5c23c746201fd4aed7acf81cb3f4ee720e1'
|
|
|
|
DEFAULT = Policy()
|
|
|
|
def describe():
|
|
values = dataclasses.asdict(DEFAULT)
|
|
identity = hashlib.sha256(json.dumps(values, sort_keys=True).encode()).hexdigest()
|
|
return {'fingerprint': identity, 'seed_namespace': SEED_NAMESPACE, 'parameters': values}
|
|
|
|
def stable_rank(seed, value):
|
|
return hashlib.sha256((seed + repr(value)).encode()).hexdigest()
|