-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Complete planning solving example #43
Comments
By default, the MineHcraft environment has no goal, as such any plan built will be trivially empty, this is why the action given was None. I've added a UserWarning if building a planning problem from and environment without goal. I've updated the documentation to make everything more clear both in the README and in the planning documentation itself. If you really want to use the MineHCraft example, you can either set a purpose manually or use gym to make an env with predetermined purpose, for example: import gym
from hcraft.env import HcraftEnv
env: HcraftEnv = gym.make("MineHcraft-Stone-v1")
# Make it into a unified planning problem
planning_problem = env.planning_problem()
# Solve the planning problem and show the plan
planning_problem.solve()
print(planning_problem.plan)
done = False
_observation = env.reset()
while not done:
action = planning_problem.action_from_plan(env.state)
if action is None:
# Plan has ended, no action left
done = True
continue
_observation, _reward, done, _ = env.step(action)
# Goal is achieved == purpose is terminated
if env.purpose.terminated:
print("Success ! The plan worked in the actual environment !")
else:
print("Failed ... Something when wrong with the plan.") @inpefess tell me if you are satisfied and thus if the issue should be closed |
Great! Now it looks good to me, thank you. |
Part of a JOSS review openjournals/joss-reviews#6468 There is an example of solving a planning problem in ReadMe (https://github.com/IRLL/HierarchyCraft?tab=readme-ov-file#as-a-upf-problem-for-planning) but it's incomplete. For example, when I try adding proposed lines:
to Minecraft example (https://github.com/IRLL/HierarchyCraft?tab=readme-ov-file#using-the-programmatic-interface) nothing really happens. Moreover, if I try using the plan as suggested in the documentation https://irll.github.io/HierarchyCraft/hcraft/planning.html, it fails with an error (probably because no plan was built):
Could you please complete the example to get started with solving the planning problem based on Minecraft environment?
The text was updated successfully, but these errors were encountered: