From 2c3b35cce1911e175d1ec61ff81e0cb0e1c607c3 Mon Sep 17 00:00:00 2001
From: Funny-ppt <1763341376@qq.com>
Date: Sat, 23 Mar 2024 17:27:04 +0800
Subject: [PATCH] =?UTF-8?q?=E6=9E=9A=E4=B8=BE=E6=80=A7=E8=83=BD=E4=BC=98?=
=?UTF-8?q?=E5=8C=96?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
InfrastSim/TimeDriven/Enumerate/EnumerateContext.cs | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/InfrastSim/TimeDriven/Enumerate/EnumerateContext.cs b/InfrastSim/TimeDriven/Enumerate/EnumerateContext.cs
index c211362..6a2d2d1 100644
--- a/InfrastSim/TimeDriven/Enumerate/EnumerateContext.cs
+++ b/InfrastSim/TimeDriven/Enumerate/EnumerateContext.cs
@@ -144,14 +144,14 @@ public Frame(OpEnumData[] comb, Efficiency base_eff, int ucnt) {
uset[op.uid] = true;
}
}
- public Frame FromComb(OpEnumData[] new_comb, Efficiency base_eff) {
+ public Frame FromComb(OpEnumData[] new_comb, Efficiency base_eff, int gid) {
var op = new_comb[^1];
BitArray new_uset = new(uset);
new_uset[op.uid] = true;
return new Frame {
comb = new_comb,
base_eff = base_eff,
- gid = new_comb.Length << 24 | (gid & 0xffffff) * op.prime % MOD,
+ gid = gid,
init_size = init_size,
uset = new_uset
};
@@ -185,11 +185,12 @@ IEnumerable ProcessFrame(Simulator simu, Frame frame) {
foreach (var op in ops) {
if (frame.uset[op.uid]) continue; // 处理干员表中有同一干员的不同位置
- OpEnumData[] next_comb = [.. frame.comb, op];
- var gid = GetGroupId(next_comb);
+ var gid = (frame.comb.Length + 1 << 24) | (frame.gid & 0xffffff) * op.prime % MOD;
if (!results.TryAdd(gid, default)) {
continue;
}
+
+ OpEnumData[] next_comb = [.. frame.comb, op];
Efficiency eff;
try { // 检验组合是否能被基建容纳,如果可以,则计算其效率
eff = TestMany(simu, next_comb);
@@ -208,7 +209,7 @@ IEnumerable ProcessFrame(Simulator simu, Frame frame) {
tot_extra_eff -= opd.SingleEfficiency;
}
results[gid] = new(next_comb, frame.init_size, eff, tot_extra_eff);
- if (next_comb.Length < max_size) yield return frame.FromComb(next_comb, eff);
+ if (next_comb.Length < max_size) yield return frame.FromComb(next_comb, eff, gid);
}
}
}