@@ -118,7 +118,7 @@ def problem(state, tasks, debug = false, max_plans = -1, min_prob = 0, ordered =
118
118
print_data ( tasks )
119
119
puts 'Planning' . center ( 50 , '-' )
120
120
t = Time . now . to_f
121
- ordered ? planning ( tasks ) : task_permutations ( state , tasks )
121
+ ordered ? planning ( tasks ) : task_permutations ( state , tasks , ( tasks . pop if tasks [ - 1 ] &.[] ( 0 ) == 'invisible_goal' ) )
122
122
puts "Time: #{ Time . now . to_f - t } s" , "Plans found: #{ @plans . size } "
123
123
if @plans . each_with_index { |( probability , valuation , *plan ) , i |
124
124
puts "Plan #{ i . succ } " . center ( 50 , '-' ) ,
@@ -143,10 +143,12 @@ def problem(state, tasks, debug = false, max_plans = -1, min_prob = 0, ordered =
143
143
# Task permutations
144
144
#-----------------------------------------------
145
145
146
- def task_permutations ( state , tasks )
146
+ def task_permutations ( state , tasks , goal_task = nil )
147
147
# All permutations are considered
148
148
tasks . permutation { |task_list |
149
- planning ( Marshal . load ( Marshal . dump ( task_list ) ) )
149
+ task_list = Marshal . load ( Marshal . dump ( task_list ) )
150
+ task_list << goal_task if goal_task
151
+ planning ( task_list )
150
152
return if @plans . size == @max_plans
151
153
@state = state
152
154
}
0 commit comments