mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 14:01:37 +00:00
feat: implement optimal assignment using Hungarian algorithm in matching process
- Added a new function for minimum-cost bipartite matching via the Hungarian algorithm to improve the efficiency of the matching process. - Refactored existing matching logic to utilize the new algorithm, replacing the previous greedy assignment approach. - Updated relevant documentation to reflect changes in the matching strategy. - Enhanced performance in ambiguous group matching scenarios.
This commit is contained in:
parent
43ede3bc0e
commit
d26f82b4f2
6 changed files with 414 additions and 151 deletions
|
|
@ -235,7 +235,23 @@ pub fn syncback_dir_no_meta<'sync>(
|
|||
})
|
||||
.collect();
|
||||
|
||||
// Run the 3-pass matching algorithm to pair new ↔ old children.
|
||||
// In debug builds, shuffle children to catch order-dependent matching bugs.
|
||||
#[cfg(debug_assertions)]
|
||||
let eligible_new = {
|
||||
use rand::seq::SliceRandom;
|
||||
let mut v = eligible_new;
|
||||
v.shuffle(&mut rand::rng());
|
||||
v
|
||||
};
|
||||
#[cfg(debug_assertions)]
|
||||
let eligible_old = {
|
||||
use rand::seq::SliceRandom;
|
||||
let mut v = eligible_old;
|
||||
v.shuffle(&mut rand::rng());
|
||||
v
|
||||
};
|
||||
|
||||
// Run the matching algorithm to pair new ↔ old children.
|
||||
let matching_session = crate::syncback::matching::MatchingSession::new();
|
||||
let match_result = match_children(
|
||||
&eligible_new,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue