Skip to content

Commit

Permalink
Check for non-ignored children instead of all of them
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex-Fischman committed Apr 14, 2024
1 parent 799360b commit 095fea5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion dag_in_context/src/greedy_dag_extractor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,15 @@ pub fn extract(
continue;
}

if node.children.iter().all(|c| costs.contains_key(n2c(c))) {
let ignored_children = cm.ignored_children(&node.op);
let all_non_ignored_children_have_costs = node
.children
.iter()
.enumerate()
.filter(|(i, _c)| !ignored_children.contains(i))
.all(|(_i, c)| costs.contains_key(n2c(c)));

if all_non_ignored_children_have_costs {
let prev_cost = match costs.get(class_id) {
Some(cost_set) => cost_set.total,
None => std::f64::INFINITY.try_into().unwrap(),
Expand Down

0 comments on commit 095fea5

Please sign in to comment.