Skip to content

Commit

Permalink
fix(notebook): fix small bug in the planner integration tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
alvalentini committed Feb 7, 2025
1 parent 9f92aa6 commit 61bdd5b
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions docs/notebooks/tutorial/planner-integration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,22 +117,22 @@
" with env.factory.Compiler(problem_kind=problem.kind, compilation_kind=up.engines.CompilationKind.GROUNDING) as grounder:\n",
" grounding_result = grounder.compile(problem, up.engines.CompilationKind.GROUNDING)\n",
" grounded_problem = grounding_result.problem\n",
" \n",
"\n",
" # We store the grounded actions in a list\n",
" actions = list(grounded_problem.instantaneous_actions)\n",
" \n",
"\n",
" # The candidate plan, initially empty\n",
" plan = up.plans.SequentialPlan([])\n",
"\n",
" # Ask for an instance of a PlanValidator by name\n",
" # (`sequential_plan_validator` is a python implementation of the \n",
" # (`sequential_plan_validator` is a python implementation of the\n",
" # PlanValidator operation mode offered by the UP library)\n",
" with env.factory.PlanValidator(name='sequential_plan_validator') as pv:\n",
" counter = 0\n",
" while True:\n",
" # With a certain probability, restart from scratch to avoid dead-ends\n",
" if random.random() < self.restart_probability:\n",
" plan = up.plans.SequentialPlan()\n",
" plan = up.plans.SequentialPlan([])\n",
" else:\n",
" # Select a random action\n",
" a = random.choice(actions)\n",
Expand Down Expand Up @@ -228,7 +228,7 @@
"metadata": {},
"outputs": [],
"source": [
"from unified_planning.shortcuts import * \n",
"from unified_planning.shortcuts import *\n",
"\n",
"problem = Problem('robot')\n",
"Location = UserType('Location')\n",
Expand Down

0 comments on commit 61bdd5b

Please sign in to comment.