Menu

(Solved) : Artificial Intelligence Planning Iterated Widening Let S Compare Dedicated Planning Algori Q31130042 . . .

Artificial Intelligence

**Planning with Iterated Widening**

Let’s compare against a dedicated planning algorithm, ratherthan applying graph search naively.
Planning domains have some significant differences from generalgraph search problems—let’s reflect on what they might be.
11. In graph search, what is the goal of a search? How is thatdifferent from the goal of a planning problem?
12. In graph search, what are the preconditions for traversing anedge? How does this differ in a planning problem?
13. In graph search, detecting cycles is relatively cheap. Is thatthe case for planning problems?
14. Is there more than one type of “cycle” in our crafting planningproblem?

Think about a recipe like making a stone pickaxe.
Every possible planning state either satisfies its preconditions ordoesn’t.
If this recipe were the only action, we could formulate the problemas a domain with just three `abstract` states—one without apickaxe and without the needed supplies, one without a pickaxe andwith the needed supplies, and one with a pickaxe (and it doesn’tmatter what else is in the state).
15. If we had a domain with just two recipes (`punch for wood` and`wood planks`), what would be the abstract states in the sense usedabove?

We can automate the intuition of (15) by transforming our statesinto `combinations of propositions`
A `proposition` here is a logical fact entailed by the state; forexample `I have at least one piece of wood`, `I have at least twopieces of wood`, `I have at least one plank`, and so on.
Note that if we have two pieces of wood then we necessarily haveone piece of wood as well!
`Iterated Widening` is a planning algorithm which works byabstracting away differences between states and discarding stateswhich are too similar to states which have been seen already inthis iteration.
Two states are similar if they share some number of propositions incommon—so if the `width` measure is one, then when we have seenone state where we have at least one stick we subsequently ignoreevery other state we might find later with one or more sticks(we’ll relax this a little to say “any sufficiently different stateis worth exploring”—so if it has at least a few propositions thatare unique with respect to all seen combinations of a given width,we will consider it).
To regain completeness—to always find a solution if oneexists—the size of the combinations of items considered in thissimilarity computation is gradually increased until a solution isfound.

Now we will define a Proposition of the form
`I have at least N of item INDEX`

Then we will define a function that takes in a state andpropositionalizes it. E.g.

If we have:
`items_by_index = [‘wood’, ‘cobble’, ‘bench’]`
and
our current state is:
`{‘wood’:5, ‘bench’:1}`

then propositionalized version should be a set of:
`Proposition(1,5), Proposition(1,4), Proposition(1,3),Proposition(1,2), Proposition(1,1), Proposition(3,1)`

i.e. we have at least 1,2,3,4, and 5 pieces of wood, and atleast 1 bench.

class Proposition(NamedTuple): item: int at_least: intdef state_propositions(state: State) -> Set[Proposition]: propositions: Set[Proposition] = set() # TODO Do something for each item in state. Output all propositions entailed by the state’s contents return propositions

Now let’s get the propositions from the recipes

def recipe_to_propositions(recipe: Recipe) -> Set[Proposition]: propositions: Set[Proposition] = set() # TODO Do something with recipe.consumes, recipe.produces, and recipe.requires. # Emit, for this recipe, all the propositions entailed by the postconditions #and the _minimal_ set of propositions required for the preconditions #(i.e., don’t need to output wood >= 2, wood >= 1, wood >= 0 if the recipe needs 2 wood.) return propositionsrecipe_propositions = set()for r in recipes: recipe_propositions |= recipe_to_propositions(recipes[r])

Expert Answer


Answer to Artificial Intelligence Planning Iterated Widening Let S Compare Dedicated Planning Algori Q31130042 . . .

OR