@@ -51,25 +51,33 @@ def __init__(self, domain=None, axioms=None, preconds=None, additions=None):
5151 self .__pre_compute ()
5252 # return self.heuristic_keys[self.current_h](state)
5353
54- def compute (self , state , goals ):
54+ def compute (self , state ):
5555 if not self .has_been_precomputed :
5656 self .__pre_compute ()
5757 domain = self .cache .domain
5858 goals = self .automated_planner .goals
5959 types = state .types
6060 facts = state .facts
6161
62- fact_costs = dict ([(f , 0 ) for f in facts ])
63- while not (len (fact_costs ) == len (facts ) and self .__facts_eq (fact_costs , facts )):
64- facts_set = self .automated_planner .pddl .Set (self .automated_planner .pddl .keys (fact_costs ))
65- state = self .automated_planner .pddl .create_state (types , facts_set )
62+ fact_costs = self .automated_planner .pddl .init_facts_costs (facts )
63+ while not (len (fact_costs ) == self .automated_planner .pddl .length (facts ) and self .__facts_eq (fact_costs , facts )):
64+ facts , state = self .automated_planner .pddl .get_facts_and_state (fact_costs , types )
6665 if self .automated_planner .satisfies (goals , state ):
6766 costs = [fact_costs [g ] for g in goals ]
6867 costs .insert (0 , 0 )
6968 return self .heuristic_keys [self .current_h ](costs )
7069
7170 for ax in self .cache .axioms :
72- pass
71+ fact_costs = self .automated_planner .pddl .compute_costs_one_step_derivatiion (
72+ facts , fact_costs , ax , self .current_h
73+ )
74+
75+ actions = self .automated_planner .available_actions (state )
76+ for act in actions :
77+ fact_costs = self .automated_planner .pddl .compute_cost_action_effect (
78+ fact_costs , act , domain , self .cache .preconds , self .cache .additions , self .current_h
79+ )
80+ return float ("inf" )
7381
7482 def __pre_compute (self ):
7583 if self .has_been_precomputed :
@@ -86,6 +94,7 @@ def __pre_compute(self):
8694 self .cache .preconds = preconditions
8795 self .cache .domain = domain
8896 self .cache .axioms = axioms
97+ self .has_been_precomputed = True
8998
9099
91100 def __h_add (self , costs ):
0 commit comments