• Keine Ergebnisse gefunden

Planning and Optimization

N/A
N/A
Protected

Academic year: 2022

Aktie "Planning and Optimization"

Copied!
11
0
0

Wird geladen.... (Jetzt Volltext ansehen)

Volltext

(1)

Planning and Optimization

D7. M&S: Generic Algorithm and Heuristic Properties

Gabriele R¨oger and Thomas Keller

Universit¨at Basel

November 7, 2018

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 1 / 41

Planning and Optimization

November 7, 2018 — D7. M&S: Generic Algorithm and Heuristic Properties

D7.1 Generic Algorithm D7.2 Heuristic Properties D7.3 Summary

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 2 / 41

Content of this Course

Planning

Classical

Tasks Progression/

Regression Complexity Heuristics

Probabilistic

MDPs Uninformed Search

Heuristic Search Monte-Carlo

Methods

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 3 / 41

Content of this Course: Heuristics

Heuristics

Delete Relaxation

Abstraction

Abstractions in General

Pattern Databases

Merge &

Shrink Landmarks

Potential Heuristics Cost Partitioning

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 4 / 41

(2)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

D7.1 Generic Algorithm

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 5 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Content of this Course: Merge & Shrink

Merge & Shrink

Synchronized Product Merge & Shrink Algorithm

Heuristic Properties Strategies Label Reduction

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 6 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Generic Merge-and-shrink Abstractions: Outline

Using the results from the previous chapter, we can develop the ideas of a generic abstraction computation procedurethat takes all state variables into account:

I Initialization step: Compute all abstract transition systems for atomic projections to form the initial abstraction collection.

I Merge steps: Combine two abstract systems in the collection by replacing them with their synchronized product. (Stop once only one transition system is left.)

I Shrink steps: If the abstractions in the collection are too large to compute their synchronized product, make them smaller by abstracting them further (applying an arbitrary abstraction to them).

We explain these steps with our running example.

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Back to the Running Example

LRR LLL LLR

LRL

ALR

ALL

BLL

BRL

ARL

ARR

BRR

BLR

RRR RRL

RLR

RLL

Logistics problem with one package, two trucks, two locations:

I state variablepackage: {L,R,A,B}

I state variabletruck A:{L,R}

I state variabletruck B:{L,R}

(3)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Initialization Step: Atomic Projection for Package

Tπ{package}:

L

A

B

R

M???

PAL DAL

M???

DAR PAR

M???

PBR DBR

M???

DBL PBL

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 9 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Initialization Step: Atomic Projection for Truck A

Tπ{truck A}:

L R

PAL,DAL,MB??, PB?,DB?

MALR

MARL

PAR,DAR,MB??, PB?,DB?

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 10 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Initialization Step: Atomic Projection for Truck B

Tπ{truck B}:

L R

PBL,DBL,MA??, PA?,DA?

MBLR

MBRL

PBR,DBR,MA??, PA?,DA?

current collection: {Tπ{package},Tπ{truck A},Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 11 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Merge Step

T1:=Tπ{package}⊗ Tπ{truck A}:

LL LR

AL AR

BL BR

RL RR

MALR MARL

MALR MARL

MALR MARL

MALR MARL PAL

DAL

PADARR

PBR DBL DBR

PBL

PBL DBL

DBR PBR

MB?? MB??

MB?? MB??

MB?? MB??

MB?? MB??

current collection: {T1,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 12 / 41

(4)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Need to Simplify?

I If we have sufficient memory available, we can now compute T1⊗ Tπ{truck B}, which would recover the complete transition system of the task.

I However, to illustrate the general idea, let us assume that we do not have sufficient memory for this product.

I More specifically, we will assume that after each product operation we need to reduce the result transition system to four states to obey memory constraints.

I So we need to reduceT1 to four states. We have a lot of leeway in decidinghow exactly to abstractT1.

I In this example, we simply use an abstraction that leads to a good result in the end.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 13 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2:= some abstraction ofT1

LL LR

AL AR

BL BR

RL RR

MALR MARL

MALR MARL

MALR MARL

MALR MARL PAL

DAL

PADARR

PBR DBL DBR

PBL

PBL DBL

DBR PBR

MB?? MB??

MB?? MB??

MB?? MB??

MB?? MB??

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 14 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2 := some abstraction ofT1

LL LR

AL AR

BL BR

R

MALR MARL

MALR MARL

MALR MARL PAL

DAL

DAR PAR

DBRPBR DBL

PBL

PBL DBL

DBR PBR MB??

MB?? MB??

MB??

MB??

M???

MB??

current collection: {T2,Tπ{truck B}}

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2:= some abstraction ofT1

LL LR

AL AR

AL AR

BL BR

R

MALR MARL

MALR MARL

MALR MARL PAL

DAL

DAR PAR

DBRPBR DBL

PBL

PBL DBL

DBR PBR MB??

MB?? MB??

MB??

MB??

M???

MB??

current collection: {T2,Tπ{truck B}}

(5)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2 := some abstraction ofT1

LL LR

A

BL BR

R

MALR MARL

MALR MARL PAL

DAL

DAR PAR

DBRPBR DBL

PBL

PBL DBL

DBR PBR MB??

M???

MB??

MB??

M???

MB??

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 17 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2:= some abstraction ofT1

LL LR

A

BL BR

BL BR

R

MALR MARL

MALR MARL PAL

DAL

DAR PAR

DBRPBR DBL

PBL

PBL DBL

DBR PBR MB??

M???

MB??

MB??

M???

MB??

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 18 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2 := some abstraction ofT1

LL LR

A

B

R

MALR MARL

PAL DAL

DAR PAR

PBR DBL DBR

PBL PBL DBL MB??

M???

MB??

M???

M???

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 19 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2:= some abstraction ofT1

LL LR

A A

B B

R

MALR MARL

PAL DAL

DAR PAR

PBR DBL DBR

PBL PBL DBL MB??

M???

MB??

M???

M???

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 20 / 41

(6)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2 := some abstraction ofT1

LL LR I R

MALR MARL MB??

MB??

D?R M???

P?R M???

PBL DBL P?L D?L

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 21 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

First Shrink Step

T2:= some abstraction ofT1

LL LR I R

MALR MARL MB??

MB??

D?R M???

P?R M???

PBL DBL P?L D?L

current collection: {T2,Tπ{truck B}}

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 22 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Second Merge Step

T3 :=T2⊗ Tπ{truck B}: LRL

LRR

LLL

LLR

IL

IR

RL

RR

MBLR MBRL

MBLR MBRL

MBLR MBRL

MBLR MBRL DAR

PAR

D?R P?R P?L

D?L

PAL DAL MALR MARL MALR MARL

PBL DBL

MA??

MA?? MA??

MA??

current collection: {T3}

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Another Shrink Step?

I Normally we could stop now and use the distances in the final abstract transition system as our heuristic function.

I However, if there were further state variables to integrate, we would simplify further, e.g. leading to the following

abstraction (again with four states):

LRR LLLLRL

LLR I R

M??? M???

M???

M?RL M?LR

P?L D?L

D?R P?R

I We get a heuristic value of 3 for the initial state,better than any PDB heuristicthat is a proper abstraction.

I The example generalizes to more locations and trucks, even if we stick to the size limit of 4 (after merging).

(7)

D7. M&S: Generic Algorithm and Heuristic Properties Generic Algorithm

Generic Algorithm Template

Generic Merge & Shrink Algorithm abs := {Tπ{v} |v ∈V}

whileabs contains more than one abstract transition system:

selectA1,A2 from abs

shrinkA1 and/orA2 until size(A1)·size(A2)≤N abs :=abs \ {A1,A2} ∪ {A1⊗ A2}

return the remaining abstract transition system inabs N: parameter bounding number of abstract states Questions for practical implementation:

I Which abstractions to select? merging strategy

I How to shrink an abstraction? shrinking strategy

I How to chooseN? usually: as high as memory allows

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 25 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

D7.2 Heuristic Properties

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 26 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Content of this Course: Merge & Shrink

Merge & Shrink

Synchronized Product Merge & Shrink Algorithm

Heuristic Properties Strategies Label Reduction

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 27 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Heuristic Properties

I Each iteration of the algorithm corresponds to a

transformation of the collection absof transition systems.

I The exact transformation depends on the specific instantiation of the generic algorithm

(e.g. of the merging and the shrinking strategy).

I For analyzing the properties of the resulting heuristic, we analyze properties of the individual transformations.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 28 / 41

(8)

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Collections of Transition Systems

Definition (Collection of Transition Systems)

A set X of transition systems is a collection of transition systemsif allT ∈X have the same set of labels and the same cost function.

Thecombined systemis TX :=N

T ∈XT.

Remark: Strictly speaking, the combined system is not well-defined as the Cartesian product is neither commutative nor associative.

For our purpose it is sufficient that the results of all possible combination orders are isomorphic.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 29 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Safe Transformations

Definition (Safe Transformation)

LetX andX0 be collections of transition systems with label setsL andL0 and cost functionsc andc0, respectively.

The transformation fromX to X0 is safeif there exist functions σ andλ mapping the states and labels ofTX to the states and labels ofTX0 such that

I c0(λ(`))≤c(`) for all`∈L,

I ifhs, `,ti is a transition ofTX then hσ(s), λ(`), σ(t)i is a transition of TX0, and

I ifs is a goal state of TX thenσ(s) is a goal state ofTX0.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 30 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Examples

X: Collection of transition systems

Replacement with Synchronized Product is Safe

Let T1,T2 ∈X withT1 6=T2. The transformation fromX to X0 := (X\ {T1,T2})∪ {T1⊗ T2} is safe withσ = id andλ= id.

Abstraction is Safe

Let αbe an abstraction for Ti ∈X. The transformation fromX to X0 := (X\ {Ti})∪ {Tiα} is safe withλ= id and

σ(hs1, . . . ,sni) =hs1, . . . ,si−1, α(si),si+1, . . . ,sni.

(Proofs omitted.)

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Heuristic Properties (1)

Theorem

Let X and X0 be collections of transition systems. If the

transformation from X to X0 is safewith functionsσ andλthen h(s) =hT

X0(σ(s))is a safe, goal-aware, admissible, and consistent heuristic forTX.

Proof.

We prove goal-awareness and consistency, the other properties follow from these two.

Goal-awareness: For all goal states s? of TX, stateσ(s?) is a goal state of TX0 and therefore h(s?) =hT

X0(σ(s?)) = 0. . . .

(9)

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Heuristic Properties (2)

Proof (continued).

Consistency: Letc andc0 be the label cost functions of X andX0, respectively. Consider states of TX and transitionhs, `,ti.

As TX0 has a transitionhσ(s), λ(`), σ(t)i, it holds that h(s) =hT

X0(σ(s))

≤c0(λ(`)) +hT

X0(σ(t))

=c0(λ(`)) +h(t)

≤c(`) +h(t)

The second inequality holds due to the requirement on the label costs.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 33 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Exact Transformations

Definition (Exact Transformation)

LetX andX0 be collections of transition systems with label setsL andL0 and cost functionsc andc0, respectively.

The transformation fromX toX0 is exactif there exist functionsσ andλ mapping the states and labels ofTX to the states and labels ofTX0 such that

1 σ andλ satisfy the requirements of safe transformations,

2 ifhs0, `0,t0iis a transition ofTX0 thenhs, `,tiis a transition of TX for all s ∈σ−1(s0),t∈σ−1(t0) and some`∈λ−1(`0),

3 ifs0 is a goal state of TX0 then all states s ∈σ−1(s0) are goal states ofTX, and

4 c(`) =c0(λ(`)) for all `∈L.

no “new” transitions and goal states, no cheaper labels

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 34 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Examples

Replacement with Synchronized Product is Exact

Let T1,T2 ∈X withT1 6=T2. The transformation fromX to X0 := (X\ {T1,T2})∪ {T1⊗ T2} is exact withσ= id and λ= id.

(Proof omitted.)

More examples will follow.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 35 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Heuristic Properties with Exact Transformations (1)

Theorem

Let X and X0 be collections of transition systems. If the

transformation from X to X0 is exactwith functions σ andλ then hT

X(s) =hT

X0(σ(s)).

Proof.

As the transformation is safe,hT

X0(σ(s)) is admissible forTX and therefore hT

X(s)≥hT

X0(σ(s)).

For the other direction, we show that for every states0 ofTX0 and goal pathπ0 for s0, there is for each s ∈σ−1(s0) a goal path inTX

that has the same cost. . . .

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 36 / 41

(10)

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Heuristic Properties with Exact Transformations (2)

Proof (continued).

Proof via induction over the length of π0.

0|= 0: If s0 is a goal state ofTX0 then eachs ∈σ−1(s0) is a goal state of TX and the empty path is a goal path for s in TX.

0|=i+ 1: Letπ0 =hs0, `0,t00t0, where π0t0 is a goal path of length i from t0. Then there is for each t ∈σ−1(t0) a goal pathπt of the same cost in TX. Furthermore, for alls ∈σ−1(s0) there is a label`∈λ−1(`0) such that TX has a transitionhs, `,ti with t ∈σ−1(t0). The path π=hs, `,tiπt is a solution fors inT. As` and`0 must have the same cost andπt andπt00 have the same cost, π has the same cost asπ0.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 37 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Sequences of Transformations

Theorem (Sequences of Transformations)

Let X1, . . . ,Xn be collections of transition systems.

If for i ∈ {1, . . . ,n−1} the transformation from Xi to Xi+1 is safe (exact) then the transformation from X1 to Xn is safe (exact).

Proof idea: The composition of the σ andλ functions of each step satisfy the required conditions.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 38 / 41

D7. M&S: Generic Algorithm and Heuristic Properties Heuristic Properties

Consequences

Generic Merge & Shrink Algorithm abs := {Tπ{v} |v ∈V} =: X0

whileabs contains more than one abstract transition system:

selectA1,A2 from abs

shrinkA1 and/orA2 until size(A1)·size(A2)≤N abs :=abs \ {A1,A2} ∪ {A1⊗ A2}

return the remaining abstract transition system inabs

I Initially Tabs is the concrete transition system.

I Each iteration performs a safe transformation of abs.

→the corresponding abstraction heuristic is safe, goal-aware,

→consistent, and admissible.

I If shrinking is exact, the corresponding heuristic is perfect.

D7. M&S: Generic Algorithm and Heuristic Properties Summary

D7.3 Summary

(11)

D7. M&S: Generic Algorithm and Heuristic Properties Summary

Summary

I Projections perfectlyreflecta few state variables.

Merge-and-shrink abstractions are ageneralization that can reflectallstate variables, but in apotentially lossy way.

I Themerge stepscombine two abstract transition systems by replacing them with theirsynchronized product.

I Theshrink stepsmake an abstract system smaller by abstracting it further.

I As we only use safe transformations, the resulting heuristic is alwaysadmissible.

I If we use onlyexacttransformations, the resulting heuristic is perfect.

G. R¨oger, T. Keller (Universit¨at Basel) Planning and Optimization November 7, 2018 41 / 41

Referenzen

ÄHNLICHE DOKUMENTE

In particular, we adapt a merge strategy from model checking to planning, provide a framework to enhance existing merge strategies based on symmetries, devise a simple score-based

define a limit N on the number of states allowed in each factor in each iteration, select two factors we would like to merge merge them if this does not exhaust the state number

I Hence we now look at the transition systems for atomic projections of our example task, including transition labels. I We abbreviate operator names as in

Hence we now look at the transition systems for atomic projections of our example task, including transition labels. We abbreviate operator names as in

The merge steps combine two abstract transition systems by replacing them with their synchronized product. The shrink steps make an abstract system smaller by abstracting

To contribute to the knowledge on inbreeding depression and plant mating system evolution, I performed a greenhouse experiment in which I estimated inbreeding depression on

First, gov- ernments need to collect data across the three pillars, including on land use, soil and water resources, biodiversity, carbon stocks, transport infrastructure,

The SOC 4400 is a high speed document recorder which records alphanumeric output directly from a computer or computer-generated tapes onto 16mm microfilm for use