MCPcopy Create free account
hub / github.com/caelan/pddlstream / FunctionResult

Class FunctionResult

pddlstream/language/function.py:37–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35 #self.order = 0
36
37class FunctionResult(Result):
38 def __init__(self, instance, value, optimistic=True):
39 super(FunctionResult, self).__init__(instance, opt_index=0, call_index=0, optimistic=optimistic)
40 self.instance = instance
41 self.value = value
42 self._certified = None
43 # TODO: could add empty output_objects tuple
44 @property
45 def certified(self):
46 if self._certified is None:
47 self._certified = [Equal(self.instance.head, self.value)]
48 return self._certified
49 def get_certified(self):
50 return self.certified
51 def get_action(self):
52 return FunctionAction(self.name, self.input_objects)
53 def remap_inputs(self, bindings):
54 #if not any(o in bindings for o in self.instance.get_all_input_objects()):
55 # return self
56 input_objects = apply_mapping(self.instance.input_objects, bindings)
57 new_instance = self.external.get_instance(input_objects)
58 return self.__class__(new_instance, self.value, self.optimistic)
59 def is_successful(self):
60 return True
61 def __repr__(self):
62 #from pddlstream.algorithms.downward import get_cost_scale
63 #value = math.log(self.value) # TODO: number of digits to display
64 return '{}={:.3f}'.format(str_from_head(self.instance.head), self.value)
65
66class FunctionInstance(Instance):
67 _Result = FunctionResult

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected