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出牌正常
This commit is contained in:
2026-07-13 02:20:44 +08:00
parent 68e8c038f4
commit 89743cd511
16 changed files with 621 additions and 101 deletions

View File

@ -13,6 +13,8 @@
"GlobalSever": "1.0.0",
"MessagePack.Annotations": "3.1.4",
"Microsoft.Bcl.AsyncInterfaces": "9.0.0",
"Microsoft.ML.OnnxRuntime": "1.27.1",
"Microsoft.ML.OnnxRuntime.Managed": "1.27.1",
"Microsoft.NET.StringTools": "17.11.4",
"MrWu": "1.0.0",
"NetWorkMessage": "1.0.0",
@ -195,6 +197,99 @@
}
}
},
"Microsoft.ML.OnnxRuntime/1.27.1": {
"dependencies": {
"Microsoft.ML.OnnxRuntime.Managed": "1.27.1"
},
"runtimeTargets": {
"runtimes/android/native/onnxruntime.aar": {
"rid": "android",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/ios/native/onnxruntime.xcframework.zip": {
"rid": "ios",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-arm64/native/libonnxruntime.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-arm64/native/libonnxruntime_providers_shared.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/libonnxruntime.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/libonnxruntime_providers_shared.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/osx-arm64/native/libonnxruntime.dylib": {
"rid": "osx-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime.lib": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime_providers_shared.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime_providers_shared.lib": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime.lib": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime_providers_shared.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime_providers_shared.lib": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"Microsoft.ML.OnnxRuntime.Managed/1.27.1": {
"dependencies": {
"System.Numerics.Tensors": "9.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.ML.OnnxRuntime.dll": {
"assemblyVersion": "1.27.1.0",
"fileVersion": "1.27.1.0"
}
}
},
"Microsoft.NET.StringTools/17.11.4": {
"runtime": {
"lib/net8.0/Microsoft.NET.StringTools.dll": {
@ -222,6 +317,14 @@
}
}
},
"System.Numerics.Tensors/9.0.0": {
"runtime": {
"lib/net9.0/System.Numerics.Tensors.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.24.52809"
}
}
},
"Tea/1.1.3": {
"dependencies": {
"Newtonsoft.Json": "13.0.4"
@ -571,6 +674,20 @@
"path": "microsoft.bcl.asyncinterfaces/9.0.0",
"hashPath": "microsoft.bcl.asyncinterfaces.9.0.0.nupkg.sha512"
},
"Microsoft.ML.OnnxRuntime/1.27.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lVD57zo77erw9oLC2obkKkMOM+CqbtwZuztfXQxEy3oJBOWmDKweto+c+N/Mh/FUoVRRFfsR9KaMX+aM+XLh+Q==",
"path": "microsoft.ml.onnxruntime/1.27.1",
"hashPath": "microsoft.ml.onnxruntime.1.27.1.nupkg.sha512"
},
"Microsoft.ML.OnnxRuntime.Managed/1.27.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7vZTjZzuSP6XC47lbRN0xI9+6YDOChxKjmUmb80q7YC8Nb7zQUVrETFGLXlFfYWjvlb8/4J+w+L33gBTCpLMKA==",
"path": "microsoft.ml.onnxruntime.managed/1.27.1",
"hashPath": "microsoft.ml.onnxruntime.managed.1.27.1.nupkg.sha512"
},
"Microsoft.NET.StringTools/17.11.4": {
"type": "package",
"serviceable": true,
@ -592,6 +709,13 @@
"path": "newtonsoft.json.bson/1.0.1",
"hashPath": "newtonsoft.json.bson.1.0.1.nupkg.sha512"
},
"System.Numerics.Tensors/9.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-hyJB4UlpAi19Xr9AXzu2NuagKC4lPfHObNMEAA0HmqFz2rX7wKgzeYzO/jM/eBHDhnUGFFEjk5cOoJaxqg5J4A==",
"path": "system.numerics.tensors/9.0.0",
"hashPath": "system.numerics.tensors.9.0.0.nupkg.sha512"
},
"Tea/1.1.3": {
"type": "package",
"serviceable": true,

View File

@ -409,6 +409,12 @@
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.JavaScript" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

Binary file not shown.

View File

@ -409,6 +409,12 @@
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices.JavaScript" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-10.0.0.0" newVersion="10.0.0.0" />
</dependentAssembly>
</assemblyBinding>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.InteropServices" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />

Binary file not shown.

View File

@ -191,6 +191,99 @@
}
}
},
"Microsoft.ML.OnnxRuntime/1.27.1": {
"dependencies": {
"Microsoft.ML.OnnxRuntime.Managed": "1.27.1"
},
"runtimeTargets": {
"runtimes/android/native/onnxruntime.aar": {
"rid": "android",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/ios/native/onnxruntime.xcframework.zip": {
"rid": "ios",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-arm64/native/libonnxruntime.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-arm64/native/libonnxruntime_providers_shared.so": {
"rid": "linux-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/libonnxruntime.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/linux-x64/native/libonnxruntime_providers_shared.so": {
"rid": "linux-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/osx-arm64/native/libonnxruntime.dylib": {
"rid": "osx-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime.lib": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime_providers_shared.dll": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-arm64/native/onnxruntime_providers_shared.lib": {
"rid": "win-arm64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime.lib": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime_providers_shared.dll": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
},
"runtimes/win-x64/native/onnxruntime_providers_shared.lib": {
"rid": "win-x64",
"assetType": "native",
"fileVersion": "0.0.0.0"
}
}
},
"Microsoft.ML.OnnxRuntime.Managed/1.27.1": {
"dependencies": {
"System.Numerics.Tensors": "9.0.0"
},
"runtime": {
"lib/net8.0/Microsoft.ML.OnnxRuntime.dll": {
"assemblyVersion": "1.27.1.0",
"fileVersion": "1.27.1.0"
}
}
},
"Microsoft.NET.StringTools/17.11.4": {
"runtime": {
"lib/net8.0/Microsoft.NET.StringTools.dll": {
@ -218,6 +311,14 @@
}
}
},
"System.Numerics.Tensors/9.0.0": {
"runtime": {
"lib/net9.0/System.Numerics.Tensors.dll": {
"assemblyVersion": "9.0.0.0",
"fileVersion": "9.0.24.52809"
}
}
},
"Tea/1.1.3": {
"dependencies": {
"Newtonsoft.Json": "13.0.4"
@ -380,6 +481,8 @@
"GlobalSever": "1.0.0",
"MessagePack.Annotations": "3.1.4",
"Microsoft.Bcl.AsyncInterfaces": "9.0.0",
"Microsoft.ML.OnnxRuntime": "1.27.1",
"Microsoft.ML.OnnxRuntime.Managed": "1.27.1",
"Microsoft.NET.StringTools": "17.11.4",
"MrWu": "1.0.0",
"NetWorkMessage": "1.0.0",
@ -588,6 +691,20 @@
"path": "microsoft.bcl.asyncinterfaces/9.0.0",
"hashPath": "microsoft.bcl.asyncinterfaces.9.0.0.nupkg.sha512"
},
"Microsoft.ML.OnnxRuntime/1.27.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-lVD57zo77erw9oLC2obkKkMOM+CqbtwZuztfXQxEy3oJBOWmDKweto+c+N/Mh/FUoVRRFfsR9KaMX+aM+XLh+Q==",
"path": "microsoft.ml.onnxruntime/1.27.1",
"hashPath": "microsoft.ml.onnxruntime.1.27.1.nupkg.sha512"
},
"Microsoft.ML.OnnxRuntime.Managed/1.27.1": {
"type": "package",
"serviceable": true,
"sha512": "sha512-7vZTjZzuSP6XC47lbRN0xI9+6YDOChxKjmUmb80q7YC8Nb7zQUVrETFGLXlFfYWjvlb8/4J+w+L33gBTCpLMKA==",
"path": "microsoft.ml.onnxruntime.managed/1.27.1",
"hashPath": "microsoft.ml.onnxruntime.managed.1.27.1.nupkg.sha512"
},
"Microsoft.NET.StringTools/17.11.4": {
"type": "package",
"serviceable": true,
@ -609,6 +726,13 @@
"path": "newtonsoft.json.bson/1.0.1",
"hashPath": "newtonsoft.json.bson.1.0.1.nupkg.sha512"
},
"System.Numerics.Tensors/9.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-hyJB4UlpAi19Xr9AXzu2NuagKC4lPfHObNMEAA0HmqFz2rX7wKgzeYzO/jM/eBHDhnUGFFEjk5cOoJaxqg5J4A==",
"path": "system.numerics.tensors/9.0.0",
"hashPath": "system.numerics.tensors.9.0.0.nupkg.sha512"
},
"Tea/1.1.3": {
"type": "package",
"serviceable": true,

Binary file not shown.

Binary file not shown.