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

Method __init__

pddlstream/language/function.py:130–144  ·  view source on GitHub ↗
(self, head, fn, domain, info)

Source from the content-addressed store, hash-verified

128 _Instance = FunctionInstance
129 #_default_p_success = 0.99 # 0.99 | 1 # Might be pruned using cost threshold
130 def __init__(self, head, fn, domain, info):
131 # TODO: function values that act as preconditions (cost must be below threshold)
132 if info is None:
133 # TODO: move the defaults to FunctionInfo in the event that an optimistic fn is specified
134 info = FunctionInfo() #p_success=self._default_p_success)
135 super(Function, self).__init__(get_prefix(head), info, get_args(head), domain)
136 self.head = head
137 opt_fn = lambda *args: self.codomain()
138 self.fn = opt_fn if (fn in DEBUG_MODES) else fn
139 #arg_spec = get_arg_spec(self.fn)
140 #if len(self.inputs) != len(arg_spec.args):
141 # raise TypeError('Function [{}] expects inputs {} but its procedure has inputs {}'.format(
142 # self.name, list(self.inputs), arg_spec.args))
143 self.opt_fn = opt_fn if (self.info.opt_fn is None) else self.info.opt_fn
144 self.num_opt_fns = 0 # TODO: support multiple opt_fns
145 @property
146 def function(self):
147 return get_prefix(self.head)

Callers 4

__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45
__init__Method · 0.45

Calls 3

get_prefixFunction · 0.90
get_argsFunction · 0.90
FunctionInfoClass · 0.85

Tested by

no test coverage detected