Skip to content

Commit ba8a93c

Browse files
Actualizar knu_token_distribution.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent fb647b7 commit ba8a93c

File tree

1 file changed

+23
-12
lines changed

1 file changed

+23
-12
lines changed

scripts/knu_token_distribution.py

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -229,28 +229,39 @@ def calculate_spillover(self, knu: KNURewardEntry,
229229
"""
230230
Calculate spillover impact S_i for a KNU entry.
231231
232-
Formula: S_i = Σ(a_k→j · ΔR_j,i) for adjacent KNOTs
232+
Conceptual formula:
233+
S_i = Σ(a_k→j · ΔR_j,i) for adjacent KNOTs
234+
235+
In this implementation, the spillover term is expected to be
236+
pre-computed externally (including adjacency weights a_k→j) and
237+
provided via ``knu.dR_adj_sum``:
238+
239+
knu.dR_adj_sum ≡ Σ(a_k→j · ΔR_j,i)
240+
241+
The ``adjacency_graph`` parameter is accepted for backwards and
242+
forwards compatibility but is not currently used inside this
243+
method. It allows future versions to derive ``dR_adj_sum`` from
244+
the graph if needed without changing the public API.
233245
234246
Args:
235-
knu: KNU reward entry
236-
adjacency_graph: Override adjacency graph (default: use config)
247+
knu: KNU reward entry, with ``dR_adj_sum`` already including
248+
adjacency weights (Σ(a_k→j · ΔR_j,i)).
249+
adjacency_graph: Optional adjacency graph (currently unused in
250+
this calculation; kept for API compatibility).
237251
238252
Returns:
239-
Spillover impact value
253+
Spillover impact value (pre-weighted sum from ``knu.dR_adj_sum``).
240254
"""
241-
if adjacency_graph is None:
242-
adjacency_graph = self.adjacency_graph
243-
244-
# Get adjacent KNOTs from adjacency graph
245-
adjacent_knots = adjacency_graph.get(knu.knot_id, {})
255+
# Mark adjacency_graph as intentionally unused for now while keeping
256+
# the parameter for API compatibility and potential future use.
257+
_ = adjacency_graph
246258

247259
# If no dR_adj_sum provided, spillover is 0
248260
if knu.dR_adj_sum == 0.0:
249261
return 0.0
250262

251-
# Spillover is the sum of adjacent residue reductions
252-
# In practice, dR_adj_sum should be pre-calculated as Σ(a_k→j · ΔR_j,i)
253-
# For simplicity, we use dR_adj_sum directly as it represents the weighted sum
263+
# Spillover is provided as the pre-weighted sum of adjacent residue
264+
# reductions: knu.dR_adj_sum ≡ Σ(a_k→j · ΔR_j,i)
254265
return knu.dR_adj_sum
255266

256267
def validate_eligibility(self, knu: KNURewardEntry) -> Tuple[bool, str]:

0 commit comments

Comments
 (0)