• No results found

AINN ICT4101 FS

N/A
N/A
Protected

Academic year: 2020

Share "AINN ICT4101 FS"

Copied!
33
0
0

Loading.... (view fulltext now)

Full text

(1)

What is a satisfiability problem?

SAT: propositional satisfiability problem given a Boolean formula in CNF, find an interpretation that makes it true.

CNF: conjunctive normal form, conjunction of disjunctions

interpretation: assignment of truth values to literals (propositions)

(2)

SAT Example

(A ∨ B) ∧ (¬A ∨ C)

Possible interpretations are: A : T, B : T, C: T

A : T, B : F, C: T A : F, B : T, C: T A : F, B : T, C: F

But not one that assigns F to both A and B.

(3)

SAT formulas for planning

If these are the initial conditions, these are the desired goals, which action(s) would be executed at time 0, at time 1, and so on.

An assignment would, for example, assign F to dollying at time 0, but T to wrapping at time 0.

(4)

SAT-based planning architecture

Decoder plan Initial state

Goal Actions

Compiler CNF Simplifier CNF Solver

Symbol table

Increment time bound if unsatisfiable

satisfying assignment

(5)

The SATPLAN algorithm

function SATPLAN (problem, Tmax)

returns a solution, or failure

inputs: problem, a planning problem

inputs: Tmax, an upper limit for plan length

for T = 0 to Tmax do

cnf, mappingTRANSLATE-TO-SAT(problem, T) assignment ← SAT-SOLVER(cnf)

if assignment is not null then

return EXTRACT-SOLUTION(assignment,mapping) return failure

(6)

Solving SAT problems

Systematic solvers perform a backtracking search in the space of possible assignments

Stochastic solvers perform a random search.

It is possible to simplify formulas before processing If there are unit clauses, i.e., clauses with one literal, the literal should be assigned true.

If there are pure literals, i.e., those can be assigned true because such an assignment cannot make the clause false.

(7)

Unit clauses and pure literals

Consider the following CNF formula

(A∨B∨¬E)∧(B∨¬C∨D)∧(¬A)∧(B∨C∨E)∧(¬D∨¬E)

It becomes

(B ∨ ¬E) ∧ (B ∨ ¬C ∨ D) ∧ (B ∨ C ∨ E) ∧ (¬D ∨ ¬E)

after the unit clause (¬A) causes ¬A to be assigned true.

It reduces to

(¬D ∨ ¬E)

after the pure literal B is assigned true.

The DPLL (Davis Putnam Logemann Loveland)

algorithm uses these operations to simplify formulas

(8)

The DPLL Algorithm

function DPLL (clauses, symbols, model)

returns true or false

inputs: clauses, the set of clauses in the CNF representation

inputs: symbols, a list of the proposition symbols in the formula

inputs: model, an assignment of truth values to the propositions

if every clause in clauses is true in model then return true

if some clause in clauses is false in model then return false P, value ← FIND-PURE-SYMBOL (symbols, clauses, model)

if P is non-null then return

DPLL(clauses, symbols - P, EXTEND ( P, value, model))

P, value ← FIND-UNIT-CLAUSE (clauses, model)

if P is non-null then return

DPLL(clauses, symbols - P, EXTEND ( P, value, model))

P ← FIRST(symbols); rest ← REST(symbols)

return DPLL(clauses, rest, EXTEND ( P, true, model)) or return DPLL(clauses, rest, EXTEND ( P, false, model))

(9)

The GSAT Algorithm

function GSAT (clauses, max-restarts, max-flips)

returns a satisying model, or failure

inputs: clauses, the set of clauses in the CNF representation

inputs: max-restarts, the number of restarts

inputs: max-flips, the number of flips allowed before giving up

for i = 1 to max-restarts do

model ← a randomly generated truth assignment

for i = 1 to max-flips do

if every clause in clauses is true in model then return model

else

V ← a variable whose change gives the largest increase in the

V ← number of satisfied clauses; break ties randomly

modelmodel with the assignment of V flipped

return failure

(10)

The WALKSAT Algorithm

function WALKSAT (clauses, p, max-flips) returns a satisying model, or failure

inputs: clauses, the set of clauses in the CNF representation

inputs: p, the probability of choosing to do a “random walk” move , inputs: p, typically around 0.5

inputs: max-flips, the number of flips allowed before giving up

model ← a randomly generated truth assignment

for i = 1 to max-flips do

if every clause in clauses is true in model then return model clausea randomly selected clause from clauses

clausethat is false in model

with probability p flip the value in model of a randomly selected symbol from clause

else flip whichever symbol in clause

maximizes the number of satisfied clauses

return failure

(11)

Hierarchical Task Network (HTN) Planning

Section 11.2

(12)

Outline

Example

Primitive vs. non-primitive operators

HTN planning algorithm

Practical planners

Additional references used for the slides:

desJardins, M. (2001). CMSC 671 slides. www.cs.umbc.edu

(13)

Hierarchical Task Network (HTN) planning

Idea: Many tasks in real life already have a built-in hierarchical structure

For example: a computational task, a military mission, an administrative task

It would be a waste of time to construct plans from individual operators. Using the built-in hierarchy help escape from exponential explosion

Running example: the activity of building a house consists of obtaining the necessary permits, finding a builder, constructing the exterior/interior, ...

HTN approach: use abstract operators as well as primitive operators during plan generation.

(14)

Building a house

Obtain Permit Construct Pay Builder Hire Builder decomposes to decomposes to Build House Build Foundation Build Frame Build Roof Build Walls Build Interior

(15)

Hierarchical decomposition

HTN is suitable for domains where tasks are naturally organized in a hierarchy.

Uses abstract operators to start a plan.

Use partial-order planning techniques and action decomposition to come up with the final plan

The final plan contains only primitive operators. What is to be considered primitive is subjective:

what an agent considers as primitive can be another agent’s plans.

(16)

Representing action decompositions

A plan library contains both primitive and non-primitive actions.

Non-primitive actions have external preconditions, as well as external effects.

Sometimes useful to distinguish between primary effects and secondary effects.

(17)

Building a house with causal links

Pay Builder Obtain

Permit

Construct

Hire Builder

decomposes to

Build House

Land House

Land

Money

House

~ Money

Start Finish

(18)

Another way of building a house

Construct Obtain

Permit

Get Friend

decomposes to

Build House

Land House

Land

House

BadBack

Start Finish

Cut logs

GoodFriend

(19)

Example action descriptions

Action(BuyLand, PRECOND:Money, EFFECT: Land ∧¬ Money)

Action(GetLoan, PRECOND:GoodCredit, EFFECT: Money ∧ Mortgage)

Action(BuildHouse, PRECOND:Land, EFFECT: House)

Action(GetPermit, PRECOND:Land, EFFECT: Permit)

Action(HireBuilder, EFFECT: Contract)

Action(Construct, PRECOND:PermitContract,

EFFECT: HouseBuilt ∧¬ Permit)

Action(PayBuilder, PRECOND:MoneyHouseBuilt,

EFFECT: ¬ MoneyHouse ∧¬ Contract)

(20)

Example action descriptions

Decompose(BuildHouse,

Plan(STEPS:{S1: GetPermit, S2: HireBuilder,

Plan(STEPS:{ S3: Construction, S4: PayBuilder,}

Plan( ORDERINGS: { Start ≺ S1 ≺ S2 ≺ S3 ≺ S4 ≺ F inish,

Plan( ORDERINGS: { Start ≺ S2 ≺ S3 },

Plan( LINKS: { Start Land

−−−→ S1, Start M oney−−−−→ S4,

Plan( LINKS: { S1 P ermit

−−−−−→ S3, S2 Contract−−−−−−→ S3, S3 HouseBuilt−−−−−−−−→ S4,

Plan( LINKS: { S4 House

−−−−→ F inish, S4 ¬−−−−−M oney F inish}))

(21)

Information hiding

The high-level description hides all the internal effects of decompositions (e.g., P ermit and

C ontract).

It also hides the duration the internal preconditions and effects hold.

Advantage: reduces complexity by hiding details

Disadvantage: conflicts are hidden too

(22)

Example

Start Pay Builder Finish Finish Buy Land Get Permit Construct Hire Builder decomposes to Build House House House ~ Money Start Land Buy Land GetLoan Money GoodCredit Land Money Money ~ Money

(23)

HTN planners

Most industrial strength planners are HTN based.

O-PLAN combines HTN planning with scheduling to

develop production plans for Hitachi.

SIPE-2 is an HTN planner with many advanced

features

SHOP is an HTN planner developed at the University

of Maryland. It can deal with action durations.

(24)

Planning and Scheduling with Time and Resources

Section 11.1

(25)

Planning vs. scheduling

Planning

Involves choice of actions

Cannot deal with time and resource constraints

Scheduling

Can easily represent time and resource constraints

Cannot deal with action choices

Most real world problems are optimization problems that involve continuous time, resources, metric

quantities, and a complex mixture of action choices and ordering decisions.

(26)

Planning vs. scheduling

Planning problem Scheduling problem

Initial state, goals set of jobs

(possibly partially ordered) action descriptions temporal constraints on jobs

(EST, LFT, duration) resource constraints Synthesize a sequence Assign optimal start

of actions times and resources

(27)

Dealing with time

EST: earliest start time LFT: latest finish time duration

CPM: critical path method. A path is a sequence of actions that depend on each other. A critical path is the longest path. Delaying it would delay the entire plan.

(28)

Example

Init (Chassis(C1) ∧ Chassis(C

2) ∧ Engine(E1,C1,30) ∧ Engine(E

2,C2,60) ∧ Wheels(W1,C1,30) ∧ Wheels(W

2,C2,15)) Goal(Done(C1) ∧ Done(C

2))

Action(AddEngine(e,c),

PRECOND: Engine(e,c,d) ∧ Chassis(c) ∧¬ EngineIn(c)

EFFECT: EngineIn(c) ∧ Duration(d))

Action(AddWheels(w,c),

PRECOND: Wheels(w,c,d) ∧ Chassis(c) ∧ EngineIn(c)

EFFECT: WheelsOn(c) ∧ Duration(d))

Action(Inspect(c),

PRECOND: EngineIn(c) ∧ WheelsOn(c) ∧ Chassis(c)

EFFECT: Done(c) ∧ Duration(10))

(29)

Example

0 10 20 30 40 50 60 70 80 90

[0,0] [0,15] 30 [30,45] 30 [60,75] 10 [0,0] 60 [60,60] 15 [75,75] 10 [85,85] AddEngine1 AddWheels1 Inspect1 AddEngine2 AddWheels2 Start Inspect1 Finish Inspect2 AddEngine1 Addwheels1 AddEngine2 Addwheels2 Inspect2

(30)

Dealing with resources

reusable resource: is occupied during an action, and is freed afterwards

aggregation of resources: group indistinguishable resources into quantities

Minimum slack algorithm: a greedy algorithm

(31)

Example

Init (Chassis(C1) ∧ Chassis(C

2) ∧ Engine(E1,C1,30) ∧ Engine(E2,C2,60) ∧ Wheels(W

1,C1,30) ∧ Wheels(W2,C2,15) ∧ EngineHoists(1) ∧ WheelStations(1) ∧ Inspectors(2))

Goal(Done(C

1) ∧ Done(C2)) Action(AddEngine(e,c),

PRECOND: Engine(e,c,d) ∧ Chassis(c) ∧¬ EngineIn(c)

EFFECT: EngineIn(c) ∧ Duration(d)

RESOURCE: EngineHoists(1))

Action(AddWheels(w,c),

PRECOND: Wheels(w,c,d) ∧ Chassis(c) ∧ EngineIn(c)

EFFECT: WheelsOn(c) ∧ Duration(d)

RESOURCE: WheelStations(1))

Action(Inspect(c),

PRECOND: EngineIn(c) ∧ WheelsOn(c) ∧ Chassis(c)

EFFECT: Done(c) ∧ Duration(10)

RESOURCE: Inspectors(1))

(32)

Example

0 10 20 30 40 50 60 70 80 90 100 110 120

EngineHoists(1)

WheelStations(1)

Inspectors(2)

AddEngine2

AddWheels2

Inspect2 AddEngine1

AddWheels1

Inspect1

(33)

Planner-scheduler interface

Planner

Causal plan

Optimal

schedule

Scheduler

Each can do its own job. The big question is how best to couple them to avoid inter-module trashing.

The second big question is which planners are most suitable for coupling.

References

Related documents

 Moinuddin Tadrees-E-Urdu-, (For B.Ed)..  Moulvi Saleem Urdu Kaise Padhaen -.Chaman Book Depot, Delhi.  Padhane Ka Maza-Muriel Wasi N.C.E.R.T., New Delhi..  Understand the

His 10 years of insurance industry experience provides clients with practical claims handling and coverage advice with a focus on regulatory compliance and bad faith prevention?.

Established in 2008 with funding from the Ontario Ministry of Health and Long Term Care, The Institute provides ongoing educational support, professional develop- ment and

• Toggle between thermal, day and night cameras • HD DVR for camera payload. • Dimmable

If claim is partially secured, fill in total claim amount and deduction for value of collateral or setoff to calculate unsecured claim. Total claim, if

This website is kept up to date as study space hours evolve to meet student need, state executive orders, and/or University operating

Living Water – Naval Filling Station envisions being the leading provider of safe and healthy drinkable water at the most affordable price; educating fathers, mothers and children

Lesson 1 Hebrew Alphabet Study Method Letter: Aleph Letter: Bet/Vet Lesson 2 Vowel sounds Vowel: Kamatz Combining letters Letter: Gimmel Vowel: Patach... Vowel: