mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-10-23 05:51:39 +00:00
fix: push pad-cost row for None snapshots in match_forward
This commit is contained in:
parent
372e6bc739
commit
b3732acae5
1 changed files with 6 additions and 7 deletions
|
|
@ -160,11 +160,15 @@ pub fn match_forward(
|
||||||
|
|
||||||
let m = avail_snap.len();
|
let m = avail_snap.len();
|
||||||
let n = avail_tree.len();
|
let n = avail_tree.len();
|
||||||
|
let pad = UNMATCHED_PENALTY.saturating_mul(2);
|
||||||
let mut cost_matrix = Vec::with_capacity(m);
|
let mut cost_matrix = Vec::with_capacity(m);
|
||||||
for &si in &avail_snap {
|
for &si in &avail_snap {
|
||||||
let snap = match &snap_available[si] {
|
let snap = match &snap_available[si] {
|
||||||
Some(s) => s,
|
Some(s) => s,
|
||||||
None => continue,
|
None => {
|
||||||
|
cost_matrix.push(vec![pad; n]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
let mut row = Vec::with_capacity(n);
|
let mut row = Vec::with_capacity(n);
|
||||||
for &ti in &avail_tree {
|
for &ti in &avail_tree {
|
||||||
|
|
@ -175,12 +179,7 @@ pub fn match_forward(
|
||||||
cost_matrix.push(row);
|
cost_matrix.push(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
let assignment = crate::hungarian::min_cost_assignment(
|
let assignment = crate::hungarian::min_cost_assignment(&cost_matrix, m, n, pad);
|
||||||
&cost_matrix,
|
|
||||||
m,
|
|
||||||
n,
|
|
||||||
UNMATCHED_PENALTY.saturating_mul(2),
|
|
||||||
);
|
|
||||||
for (row, col) in assignment {
|
for (row, col) in assignment {
|
||||||
let si = avail_snap[row];
|
let si = avail_snap[row];
|
||||||
let ti = avail_tree[col];
|
let ti = avail_tree[col];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue