Skip to content

Commit

Permalink
Update mutability in Pullup
Browse files Browse the repository at this point in the history
  • Loading branch information
Maumagnaguagno committed Mar 14, 2024
1 parent de98e96 commit b02ade5
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions extensions/Pullup.rb
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,23 @@ def apply(operators, methods, predicates, state, tasks, goal_pos, goal_not, debu
op[2].select! {|pre,| predicates[pre]}
op[3].select! {|pre,| predicates[pre]}
}
# Update mutability
new_predicates = {}
operators.each {|_,_,precond_pos,precond_not,effect_add,effect_del|
precond_pos.each {|pre,| new_predicates[pre.freeze] ||= false}
precond_not.each {|pre,| new_predicates[pre.freeze] ||= false}
effect_add.each {|pre,| new_predicates[pre.freeze] = true}
effect_del.each {|pre,| new_predicates[pre.freeze] = true}
}
methods.each {|decompositions|
decompositions.drop(2).each {|m|
m[2].each {|pre,| new_predicates[pre.freeze] ||= false}
m[3].each {|pre,| new_predicates[pre.freeze] ||= false}
}
}
goal_pos.each {|pre,| new_predicates[pre.freeze] ||= false}
goal_not.each {|pre,| new_predicates[pre.freeze] ||= false}
predicates.replace(new_predicates)
tasks.unshift(ordered) unless tasks.empty?
end

Expand Down

0 comments on commit b02ade5

Please sign in to comment.