13./14. Lets prepare for exam - Exercises

In this tutorial, we will go over several heuristics of classical planning and probabilistic planning as a preparation for exam. If you have your own exercises or you struggle with any topic, prepare it for the tutorial.

Delete relaxation heuristics

A relaxed planning task of STRIPS task $\Pi = \langle F, A, s_0, g \rangle$, where $a = \langle pre_a, add_a, del_a \rangle$ is a task $Pi^+ = \langle F, A^+, s_0, g \rangle$, where the delete effects of actions are omitted, i.e., $a^+ = \langle pre_{a^+}, add_{a^+}, \emptyset \rangle$. The optimal heuristic of $\Pi$ is denoted $h^*$ and for $\Pi^+$. However, the heuristic values cannot be computed in polynomial time, therefore, we use estimates: $h^{max}, h^{add}, h^{ff}$. In this tutorial, we consider $\Pi = \Pi^+$ and $h^{max} \leq h^+ = h^* \leq h^{add}$ and $h^+ = h^* \leq h^{ff}$ hold.

Exercise: Consider the following STRIPS task $\Pi = \langle F, A, s_0, g \rangle$, where

  • $F=\{a,b,c,d,e,f,g,h\}$,
  • $s_0 = \{a\}$,
  • $g = \{c,d,e,f,g\}$,
  • $A = \{a_1,a_2,a_3,a_4,a_5,a_6\}$ defined below:
action pre add cost
$a_1$ $\{a\}$ $\{b,c\}$ $1$
$a_2$ $\{a,c\}$ $\{d\}$ $1$
$a_3$ $\{b,c\}$ $\{e\}$ $1$
$a_4$ $\{b\}$ $\{f\}$ $1$
$a_5$ $\{d\}$ $\{e,f\}$ $1$
$a_6$ $\{d\}$ $\{g\}$ $1$

Compute the perfect heuristic $h^*$, $h^{max}$, $h^{add}$, and $h^{ff}$ for the initial state, i.e., $h^*(s_0), h^{max}(s_0),h^{add}(s_0)$ and $h^{ff}(s_0)$.

Solution

LM-Cut Heuristic

Exercise: Consider the following STRIPS task $\Pi = \langle F, A, s_0, g \rangle$, where

  • $F=\{a,b,c,d,e,f\}$,
  • $s_0 = \{c,d\}$,
  • $g = \{a,e\}$,
  • $A = \{a_1,a_2,a_3,a_4,a_5\}$ defined below:
action pre add cost
$a_1$ $\{d\}$ $\{a,e\}$ $3$
$a_2$ $\{c,d\}$ $\{e\}$ $1$
$a_3$ $\{d,e\}$ $\{a,b\}$ $1$
$a_4$ $\{b\}$ $\{d,f\}$ $1$
$a_5$ $\{b,e\}$ $\{f\}$ $2$

Compute $h^{LM-Cut}(s_0)$.

Do not forget to extend $\Pi$ by the by new facts $\bot$ and $\top$ so the new initial state is $\{\bot\}$ and the new goal state is $\{\top\}$.

Solution - Extend $\Pi$

Solution - $1^{st}$-iteration

Patterns and LP-based heuristics

Exercise 1: Consider the following FDR task $\Pi = \langle V, A, s_0, g \rangle$, where

  • $V=\{v_a, v_b, v_c, v_d, v_e, v_f\}$, $dom(v_i) = \{0,1\}, \forall i \in \{a,b,c,d,e,f \}$,
  • $s_0 = \{v_a=0,v_b=0,v_c=1,v_d=1,v_e=0,v_f=0\}$,
  • $g = \{v_a=1,v_e=1\}$,
  • $A = \{a_1,a_2,a_3,a_4,a_5\}$ defined below:
action pre add cost
$a_1$ $\{v_d=1\}$ $\{v_a=1,v_e=1\}$ $3$
$a_2$ $\{v_c=1,v_d=1\}$ $\{v_e=1\}$ $1$
$a_3$ $\{v_d=1,v_e=1\}$ $\{v_a=1,v_b=1\}$ $1$
$a_4$ $\{v_b=1\}$ $\{v_d=1,v_f=1\}$ $1$
$a_5$ $\{v_b=1,v_e=1\}$ $\{v_f=1\}$ $2$

Create a causal graph of $\Pi$, where vertices corresnponds to $V$ and edges to actions $a_k$, where for each $v_i,v_j \in V$ either $\mathsf{pre}_{a_k}(v_i)$ and $\mathsf{eff}_{a_k}(v_j)$ are defined or $\mathsf{eff}_{a_k}(v_i)$ and $\mathsf{eff}_{a_k}(v_j)$ are defined. And from the graph select interesting patterns up to size 2.

Solution - interesting patterns

Take the interesting patterns $P$ and used them to form a linear program to compute post-hoc heuristic value.

Solution - post-hoc heuristic

Exercise 2: Consider the following FDR task $\Pi = \langle V, A, s_0, g \rangle$, where

  • $V=\{v_1, v_2, v_3\}$, $dom(v_1) = \{d,e\}, dom(v_2)=\{f,g\}, dom(v_3)=\{h,j,k\}$,
  • $s_0 = \{v_1=d,v_2=f,v_3=h\}$,
  • $g = \{v_1=d,v_3=k\}$,
  • $A = \{a_1,a_2,a_3,a_4,a_5\}$ defined below:
action pre add cost
$a_1$ $v_1=d,v_3=h$ $v_1=e,v_3=j$ $2$
$a_2$ $v_1=d$ $v_2=g$ $1$
$a_3$ $v_2=g,v_3=j$ $v_3=k$ $1$
$a_4$ $v_1=e$ $v_1=d$ $2$
$a_5$ $v_3=h$ $v_3=j$ $5$

Given projection $P=\{v_3\}$, compute the heuristic $h_{P}(s_0)$ and post-hoc heuristic.

Solution - heuristic

Solution - post-hoc heuristic

Stochastic shortest path (SSP)

Exercise: Wanting to read a book as soon as possible, we decide to go and get it. We can either take bus or bike to the city center, where there are a library as well as a shop. The problem is modelled as the following LTS.

At first, compute the heuristic values of each state $S = \{home, station, bus, library, shop, reading\}$.

Solution - heuristic values

Then perform ILAO$^*$ and get optimal policy $\pi^*$.

Solution - ILAO$^*$

courses/pui/tutorials/tutorial13.txt · Last modified: 2024/05/20 15:02 by deckejin