def latent_plan(init,goal,mode):
bits = np.concatenate((init,goal))
###### preprocessing ################################################################
## old code for caching...
lock = problem(network("lock"))
import fcntl
try:
with open(lock) as f:
print("lockfile found!")
fcntl.flock(f, fcntl.LOCK_SH)
except FileNotFoundError:
with open(lock,'wb') as f:
fcntl.flock(f, fcntl.LOCK_EX)
preprocess(bits)
###### do planning #############################################
sasp = problem(network("{}.sasp".format(action_type)))
plan_raw = problem(network("{}.sasp.plan".format(action_type)))
plan = problem(network("{}.{}.plan".format(action_type,mode)))
echodo(["planner-scripts/limit.sh","-v", "-o",options[mode], "--","fd-sas-clean", sasp])
assert os.path.exists(plan_raw)
echodo(["mv",plan_raw,plan])
out = echo_out(["lisp/parse-plan.bin",plan, *list(init.astype('str'))])
lines = out.splitlines()
return np.array([ [ int(s) for s in l.split() ] for l in lines ])
评论列表
文章目录