feat(routing): 高峰时段动态权重 speed→reliability / time-of-day dynamic ranking (#760) - #909
Open
suantea wants to merge 2 commits into
Open
feat(routing): 高峰时段动态权重 speed→reliability / time-of-day dynamic ranking (#760)#909suantea wants to merge 2 commits into
suantea wants to merge 2 commits into
Conversation
…during peak hours (tashfeenahmed#760) New timeOfDayWeights() in scoring.ts: during local peak hours (18:00–06:00) when free relays are congested, move 60% of the speed weight onto reliability for bandit strategies (balanced → {0.65, 0.1, 0.25}); off-peak and priority/custom strategies are unchanged. Applied in router's weightsFor() so every bandit scoring path (routing + dashboard display) sees the same adjustment. 5 new tests cover peak/off-peak boundaries, weight conservation and non-negative speed across all presets.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
中文
实现 #843/#760 中的 dynamic ranking(timeOfDayWeights) 切片:
scoring.ts新增timeOfDayWeights():本地高峰时段(18:00–06:00,免费中继拥塞期)把 speed 权重的 60% 转移到 reliability(如 balanced 0.5/0.25/0.25 → 高峰 0.65/0.1/0.25);非高峰行为不变。新增isPeakHours()与可配置常量PEAK_START_HOUR/PEAK_END_HOUR/PEAK_SPEED_TO_RELIABILITY。router.ts的weightsFor()对 bandit 预设应用该调整;priority/custom(操作者显式选择)保持不变;dashboard 显示与路由评分走同一路径。scoring.test.ts新增):高峰/非高峰边界、权重守恒、intelligence 不受影响、各预设 speed 权重不为负、默认取当前时间。验证:server
tsc -b通过(仅 sharp 缺失的既有报错);vitest scoring 33/33 + match-tier-routing 4/4。English
Implements the dynamic ranking (
timeOfDayWeights) slice of #843/#760:timeOfDayWeights()inscoring.ts: during local peak hours (18:00–06:00, when free relays are congested) moves 60% of the speed weight onto reliability (e.g. balanced 0.5/0.25/0.25 → peak 0.65/0.1/0.25); off-peak unchanged. AddsisPeakHours()and tunablePEAK_START_HOUR/PEAK_END_HOUR/PEAK_SPEED_TO_RELIABILITYconstants.weightsFor()inrouter.tsapplies the adjustment to bandit presets only; priority/custom (operator's explicit choice) are returned untouched; dashboard display and route scoring share the same path.scoring.test.ts: peak/off-peak boundaries, weight conservation, intelligence untouched, non-negative speed across all presets, default wall-clock time.Verification: server
tsc -bpasses (only the pre-existing sharp-missing error); vitest scoring 33/33 + match-tier-routing 4/4.Closes #760