Skip to content

Commit

Permalink
Detect rigid goals in Wise
Browse files Browse the repository at this point in the history
  • Loading branch information
Maumagnaguagno committed Aug 26, 2024
1 parent 275f9da commit 7cb904b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions extensions/Wise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,20 @@ def apply(operators, methods, predicates, state, tasks, goal_pos, goal_not, debu
raise 'Goal contains free variable' if (goal_pos + goal_not).flatten(1).any? {|t| t.start_with?('?')}
puts "Goal contains duplicate positive condition: removed" if goal_pos.uniq! and debug
puts "Goal contains duplicate negative condition: removed" if goal_not.uniq! and debug
goal_pos.reject! {|pre|
unless predicates[pre[0]]
raise "Goal contains impossible positive condition (#{pre.join(' ')})" unless state[pre[0]].include?(pre.drop(1))
puts "Goal contains unnecessary positive condition (#{pre.join(' ')})" if debug
true
end
}
goal_not.reject! {|pre|
unless predicates[pre[0]]
raise "Goal contains impossible negative condition (#{pre.join(' ')})" if state[pre[0]].include?(pre.drop(1))
puts "Goal contains unnecessary negative condition (#{pre.join(' ')})" if debug
true
end
}
(goal_pos & goal_not).each {|pre| raise "Goal contains contradiction (#{pre.join(' ')}) and (not (#{pre.join(' ')}))"}
end

Expand Down

0 comments on commit 7cb904b

Please sign in to comment.