Commit Graph

4 Commits

Author SHA1 Message Date
27d7e28236 fix: 训练编排器 — V训练从头开始 + ONNX外部数据文件复制 2026-07-13 08:14:05 +08:00
e5e1f4818e fix: V-learning 出牌率 0%→81% — MakePlay Type=None导致所有候选被当pass
根因: MakePlay(Type=CardType1.None)
  → play.Type==None 对所有候选为true
  → afterHand保持原样(未出牌)
  → 所有候选V值相同 → 始终选第一个(pass)

修复:
- play.Type→play.Ids.Length判断是否真pass
- EncodeAfterPlay更新ShenYuCard(出牌后剩余-1)
- EncodeAfterPlay设MaxPlayCard为出的牌
- isPass用Ids==null而非Type

效果: Play 117 Pass 28(81%出牌) vs ISMCTS -108/10局
2026-07-13 03:03:36 +08:00
f43e47b0a6 feat: V-learning架构 — 改Q→V
Q-learning问题: pass action Q值稳定偏高 → 永远pass
V-learning修复:
- 网络输出 14(Q-action)→1(V-state): P(win|state)
- NeuralBot: 对每个候选编码出牌后state → 选V值最高的
- pass和出牌都是候选, 公平竞争(不是固定action slot)

TrainingCollector:
- 新增 EncodeAfterPlay(view, tracker, afterHand, playedIds)
- EncodeState 支持 extraSeen 参数(模拟出牌时标记已见)

Python:
- train_v.py: V-learning训练器(load CSV→predict win/loss)
- network.py: OUTPUT_DIM=14→1

验证: 200局0错误, V-model loss 0.81→0.0001
需更多数据覆盖状态空间
2026-07-13 02:52:48 +08:00
89743cd511 feat: NeuralBot — ONNX模型驱动的Bot + 混合Bot训练架构
NeuralBot.cs:
- 加载ONNX模型,状态编码与Python trainer完全一致(13rank×4suit×7ch=364)
- ε-greedy探索(10%) + ONNX推理选Q值最高动作
- 多牌候选: 对子/三带二(优先带对子)/顺子/炸弹

PdkGameMain:
- BotTypes静态配置: ["NEURAL","NEURAL","ISMCTS"] = 2模型+1ISMCTS
- --mix参数: dotnet run -- --mix 100

hjha-console:
- --mix参数自动设置BotTypes并转调--stress

验证: 3局0错误, 1.3s/局, NeuralBot出牌正常
2026-07-13 02:20:44 +08:00