martes, 27 de septiembre de 2011

Ejercicios de Planificación

- Ejercicios de Planificación -

Ir de Compras

Estados:

· Estado_inicial -> At(casa) ᴧ ~Have(penca) ᴧ ~Have(taladro) ᴧ ~Have(leche) ᴧ Sell(SM, leche) ᴧ Sell(SM, penca) ᴧ Sell(Ferretería, taladro).

· Estado_final -> At(casa) ᴧ Have(penca) ᴧ Have(taladro) ᴧ Have(leche).

Predicados:

· At(x): estar en el lugar ‘x’.

· Have(x): tener la cosa ‘x’.

· Sell(x, y): la tienda ‘x’ vende la cosa ‘y’.


Operadores:

OP { ACTION: Go(there),

PRECOND: At(here),

EFFECT: At(there) ~At(here) }


OP { ACTION: Buy(thing),

PRECOND: At(store) Sell(store, thing),

EFFECT: Have(thing) }


OP { ACTION: Start,

PRECOND:( ),

EFFECT: (estado_inicial) }


OP { ACTION: Finish,

PRECOND:(estado_final),

EFFECT: ( ) }


El Mundo de los Cubos

Estados:

· Estado_inicial -> OnTable(cubo1) ᴧ On(cubo2, cubo1) ᴧ

On(cubo3, cubo2) Clear(cubo3) Empty().

· Estado_final -> Empty() ᴧ OnTable(cubo1) ᴧ OnTable(cubo2) ᴧ

OnTable(cubo3) ᴧ Clear(cubo1) ᴧ Clear(cubo2) ᴧ

Clear(cubo3).

Predicados:

· Holding(x): la garra está sosteniendo el cubo ‘x’.

· On(x, y): el cubo ‘x’ está encima del cubo ‘y’.

· Empty(): la garra no está sosteniendo un cubo alguno.

· OnTable(x): el cubo ‘x’ se encuentra sobre la mesa.

· Clear(x): el cubo ‘x’ no tiene cubo alguno sobre de él.


Operadores:

OP { ACTION: Pickup(cubo1, cubo2),

PRECOND: Empty() clear(cubo1) On(cubo1, cubo2),

EFFECT: Holding(cubo1) Clear(cubo2),

~Empty() ᴧ ~On(cubo1, cubo2) ᴧ ~Clear(cubo1) }


OP { ACTION: PickupFromTable(cubo),

PRECOND: Empty() Clear(cubo) OnTable(cubo),

EFFECT: Holding(cubo),

~Empty() ~OnTable(cubo) ~Clear(cubo) }


OP { ACTION: PutDown(cubo1, cubo2),

PRECOND: Holding(cubo1) clear(cubo2),

EFFECT: Empty() On(cubo1, cubo2) Clear(cubo1),

~Clear(cubo2) ~Holding(cubo1) }


OP { ACTION: PutDownOnTable(cubo),

PRECOND: Holding(cubo),

EFFECT: Empty() OnTable(cubo) Clear(cubo),

~Holding(cubo) }


OP { ACTION: Start,

PRECOND:( ),

EFFECT: (estado_inicial) }


OP { ACTION: Finish,

PRECOND:(estado_final),

EFFECT: ( ) }


El Mundo de Shakey

Estados:

· Estado_inicial -> Box(c1) Box(c2) Box(c3) Box(c4) Room(r1) Room(r2) Room(r3) Room(r4) Room(pasillo) On(r3) On(r2) Off(r1) Off(r4) At(c1, r1) At(c2, r1) At(c3, r1) At(c4, r1) At(shakey, pasillo).

· Estado_final -> At(c1, r1) At(c2, r1) At(c3, r1)

At(c4, r1) At(shakey, r1) Off(r1) Off(r2) Off(r3)

Off(r4).


Predicados:

· Box(x): ‘x’ es una caja.

· Room(x): ‘x’ es un cuarto.

· Shakey(x): ‘x’ es un robot.

· On(r): la luz de la habitación ‘r’ está encendida.

· Off(r): la luz de la habitación ‘r’ está apagada.

· At(x, r): ‘x’ está en la habitación ‘r’.

· Holding(x): shakey sostiene el objeto (caja) ‘x’.

· OnTop(x): shakey está encima de la caja ‘x’.

· Free(shakey): shakey no está sosteniendo ninguna caja.

· OnFloor(shakey): shakey está en el suelo.

Operadores:

OP { ACTION: TomarCaja(x),

PRECOND: Free(shakey) Caja(x) At(shakey, r)

At(x, r) OnFloor(shakey),

EFFECT: Holding(x) ~Free(shakey) }


OP { ACTION: ApagarCuarto(r),

PRECOND: Cuarto(r) On(r) At(shakey, r) OnTop(x),

EFFECT: ~On(r) }


OP { ACTION: SubirCaja(x),

PRECOND: Caja(x) Free(shakey) At(shakey, r)

At(x, r) OnFloor(shakey),

EFFECT: OnTop(x) ~OnFloor }


OP { ACTION: BajarCaja(x),

PRECOND: OnTop(x),

EFFECT: OnFloor(shakey) ~OnTop(x) }


OP { ACTION: DejarCaja(x),

PRECOND: Holding(x),

EFFECT: ~Holding(x) Free(shakey) }


OP { ACTION: EntrarCuarto(r),

PRECOND: At(shakey, pasillo) OnFloor(shakey),

EFFECT: At(shakey, r) ~At(shakey, pasillo) }


OP { ACTION: SalirCuarto(r),

PRECOND: At(shakey, r) OnFloor(shakey),

EFFECT: ~At(shakey, r) At(shakey, pasillo) }


OP { ACTION: SacarCaja(x),

PRECOND: Holding(x) At(shakey, r),

EFFECT: ~At(x, r) ~At(shakey, r)

At(shakey, pasillo) At(x, pasillo) }


OP { ACTION: MeterCaja(x),

PRECOND: Holding(x) At(shakey, pasillo),

EFFECT: At(x, r) At(shakey, r) ~At(shakey, pasillo)

~At(x, pasillo) }


OP { ACTION: Start,

PRECOND:( ),

EFFECT: (estado_inicial) }


OP { ACTION: Finish,

PRECOND:(estado_final),

EFFECT: ( ) }

martes, 13 de septiembre de 2011

Ejercicios de lógica de primer orden



Ejercicios de lógica de primer orden

No todos los estudiantes toman Inteligencia Artificial y Sistemas Distribuidos.
Ǝx Estudiante( x ) => ~[Toma(x, IA) ^ Toma(x, SD)]
Sólo un estudiante reprobó Inteligencia Artificial.
x,y Estudiante( x ) ^ Estudiante( y ) ^ Reprobar(x, IA) ^ Reprobar(y, IA) <==> x = y
Sólo un estudiante reprobó tanto Inteligencia Artificial como Sistemas Distribuidos.
x,y Estudiante( x ) ^ Estudiante( y ) ^ Reprobar(x, IA) ^ Reprobar(y, IA) ^ Reprobar(x, SD) ^ Reprobar(y, SD) <==> x = y
La mejor calificación en Inteligencia Artificial fue más alta que la primera calificación en Sistemas Distribuidos.
Calificacionmasalta(mejorcalificacion(AI), primeracalificacion(SD))
Cualquier persona a quien le caigan mal los vegetarianos es lista.
x,y CaerMal(x, y) ^ Vegetariano( y ) <==> Lista( x )
Nadie quiere a un vegetariano listo.
x,y vegetariano(y)  listo(y) => desagrada(x,y)
Existe una mujer que quiere a todos los hombres que no son vegetarianos.
y  ¬ vegetariano(y) hombre (y) => x mujer(x) ^ quiere(x,y)
Existe un barbero en la ciudad que rasura a todos los hombres que no se rasuran solos.
y  ¬ inexpertorasurador(y) hombre (y) => x barbero(x) ^ rasura (x,y)
Nadie quiere al profesor al menos que el profesor sea inteligente.
y  profesor(y)  ¬ listo(y) => ¬ x quiere(x,y)