Abstraction

Preview:

Citation preview

AbstractionFrom Reality to a model

To answer questions

Classic AI problem:Water Jug

Two Jugs: 2 liters and 5 liters

You can empty the water from a completely

You can pour the contents of one jar into the other

Goal: To have a jug with exactly 1 liter of water

You can fill them up completely from a water source

Water Jug AbstractionDetermine what is essential for model to solve

problemSimplify model of reality

Many levels of Abstraction

Modeling Water in a Jug

Levels of abstraction: Water as molecule

Absorption Spectra of water

Why microwave oven works

(IR spectra)Why water is blue’(visible absorbtion

spectra)

QM Electronic Structure

Numerical models

But not the right level of abstraction for our problem

Modeling Water in a Jug

Levels of abstraction: Water as a fluid

Hydrogen bonding:Why water is a fluid

Computational Fluid Dynamics flow in a pipe

Surface Tension

But still not the right level of abstraction for our problem

Modeling Water in a Jug

Measuring milliliters

Measuring cups

Cubic meters

Water in a lake

Weight in grams

We are closer….We are measuring

water

Do we care about units?Do we care about the

container?

Modeling Water in a Jug

Do we care about units?Do we care about the container?

2 congli and 5 congli 2 uma and 5 uma

2 gallons and 5 gallons2 ml and 5 ml

2 liters and 5 liters 2 cm3 and 5 cm3

2 sextarius and 5 sextarius

Modeling Water in a Jug

Do we care about units?Do we care about the container?

NO!2 5

Just two arithmetic numbersAlmost any type: Reals, integers, decimals, …..

We just need to add and subtract them

Levels of AbstractionModeling of water

Water can be a molecule Microscopic view of water

Water can be an electronic structure Electronic view of water

Water can be a liquid Macroscopic view of water

Water can be measured Using properties of water

Why Levels of Abstraction?

There is no reason why we cannot use a Computational fluid dynamic model of water

flowing between the jugsTo solve our problem

Why not?We are lazy

Water Jug Problem Solution

Why Levels of Abstraction?

More official answerWe have only so much computing

powerThat is why there is no model for everything

Why is water blue

Why does a microwave workHow to solve the water jugs problem

Answers to all my

questions

TheOracle

The modeler has to make choices of what to model

Two Jugswith water

Don’t care what they are made of…..Don’t care how big they are …. Except that one holds 2 of something and the other holds 5 of something

Placeholders for how much water in each jug

(Jug 1 amount, jug 2 amount)This is (vector) representation of the

state of the system of two jugs of water

Jugs with water

(Jug 1 amount, jug 2 amount)Both jugs are empty (0,0)

Both jugs are full (2,5)Both jugs are partially full (1,4)Reached goal of our problem

(0,3)

Impossible situation (4,7)Different states of the system

Jugs with water

(Jug 1 amount, jug 2 amount)

Fill up jug one

(X,Y)

(2,Y)

Fill up jug two

(X,Y)

(X,5)

Empty jug one

(X,Y)

(0,Y)

Fill up jug two

(X,Y)

(X,0)

Simple Operations

Before oeprationTransformations

from one state of the system to

another state to another state of the system

After operation

Jugs with water

(Jug 1 amount, jug 2 amount)Other Operations

Pour jug one into jug twoIf all of water in jug one fits in jug two

(X,Y) (0,X+Y)With condition:X+Y

<= 5Pour jug two into jug two

(X,Y) (X+Y,0)With condition:X+Y

<= 2

If all of water in jug two fits in jug one

Jugs with water

(Jug 1 amount, jug 2 amount)Other Operations

Pour jug one into jug twoIf all of water in jug one does not fit in jug

two

(X,Y) (X1,5)Jug 2 is full with 5, but how much is in jug one?

X+Y > 5

X1 = X+Y - 5Jug one has what is left over

Jugs with water

(Jug 1 amount, jug 2 amount)Other Operations

Pour jug two into jug oneIf all of water in jug two does not fit in jug

one

(X,Y) (2,X1)Jug one is full with 2, but how much is in jug two?

X+Y > 2

X1 = X+Y - 2Jug two has what is left over

AbstractionRepresentation of the

jugs(Jug 1 amount, jug 2 amount)

Fill up jug one

(X,Y)

(2,Y)

Fill up jug two

(X,Y)

(X,5)

Empty jug one

(X,Y)

(0,Y)

Fill up jug two

(X,Y)

(X,0)

Pour one into two (X,Y)

(0,X+Y) X+Y<=5

(X,Y)

(X+Y-5,5) X+Y>5

Pour two into one (X,Y)

(X+Y,0) X+Y<=2

(X,Y)

(2,X+Y-2) X+Y>2

Operations/Rules working on this representationR1

R5R6R7R8

R2R3R4

Use StructuresUse the data structures and rules to search for solution

A solutionEmpty Jugs

(0,0) Fill up jug two

(X,Y)

(X,5)(0,5)

R2

Pour two into one (X,Y)

(2,X+Y-2) X+Y>2(2,3)

R8

Empty jug one

(X,Y)

(0,Y)(0,3)

R3

Pour two into one (X,Y)

(2,X+Y-2) X+Y>2(2,1)

R8

Empty jug one

(X,Y)

(0,Y)(0,1) Done

R3

Use Structures

(0,0)

(2,3)

(0,5)

(2,1)

(0,3)

(0,1)

R2

R3

R8

R3

R8

Consecutive

UseOf

Rules

Graph Search(0,0)

(2,3)

(0,5)

(2,1)

(0,3)

(0,1)

R2

R3

R8

R3

R8 (0,2)

(0,4)

(2,2)

(2,4)R1

R5

R1

R5

(2,0)

R1

(1,5)R6

Every Branch

is an Alternativ

ecombinati

on

Graph Search

Each node is the state of the system

Each connection is a rule that operates on that state

Types of graph search

Decides the order of which node to use a rule onAnd The order of which rules to apply