Docsity

Artificial Intelligence: Planning and Search Techniques, Appunti di Tecniche Di Intelligenza Artificiale

Toggle sidebar
bg1
1
DOMANDE TOERICHE AI
- Describe the notion of HLA in HTN and provide examples, considering the given problem.
HTN means Hierarchical task network. It follows 2 principles for creating a hierarchical
decomposition such that:
1) OPERATORS of classical planning are preserved, and more abstract concept of action are
introduced with HLA (High level actions).
2) Planning proceeds by decomposing non- primitive tasks recursively into smaller subtasks,
until primitive tasks are obtained.
For HTN action description, we have
1) PRIMITVE ACTIONS: actions that the agent can executed.
2) HLAs: each HLA (or a sequence of HLAs has one or more possible refinements into a sequence
of actions, each of which may be an HLA or a primitive action (which has no refinements by
definition).
They cannot be directly executed by the agent but they need to be transformed into
PRIMITVE ACTIONS. If HLA refinements contain all primitive actions are called
IMPLEMENTATION OF HLA.
An HLA achieves the goal from a given state if AT LEAST ONE of its IMPLEMENTATIONS
achieves the goal from that state.
HLA can control the VALUE OF VARIABLES.
Puoi scrivere anche come creare un piano (consiglio del prof. Se si ha tempo).
EXAMPLE OF HTN IN GENERAL
Hawaii vacation. In this example we have 5 HLA that are:
- go San Francisco airport.
- take Hawaii airlines, flight 11
- enjoy Honolulu
- take Hawaii airlines, flight 22
- go home
And then for the first HLA we can add refinements for examples, we can add:
- take bus
- take taxi
and so on…
EXAMPLE OF HTN CONSIDERING THE GIVEN PROBLEM (CLOW E GEORGIE)
The problem is to exchange the object. So, we have for HLA.
- goes to a certain location
- exchange object
- return at final position.
For the first HLA we can add refinements for examples, we can add:
- move P0 P1
- move P0 P3; move P3 P1
and so on…
pf3
pf4
pf5
pf8
pf9
pfa

Anteprima parziale del testo

Scarica Artificial Intelligence: Planning and Search Techniques e più Appunti in PDF di Tecniche Di Intelligenza Artificiale solo su Docsity!

DOMANDE TOERICHE AI

  • Describe the notion of HLA in HTN and provide examples, considering the given problem. HTN means Hierarchical task network. It follows 2 principles for creating a hierarchical decomposition such that:
    1. OPERATORS of classical planning are preserved, and more abstract concept of action are introduced with HLA (High level actions).
    2. Planning proceeds by decomposing non- primitive tasks recursively into smaller subtasks, until primitive tasks are obtained. For HTN action description, we have
    3. PRIMITVE ACTIONS: actions that the agent can executed.
    4. HLAs: each HLA (or a sequence of HLAs has one or more possible refinements into a sequence of actions, each of which may be an HLA or a primitive action (which has no refinements by definition). They cannot be directly executed by the agent but they need to be transformed into PRIMITVE ACTIONS. If HLA refinements contain all primitive actions are called IMPLEMENTATION OF HLA. An HLA achieves the goal from a given state if AT LEAST ONE of its IMPLEMENTATIONS achieves the goal from that state. HLA can control the VALUE OF VARIABLES. Puoi scrivere anche come creare un piano (consiglio del prof. Se si ha tempo). EXAMPLE OF HTN IN GENERAL Hawaii vacation. In this example we have 5 HLA that are:
    • go San Francisco airport.
    • take Hawaii airlines, flight 1 1
    • enjoy Honolulu
    • take Hawaii airlines, flight 2 2
    • go home And then for the first HLA we can add refinements for examples, we can add:
    • take bus
    • take taxi and so on… EXAMPLE OF HTN CONSIDERING THE GIVEN PROBLEM (CLOW E GEORGIE) The problem is to exchange the object. So, we have for HLA.
    • goes to a certain location
    • exchange object
    • return at final position. For the first HLA we can add refinements for examples, we can add:
    • move P0 P
    • move P 0 P3; move P3 P and so on…
  • Discuss the approach to define heuristics for Heuristics search and provided examples, considering also the problem given. The best first algorithms includes as a component of f an heuristic function h(n). h(n)= estimated cost of the cheapest path from the state at node n to a goal state. To define heuristics, we can have different ways:
    1. META-LEVEL: looking at the state of the object level problem and this state Is represented by search tree.
    2. REMOVE THE CONSTRAINTS: we obtain relaxed problem. In this case the state space graph is a super-graph of the original state space because the removal of restrictions create added edges in the graph. Any optimal solution in the original problem is also a solution in the relaxed problem, but the relaxed problem may have better solutions if the added edges provide short cuts.
    3. USING SUBPROBLEMS: PATTERN DATABASE Looks at subproblems and tries to find the solution to subproblem and by using subproblem an have a perfect heuristic at a certain point and therefore using this it can computer heuristic for the problem.
    4. EXPERIENCE: try many times the problem until the choices to be done during the search, can be done. If we have h1…hn a collection of heuristics that NOT DOMINATED each other, we can define H(n)= max(h1(n)…..hn(n)). H is admissible and dominated h1…hn. Concept of dominance: Given h1, h2 two admissible heuristics if h2(n)>=h1(n) for all n then h2(n) DOMINATES h1(n) and it is better for search because A* using h2 will never expand more nodes than A* using h1 (except possibly for some nodes with f(n)= C* It is generally better to use a heuristic function with higher values, provided it is consistent and that the computation time for the heuristic is not too long. (devo parlare anche dell’ammissible heuristic and consistent?) EXAMPLE – 8 PUZZLE The heuristics that we can use are: h(n) = total Manhattan distance h1(n) = number of misplaced tiles. EXAMPLE – GEORGIE AND CLOWN In our problem we can use: h(n) = the number of misplaced object + number of misplaced person.
  • Describe the notion of promotion and demotion in the context of POP and provide examples, also considering the given problem. We have a conflict between the causal link A --p-→ B and the action C holds when C has effect not p. This conflict can be solved by adding:
    • DEMOTION: we put C before A;
    • PROMOTION: we punt B before C EXAMPLE IN GENERAL – SUPERMARKET In this example we have to buy milk and bananas from the supermarket. In this case we cannot go

EXAMPLE – GEORGIE AND CLOWN

In our problem we can use: h(n) = the number of misplaced object + number of misplaced person.

  • Describe the general principles underlying Hierarchical Task Networks. HTN principles: The basic idea is to create a hierarchical decomposition such that:
    1. The operators of classical planning are preserved and a more abstract concept of action is introduced (HLA → High Level Actions).
    2. Planning proceeds by decomposing non primitive tasks recursively into smaller subtasks, until primitive tasks are obtained. (if I have time I can write also) HTN action description: a. PRIMITIVE ACTIONS → actions that the agent can executed; b. HIGH LEVEL ACTIONS (HLA) → they cannot be directly executed by the agent but they need to be transformed into primitive actions. Each HLA has one or more possible refinements into a sequence of actions, each of which may be an HLA or a primitive action (which has no refinements by definition). If HLA refinements contains all primitive actions are called implementation of the HLA. An HLA achieves the goal from a given state if at least one of its implementations achieves the goal from that state.
  • Discuss whether the above problem can be suitably HTN (HOTEL WITH DIRTY ROOM) EXAMPLE OF HTN CONSIDERING THE GIVEN PROBLEM (DIRTY ROOM) The problem is to clean the rooms. So, we have for HLA: move to the room 1 clean the room 1 move to the room 5 clean the room 5 We take clean the room 1 and we add the refinements: enter room 1 clean room 1 exit room 1
  • Describe the local search techniques and in particular simulated annealing (not beam search and genetic algorithms) The local search techniques work just on the solution state and the path is irrelevant. This is an advantage for the memory compared to the uninformed and informed search. There are 4 techniques:
    1. HILL CLIMBING (or GREEDY LOCAL SEARCH): It uses a fitness function to evaluate all the possible next move and choose the best one, but it can get stuck in local maximum that is a situation in which we cannot improve our solution, but we aren’t in the goal state. For this problem we have four possible solution:
      1. SIDE MOVES: with a limit on the max number.
      2. STOCHASTIC HILL CLIMBING: random moves choosing among the uphill successors.
      3. FIRST CHOICE: random generation of the successors taking the first uphill. It is good when a state has many of successors.
  1. RANDOM RESTART: we set the states randomly. Random restart has K independent process, and it creates a new instance in sequence. The algorithm does not maintain a search tree. Hill climbing doesn’t look ahead beyond the immediate neighbours of the current state.
  1. SIMULATED ANNEALING: it avoids the local max allowing some “bad” moves. It gradually decreasing their effects and frequency. It is a midway between the hill-climbing algorithm and a randomize search. The algorithm does a random moves every time, if the moves decreases the total costi then it is accepted, on the other hand it has a probability p to be accepted. The probability p depends on two factors:
  1. The schedule T which is a sort of time measure from the start of the algorithm, the more time has passed the lower p will be.
  2. The badness deltaE of the choice to be accepted, i.e how much worst is the cost after accepting the choice. If the schedule is slow enough then the algorithm approaches probability 1 to reach a goal.
  1. LOCAL BEAM SEARCH
  2. GENETIC ALGHORITM
  • Describe the general principles underlying partial order planning.
  1. Principle of least commitment: is a useful concept for analysing when decisions should be made in any search problem.
  2. Partial order planner: any planning algorithm that can place two actions into a plan without specifying which come first.
  3. Linearization: impose a total order on a partially ordered plan. Partial order planning can be implemented as a search in the space of partial-order plans. We start with an empty plan. Then we consider ways of refining the plan until we come up with a complete plan that solves the problem. The actions in this search are not actions in the world, but actions on plans: adding a step to the plan, imposing an ordering that puts one action before another, and so on.
  • Discuss whether the above problem can be suitably formalized using POP. (MUSEUM) We have 4 open preconditions: (turn_on S) (play_audio P00) (play_audio P02) (play_audio P12) then we pick one of them, for example (turn_on S): we add the action turn_on_ligth and we add the causal link between turn_on_ligth, the goal and the precondition turn_on. We add the precondition of turn_on_ligth to the open precondition and we continue the algorithm until we complete the partial order plan.
  • Describe the heuristics that can be adopted in CSP (excluding forward reasoning (SAREBBE CHECKING). In CSP we can improve backtracking efficiency by:
  1. CHOOSING THE VARIABLES (domain independent methods). We have 2 ways: MRV (Minimum Remaining Values) - > choose the variables with the fewest legal values. DEGREE HEURISTIC - > when tie-braker among MRV. It chooses the variables with the most constraints on remaining variables.
  2. CHOOSING THE VALUES:

There are 2 varieties of CSPs:

  1. Discrete variables: Finite Domains: complexity: d^n - > set of integers or strings. Infinite Domains: need a constraint language. Linear constraints are solvable non-linear undeclared.it can be reduce to finite by putting an upper bound to values. EXAMPLE IN GENERAL – MAP COLORING We take a map that is divided in some parts and we consider 3 colors that we want to put that we will use to color the map. Constraints: adj regions must have different colours. Each region is a node, and each constraint is an edge. We can improve the efficiency of backtracking by:
  2. choosing the variables:
  • MRV (Minimum remaining values): choosing tha variables with the fewest legal values.
  • DEGREE HEURISTIC: tie-braker among MRV variables and we choose the variables with the most constraints on remaining variables.
  1. Choosing the values: least constraining values. Given a variable choose the least constraining values, the one that rules out the fewest values in the remaining variables. Backtracking occurs when no legal assignment can be found for a variable.
  2. FORWARD CHECKING:
  • Keep track of the legal values for unassigned variables
  • Terminate search when any variables has no legal values but doesn’t provide early detection for all failures. For many problems the search will be more effective if we combine the MRV heuristic with Forward Checking. It makes only the current variable arc consistent. CONSTRAINT PROPAGATION: It’s the process of determining how the constraints and the possible values of one variable affect the possible values of other variables. It’s an important form of “least- commitment” reasoning.
  1. ARC CONSISTENCY It’s the simplest form of propagation makes each arc consistent. X → Y is CONSISTENT iff: for every values x of X there is some allowed y. If X loses a value, neighbours of X need to be rechecked. Arc consistency detects failure earlier than forward checking.
  • Define the notion of heuristics for heuristic search, providing examples. Sketch the main techniques to obtain heuristics for a given search problem. An heuristic is a technique to solve a problem faster than classical methods, or to find an approximate solution when classical methods cannot. An heuristic at each branching step evaluates the available information and makes a decision on which branch to follow. H(n) Is the heuristic function. H(n) = estimated cost of the cheapest path from the state at node n to a goal state. To define heuristics, we can have different ways:
  1. META-LEVEL: looking at the state of the object level problem and this state Is represented by search tree.
  1. REMOVE THE CONSTRAINTS: we obtain relaxed problem. In this case the state space graph is a super-graph of the original state space because the removal of restrictions create added edges in the graph. Any optimal solution in the original problem is also a solution in the relaxed problem, but the relaxed problem may have better solutions if the added edges provide short cuts.
  2. USING SUBPROBLEMS: PATTERN DATABASE Looks at subproblems and tries to find the solution to subproblem and by using subproblem an have a perfect heuristic at a certain point and therefore using this it can computer heuristic for the problem.
  3. EXPERIENCE: try many times the problem until the choices to be done during the search, can be done.
  • Discuss the backword planning procedure. Show the first step for backword planning starting from the goal by specifying the actions that would lead to the goal and the states that would allow them to be executed. REGRESSION→ Backword search: back to the initial state. Actions are invertible because the goal satisfaction represent set of states. Advantage of algorithm → starting from the goal has the advantage that we understand where we want to go and we try to build only the portion of the search space which is focussed on achieving the goal. Types of actions:
    1. Relevant → actions that add a goal conjunction
    2. Consistent → not undo any other goal conjunction. To produce a predecessor state: Result ^-1 (s, a) = (s – ADD(a)) U PREC(a) any positive effect of A that apply in G is delated each precondition literal of A is added, unless is already appears.
  • Discuss the difference between state-space and plan-space planning. Describe the basic approach to plan space planning (POP). STATE-SPACE PLANNING: a state in our search for the plan will be a representation of the world and a transition to another state in our search will be caused by the addition of an action, which will be following the actions that have led to that state. So we are actually adding the actions all in a sequence until we have a complete sequence to the goal. PLAN SPACE PLANNING: the state of the search is a partial plan, so we start with a partial plan and then we have a transition which corresponds to adding one action to the partial plan doesn’t have to be the next action in the sequence. POP The plan representation is composed by:
    1. Set of actions
    2. Set of ordering constraints A < B
    3. Set of causal link A - p-> B. It’s from outcome of one action to precondition of another.
    4. Set of open preconditions = precondition of an action not yet causal linked. Procedure of POP
    5. The initial plan includes the constraints from start and finish with ordering start z finish

conjunction of subgoal is approximated by the sum of the cost of solving each subgoal independently. The subgoal independent assumption can be:

  • optimistic: when there are negative interactions within the subplans for each subgoal
  • pessimistic (inadmissible): when subplans contain redundant actions.
  • Describe the general principles of genetic algorithms in particular. is it possible to model the state of the problem in the above ex. a suitable form for genetic algorithm? Doesi It make senseto apply gen. alg. To that sea prob? The genetic algorithm is part of the local search algorithms, so we work just on the solution (path irrelevant). Genetic algorithm is a variant of stochastic beam search, in which successors states are generated by combining two parents state rather then modifying a single state. The algorithm works like that:
  1. initial population: a set of k randomly generate states. (i.e set of individuals)
  2. selection: by fitness function (stochastic)
  3. reproduction: can succeed
  • Crossover: the child takes part of its genetic code by father and mother.
  • Mutation: change randomly. The advantage of the genetic algorithm is that has a robust solution.
  • Describe the language for HTN planning. In particular, explain the notion of reachable set. PDDL Reachable set is represented by the notation REACH(s, h). REACH(s, h) of an HLA h from state s, set of states that can be reached starting by any of the starting state and executing one of refinements. We can also define with a set of a sequences of HLAs. The reachable set of a sequence of HLAs is the union of all the reachable sets obtained by applying the n-th HLA in each state in the reachable set of the (n-1)-th HLA. Given a sequence of HLAs, it achieves the goal if its reachable set intersects the set of possible goal state. If it doesn’t intersect then there is no plan.
  • Describe the algorithm A, focussing in particular on correctness, completeness and memory requirements. In addition, address the limitations of A and possible approaches to mitigate them. PROPERTIES: A* is an algorithm of the heuristic search. The time complexity is exponential. The space complexity is exponential because it keeps all nodes in memory. It is optimal but it cannot expand fi+1 until fi is finished. A* expands all nodes with f(n) < C* A* expands some nodes with f(n) = C* a* expands no node with f(n) > C* where C* is the cost of the goal. A* is complete unless there are infinite many nodes with f<= f(G) It depends on h(n). LIMITATIONS: The memory to store the fringe may be exponential.

Contromeasures:

  • use good but not admissible heuristics;
  • live with suboptimal solution. We can note that the state problem remains. We can apply the solution for this problem:
  1. IDA* algorithm: at each iteration only the current cost limit for f is kept.
  2. RBFS algorithm: the cost of the nodes in depth-first search are recorded. It is more efficient than IDA* but sometimes it wastes time in re-generating discarded nodes. The space complexity is linear (bd). IDA* and RBFS use too little memory. They have an exponential increase in time complexity and redundant in the path.
  3. SMA* algorithm: can use all available memory for the search. SMA* is the best heuristic search method.
  • Discuss the language PDDL and show an example of domain representation in PDDL. PDDL: Planning Domain Description Language. To model a problem in PDDL language we have two files:
  1. PLANNING PROBLEM: has the initial state, the goal state, a specification of action, that is called planning domain.
  2. PROBLEM DOMAIN: The action schemas has action name and a list of variables used in the schemas. The action schemas is composed by: a. preconditions: set of positive fluents. Preconditions defines the state in which the actions can be executed. b. effects: set of fluents. Effects define the result of executing the action. (action move :parameter: P1 P :preconditions: (and (Place ?P1) (Place ?P2) (at A ?P1)) :effects: (and(not(at A ?P1)) (at A ?P2)) ) Aggiungo anche bfs, dfs ecc Breadth-first It expands the root node first and then all its successors, and then its successor and so on. It can be implemented using a FIFO queue where the goal condition is applied to each node when it is generated. Proprieties:
  • Complete if d <∞
  • Optimal if the path cost is a non-decreasing function of the depth (all action have same cost)
  • Time and Memory complexities are O(bd+1) Uniform-cost Expands the node with the lowest path cost [g(n)]. It can be implemented using a Priority Queue ordered by g(n). The goal condition is applied to the node when this one is selected for expansion because the generated one can be a sub-optimal path. Proprieties:
  • Complete if g(n)> E
  • Always Optimal since it expands the nodes in order of their optimal path cost
  • Time and Memory complexities are O(bC∗/E), where C∗ is the cost of the optimal solution