# CSE 471-Project 3 Regression Planner using A* Sreelakshmi Vaddi.

## Presentation on theme: "CSE 471-Project 3 Regression Planner using A* Sreelakshmi Vaddi."— Presentation transcript:

CSE 471-Project 3 Regression Planner using A* Sreelakshmi Vaddi

Example: Regression planner operator O1 prec: P Eff: R, ~S operator O2 prec: Q Eff: S operator O3 prec: P Eff: M operator O4 prec: R,S Eff: P,Q,R,S operator O5 prec: R,S Eff: P Initial: {P,Q} Goal: {P,Q,R,S} PQRS PQR RS QRS PQ O2 O4 O5 O1 G=0 h=0 G=1 h=1 H0: USING SET DIFFERENCE HEURISTIC – A* Goal: {P,Q} Initial: {P,Q,R,S} G=1 h=2 G=1 h=1 G=2 h=0 Number of elements {curr state MINUS Goal}

Example: Regression planner operator O1 prec: P Eff: R, ~S operator O2 prec: Q Eff: S operator O3 prec: P Eff: M operator O4 prec: R,S Eff: P,Q,R,S operator O5 prec: R,S Eff: P PQRS PQR RS QRS PQ O2 O4 O5 O1 G=0 h=0 G=1 h=1 H1: Heuristic function that computes the cost of a set as the sum of the levels of the individual elements of the set - A* Goal: {P,Q} Initial: {P,Q,R,S} G=1 h=2 G=1 h=2 G=2 h=0 P -> 0, Q -> 0, R -> 1, S-> 1 SUM (set-level-val-without-mutex (each condition))

Example: Regression planner operator O1 prec: P Eff: R, ~S operator O2 prec: Q Eff: S operator O3 prec: P Eff: M operator O4 prec: R,S Eff: P,Q,R,S operator O5 prec: R,S Eff: P PQRS PQR RS QRS PQ O2 O4 O5 O1 G=0 h=0 G=1 h=1 H2: Heuristic function that computes the cost of a set as the level at which that particular set occurs first– A* Goal: {P,Q} Initial: {P,Q,R,S} G=1 h=1 G=1 h=1 G=2 h=0 PQRS -> 1, PQR -> 1, RS -> 1, QRS-> 1, PQ->0 set-level-val-without-mutex (list of all conditions)

Example: Regression planner operator O1 prec: P Eff: R, ~S operator O2 prec: Q Eff: S operator O3 prec: P Eff: M operator O4 prec: R,S Eff: P,Q,R,S operator O5 prec: R,S Eff: P PQRS PQR RS QRS PQ O2 O4 O5 O1 G=0 h=0 G=1 h=1 H3: Heuristic function that computes the cost of a set as the level at which that particular set occurs first without any mutexes– A* Goal: {P,Q} Initial: {P,Q,R,S} G=1 h=2 G=1 h=2 G=2 h=0 PQRS -> 2, PQR -> 1, RS -> 2, QRS-> 2, PQ->0 set-level-val-with-mutex (list of all conditions)

What you need to get started Load the code given to you on Allegro You need not touch/modify this code at all Loading instructions on project webpage :problems file + graph plan code You will need from Project 1 – A* search Node structure Children function A* main function Trace path Display stats part Puzzle children F-value fn NEW FUNCTIONS: Heuristics: H0,H1,H2,H3 Goalp: (Actually initialp)

Heuristics and Goalp functions H0: Number of elements {curr state MINUS Goal} H1: SUM (set-level-val-without-mutex (each condition)) H2: set-level-val-without-mutex (list of all conditions) H3: set-level-val-with-mutex (list of all conditions) Goalp: find if current state is equal to the goal state Eg: {PQR} = {PQ} FALSE

Puzzle Children Function Generates the children of current state, by checking if there is an operator applicable to current state When can you apply an op to state s? None of effects of op negate conditions in S (Reason why we don’t apply O1 in Eg) At least one effect of op is in S (Reason why we don’t apply O3 in Eg) And May be more conditions Negative literals Op-adds, op-deletes

Puzzle Children Function Contd New state generation? op-preconditions U (parent state – op-effects) IMPORTANT: Handling negative literals ‘P is (:NOT (P)) (So check car of every condition to see if its negative literal and then *special*) Op-deletes, op-adds can be useful than op-effects PQR on o1 ? (operator O1 prec: P Eff: R, ~S) {p} U {{p,q,r}-{r,~s}}={p,q}

Useful functions-Graph Plan code (get-ground-operators ‘Eg-problem) : returns O1..O5 (op-name op1) : returns (UNSTACK A A) (op-preconditions op1) ((ON A A) (CLEAR A) (ARM-EMPTY)) (op-effects op1) ((HOLDING A) (CLEAR A) (:NOT (CLEAR A)) (:NOT (ARM-EMPTY)) (:NOT (ON A A))) (op-adds op1) ((HOLDING A) (CLEAR A)) (op-deletes op1) ((CLEAR A) (ARM-EMPTY) (ON A A))

Useful functions-Graph Plan code (problem-init 'class-problem) : Initial state of the problem ((OBJECT A) (OBJECT B) (ON-TABLE A) (ON-TABLE B) (CLEAR A) (CLEAR B) (ARM-EMPTY)) (problem-goal 'class-problem) : Goal state of the problem ((:NOT (CLEAR B)) (ARM-EMPTY)) Heuristic Functions (Compute-pg problem) : Has to be called in the beginning of every problem so that you can call all the above functions as well as heuristic functions.

Other functions Lisp set operations (list1 list2 :test #’equal) Set Difference Union Intersection

Possible Program Flow Call compute-gp, get-ground-operators, problem-init, problem-goal Make goal node from problem-init Call A*(list goal-node, goalp,…) Change puzzle-children function as discussed above Write Goalp function Write heuristic functions calling set-level functions from the given code

Progression Planner - Simpler When an OP can apply to state S? S contains OP-preconditions New child state (S Union OP-effects) Rest remain same And don’t forget to change the compute- pg code part as said by Dr.Rao in project description

Example: Progression planner operator O1 prec: P Eff: R, ~S operator O2 prec: Q Eff: S operator O3 prec: P Eff: M operator O4 prec: R,S Eff: P,Q,R,S operator O5 prec: R,S Eff: P Initial: {P,Q} Goal: {P,Q,R,S} PQRS PQR PQS PQM PQ O2 O3 O1 G=0 h=0 G=1 h=1 H0: Using Set difference heuristic G=1 h=1 G=1 h=2 G=0 h=0 O2 on PQ? Child : {P,Q} U {Q,S}={P,S} O4,O5 on PQ? NO R Not in PQ, S not in PQ