summaryrefslogtreecommitdiff
path: root/src/LivingVillage.Kernel
diff options
context:
space:
mode:
authorSomhairle H. Marisol <[email protected]>2026-09-19 18:47:24 +0800
committerSomhairle H. Marisol <[email protected]>2026-09-19 18:47:24 +0800
commitab0cdf47f453bf3e12df0201cd7bd1835fb03cae (patch)
treec0b755429ead73c9177d0704c109e3aa71b59ce4 /src/LivingVillage.Kernel
parentc1242ee391a25d5e5664befb5efe84b3e471ffd2 (diff)
downloadliving-village-ab0cdf47f453bf3e12df0201cd7bd1835fb03cae.tar.gz
fix: M3c 关系半衰期单位错误 86400L(=24模拟分钟)→ticksPerDay(1模拟日=5,184,000tick) + 衰减改真半衰 exp(-ln2*age/halfLife)(age=halfLife 处权重恰0.5, 旧式 exp(-age/halfLife) 为 e^-1≈0.368) + 单测锁定(1天=5184000tick/halfLife=1天/半衰权重0.5, 手算期望随真半衰语义更新) + headless 批验新增旧判据 old_crit 观测报告(60% 覆盖判据保留为门)
Diffstat (limited to 'src/LivingVillage.Kernel')
-rw-r--r--src/LivingVillage.Kernel/Sim.fs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/LivingVillage.Kernel/Sim.fs b/src/LivingVillage.Kernel/Sim.fs
index ebc435e..33f2b57 100644
--- a/src/LivingVillage.Kernel/Sim.fs
+++ b/src/LivingVillage.Kernel/Sim.fs
@@ -120,7 +120,7 @@ module Sim =
let chatValence = 0.3f
// 关系网派生(纯函数;仅在 dump/视图打开时调用,不进 step 热路径)
- let relationHalfLifeTicks = 86400L // HALF_LIFE = 1 天(86400 tick)
+ let relationHalfLifeTicks = ticksPerDay // HALF_LIFE = 1 模拟日(修复单位错误:原 86400L 实为 24 模拟分钟;1 模拟日 = ticksPerDay = 5,184,000 tick)
let relationThreshold = 0.5f // |rel| > 0.5 视为有关系
let clamp (v: float32) (lo: float32) (hi: float32) : float32 = if v < lo then lo elif v > hi then hi else v
@@ -434,11 +434,11 @@ module Sim =
Npcs = newNpcs
Events = [] }
- // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-(now-tick)/HALF_LIFE)) ----
+ // ---- 关系网派生:rel(i,j) = sum(Chatted valence * exp(-ln2*(now-tick)/HALF_LIFE))(真半衰:age=HALF_LIFE 处权重恰 0.5)----
let relationDecayWeight (nowTick: int64) (eventTick: int64) : float32 =
let age = float (nowTick - eventTick)
- float32 (exp (-age / float relationHalfLifeTicks))
+ float32 (exp (-(log 2.0) * age / float relationHalfLifeTicks))
// 30x30 对称矩阵(对角线 0):双向累加双方 Chatted 记忆的衰减 valence
let relationMatrix (world: World) : float32[,] =