scoring: 10x agent counts, linker-heavy allocation, interleaved ordering
Rebalance consolidation scoring to be linker-heavy: - 50 replay + 100 linker for extreme hub dominance (was 10+5) - High gini now adds linker instead of replay - Agent runs interleave types round-robin (linker, replay, linker...) instead of running all of one type then all of another Co-Authored-By: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
510f448f10
commit
c8da74f0ce
1 changed files with 37 additions and 15 deletions
|
|
@ -181,18 +181,36 @@ impl ConsolidationPlan {
|
|||
if self.run_health {
|
||||
runs.push(("health", 0));
|
||||
}
|
||||
for (name, count) in [
|
||||
("replay", self.replay_count),
|
||||
// Build per-type batch lists, then interleave so different agent
|
||||
// types alternate rather than running all-replay-then-all-linker.
|
||||
let types: [(&str, usize); 4] = [
|
||||
("linker", self.linker_count),
|
||||
("replay", self.replay_count),
|
||||
("separator", self.separator_count),
|
||||
("transfer", self.transfer_count),
|
||||
] {
|
||||
let mut remaining = count;
|
||||
];
|
||||
let mut queues: Vec<Vec<(&str, usize)>> = types.iter().map(|(name, count)| {
|
||||
let mut q = Vec::new();
|
||||
let mut remaining = *count;
|
||||
while remaining > 0 {
|
||||
let batch = remaining.min(batch_size);
|
||||
runs.push((name, batch));
|
||||
q.push((*name, batch));
|
||||
remaining -= batch;
|
||||
}
|
||||
q
|
||||
}).collect();
|
||||
|
||||
// Round-robin interleave
|
||||
loop {
|
||||
let mut added = false;
|
||||
for q in &mut queues {
|
||||
if let Some(run) = q.first() {
|
||||
runs.push(*run);
|
||||
q.remove(0);
|
||||
added = true;
|
||||
}
|
||||
}
|
||||
if !added { break; }
|
||||
}
|
||||
runs
|
||||
}
|
||||
|
|
@ -239,28 +257,32 @@ fn consolidation_plan_inner(store: &Store, detect_interf: bool) -> Consolidation
|
|||
|
||||
// Target: α ≥ 2.5 (healthy scale-free)
|
||||
if alpha < 2.0 {
|
||||
plan.replay_count += 10;
|
||||
plan.linker_count += 5;
|
||||
plan.replay_count += 50;
|
||||
plan.linker_count += 100;
|
||||
plan.rationale.push(format!(
|
||||
"α={:.2} (target ≥2.5): extreme hub dominance → 10 replay + 5 linker",
|
||||
"α={:.2} (target ≥2.5): extreme hub dominance → 50 replay + 100 linker",
|
||||
alpha));
|
||||
} else if alpha < 2.5 {
|
||||
plan.replay_count += 5;
|
||||
plan.linker_count += 3;
|
||||
plan.replay_count += 25;
|
||||
plan.linker_count += 50;
|
||||
plan.rationale.push(format!(
|
||||
"α={:.2} (target ≥2.5): moderate hub dominance → 5 replay + 3 linker",
|
||||
"α={:.2} (target ≥2.5): moderate hub dominance → 25 replay + 50 linker",
|
||||
alpha));
|
||||
} else {
|
||||
plan.replay_count += 3;
|
||||
plan.replay_count += 10;
|
||||
plan.linker_count += 20;
|
||||
plan.rationale.push(format!(
|
||||
"α={:.2}: healthy — 3 replay for maintenance", alpha));
|
||||
"α={:.2}: healthy — 10 replay + 20 linker for maintenance", alpha));
|
||||
}
|
||||
|
||||
// Target: Gini ≤ 0.4
|
||||
// High Gini means degree inequality — most nodes under-connected.
|
||||
// Linker fixes this by adding edges to low-degree nodes.
|
||||
if gini > 0.5 {
|
||||
plan.replay_count += 3;
|
||||
plan.replay_count += 10;
|
||||
plan.linker_count += 50;
|
||||
plan.rationale.push(format!(
|
||||
"Gini={:.3} (target ≤0.4): high inequality → +3 replay",
|
||||
"Gini={:.3} (target ≤0.4): high inequality → +10 replay + 50 linker",
|
||||
gini));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue