@@ -29,6 +29,7 @@ def __goal_count_heuristic(self, state):
2929 count += 1
3030 return count
3131
32+
3233class DeleteRelaxationHeuristic :
3334 def __init__ (self , automated_planner , heuristic_key ):
3435 class DRHCache :
@@ -77,10 +78,8 @@ def compute(self, state):
7778 return self .heuristic_keys [self .current_h ](costs )
7879
7980 for ax in self .cache .axioms :
80- fact_costs = (
81- self .automated_planner .pddl .compute_costs_one_step_derivation (
82- facts , fact_costs , ax , self .current_h
83- )
81+ fact_costs = self .automated_planner .pddl .compute_costs_one_step_derivation (
82+ facts , fact_costs , ax , self .current_h
8483 )
8584
8685 actions = self .automated_planner .available_actions (state )
@@ -127,10 +126,7 @@ def __facts_eq(self, facts_dict, facts_set):
127126 return False
128127 return True
129128
130- < << << << HEAD
131- == == == =
132129
133- >> >> >> > b0a6f7114bd56e8d05402ea32199a4ae7bd498bd
134130class CriticalPathHeuristic :
135131 def __init__ (self , automated_planner , critical_path_level = 1 ):
136132 class CPCache :
@@ -143,10 +139,14 @@ def __init__(self, domain=None, axioms=None, preconds=None, additions=None):
143139 self .automated_planner = automated_planner
144140 self .cache = CPCache ()
145141 if critical_path_level > 3 :
146- logging .warning ("Critical Path level is only implemented until 3, forcing it to 3." )
142+ logging .warning (
143+ "Critical Path level is only implemented until 3, forcing it to 3."
144+ )
147145 self .critical_path_level = 3
148146 if critical_path_level < 1 :
149- logging .warning ("Critical Path level has to be at least 1, forcing it to 1." )
147+ logging .warning (
148+ "Critical Path level has to be at least 1, forcing it to 1."
149+ )
150150 self .critical_path_level = 1
151151 else :
152152 self .critical_path_level = critical_path_level
@@ -174,17 +174,6 @@ def compute(self, state):
174174 if str (g ) in fact_costs_str :
175175 costs .append (fact_costs_str [str (g )])
176176 if self .critical_path_level == 2 :
177- < << << << HEAD
178- pairs_of_goals = [(g1 , g2 ) for g1 in goals for g2 in goals if g1 != g2 ]
179- for gs in pairs_of_goals :
180- if str (gs [0 ]) in fact_costs_str and str (gs [1 ]) in fact_costs_str :
181- costs .append (fact_costs_str [str (gs [0 ])] + fact_costs_str [str (gs [1 ])])
182- if self .critical_path_level == 3 :
183- triplets_of_goals = [(g1 , g2 , g3 ) for g1 in goals for g2 in goals for g3 in goals if g1 != g2 and g1 != g3 and g2 != g3 ]
184- for gs in triplets_of_goals :
185- if str (gs [0 ]) in fact_costs_str and str (gs [1 ]) in fact_costs_str and str (gs [2 ]) in fact_costs_str :
186- costs .append (fact_costs_str [str (gs [0 ])] + fact_costs_str [str (gs [1 ])] + fact_costs_str [str (gs [2 ])])
187- == == == =
188177 pairs_of_goals = [
189178 (g1 , g2 ) for g1 in goals for g2 in goals if g1 != g2
190179 ]
@@ -215,15 +204,12 @@ def compute(self, state):
215204 + fact_costs_str [str (gs [1 ])]
216205 + fact_costs_str [str (gs [2 ])]
217206 )
218- > >> >> >> b0a6f7114bd56e8d05402ea32199a4ae7bd498bd
219207 costs .insert (0 , 0 )
220208 return max (costs )
221209
222210 for ax in self .cache .axioms :
223- fact_costs = (
224- self .automated_planner .pddl .compute_costs_one_step_derivation (
225- facts , fact_costs , ax , "max"
226- )
211+ fact_costs = self .automated_planner .pddl .compute_costs_one_step_derivation (
212+ facts , fact_costs , ax , "max"
227213 )
228214
229215 actions = self .automated_planner .available_actions (state )
0 commit comments