Attachment 'singe.pl'
Download 1 /* STRIPS programmé par Jean-Gabriel Ganascia */
2
3
4 test(Plan):- etat_initial(I), etat_final(F), resoudre(I, [F], Plan).
5
6 resoudre(_, [], []).
7 resoudre(Etat, [L|Buts], Plan) :- is_list(L), subset(L, Etat), !, marquer(1, Etat, Buts, Plan), resoudre(Etat,Buts,Plan).
8 resoudre(Etat, [L|Buts], Plan) :- is_list(L), !, subtract(L, Etat, LL), append(LL, [L|Buts], NButs), marquer(2, Etat, NButs, Plan), resoudre(Etat, NButs, Plan).
9 resoudre(Etat, [operateur(Op)|Buts], [Op|Plan]) :- !, appliquer_operateur(Etat, Op, NEtat), marquer(3, NEtat, Buts, Plan), resoudre(NEtat, Buts, Plan).
10 resoudre(Etat, [But|Buts], Plan) :- member(But, Etat), !,marquer(4, Etat, Buts, Plan), resoudre(Etat, Buts, Plan).
11 resoudre(Etat, [But|Buts], Plan) :- trouver_operateur(Etat, But, Op, P), intersection(P, Buts, []), operateur(Op, Preconds, _,_), marquer(5, Etat, [Preconds,operateur(Op),But|Buts], Plan), resoudre(Etat, [Preconds,operateur(Op),But|Buts], Plan).
12
13 marquer(N, E, B, P):- write('Appel prédicat résoudre '), write(N), nl, write('\tEtat: '), write(E), write('; Plan: '), write(P), nl, write('\tButs: '), write(B), nl.
14 trouver_operateur(Etat, But, Op, []) :- clause(operateur(Op, Preconds, _, AListe),Q), member(But, AListe), soustraction(Preconds, Etat,[]), call(Q), term_variables(Op,[]).
15 trouver_operateur(Etat, But, Op, [T|S]) :- clause(operateur(Op, Preconds, _, AListe),Q), member(But, AListe), soustraction(Preconds, Etat,[T|S]), call(Q), term_variables(Op,[]).
16
17 appliquer_operateur(Etat, Op, NEtat) :- operateur(Op, _, Dliste, Aliste), subtract(Etat, Dliste, DEtat), union(DEtat, Aliste, NEtat), write('Application opérateur '), write(Op), write('\n\tNouvel état: '), write(NEtat), nl.
18
19 soustraction([], _, []).
20 soustraction([X|L], D, LL) :- member(X, D), soustraction(L, D, LL).
21 soustraction([X|L], D, [X|LL]) :- soustraction(L, D, LL).
22
23 /************* Singe et bananes ****************/
24 etat_initial([position(caisse, u1), position(bananes, u2), position(singe,u3)]).
25 etat_final([possede(singe, bananes)]).
26
27 operateur(deplacer(P, Q), [position(singe, P)], [position(singe, P)], [position(singe, Q)]) :- \+ P == Q.
28 operateur(pousser(U, V), [position(singe, U), position(caisse, U)], [position(singe, U), position(caisse, U)], [position(singe, V), position(caisse, V)]) :- \+ U == V.
29 operateur(cueillir_bananes(U), [position(singe, U), position(caisse, U), position(bananes,U)], [], [possede(singe, bananes)]).
Attached Files
To refer to attachments on a page, use attachment:filename, as shown below in the list of files. Do NOT use the URL of the [get] link, since this is subject to change and can break easily.- [get | view] (2014-02-19 20:37:52, 6821.9 KB) [[attachment:ASP1.pdf]]
- [get | view] (2014-02-19 20:40:35, 15244.5 KB) [[attachment:ASP_fin.pdf]]
- [get | view] (2014-01-30 06:10:01, 5494.8 KB) [[attachment:CLIPS.pdf]]
- [get | view] (2014-02-07 18:26:18, 6258.3 KB) [[attachment:ModelRaisonnement.pdf]]
- [get | view] (2014-01-30 06:12:52, 12888.5 KB) [[attachment:RETE.pdf]]
- [get | view] (2014-04-05 04:52:48, 20016.3 KB) [[attachment:RaPC.pdf]]
- [get | view] (2014-02-07 18:26:37, 5059.6 KB) [[attachment:RaisonnementNonMonotone.pdf]]
- [get | view] (2014-01-24 07:56:33, 957.4 KB) [[attachment:ResPbs.pdf]]
- [get | view] (2014-03-12 16:40:37, 2.8 KB) [[attachment:STRIPS_druide.pl]]
- [get | view] (2014-01-24 08:28:42, 10777.8 KB) [[attachment:SysProdMIA1.pdf]]
- [get | view] (2014-01-20 16:33:54, 24.7 KB) [[attachment:UPMCp.jpg]]
- [get | view] (2014-01-30 06:57:09, 0.8 KB) [[attachment:aristote.clp]]
- [get | view] (2014-01-24 09:44:07, 0.9 KB) [[attachment:base1.pl]]
- [get | view] (2014-01-24 09:44:26, 2.8 KB) [[attachment:base2.pl]]
- [get | view] (2014-01-30 06:07:39, 2.6 KB) [[attachment:base2plus.pl]]
- [get | view] (2014-03-28 20:59:38, 1.0 KB) [[attachment:blocs.sm]]
- [get | view] (2014-03-29 16:49:03, 1.0 KB) [[attachment:blocsASP.sm]]
- [get | view] (2014-01-30 06:57:24, 1.8 KB) [[attachment:copernic.clp]]
- [get | view] (2014-01-30 06:57:48, 2.0 KB) [[attachment:galilee.clp]]
- [get | view] (2014-01-24 07:51:58, 2099.8 KB) [[attachment:introduction.pdf]]
- [get | view] (2014-03-12 12:57:56, 3426.8 KB) [[attachment:jeux.pdf]]
- [get | view] (2014-01-24 09:43:52, 4.6 KB) [[attachment:moteur0.pl]]
- [get | view] (2014-01-30 06:07:14, 6.8 KB) [[attachment:moteur0plus.pl]]
- [get | view] (2014-01-30 06:10:31, 3.0 KB) [[attachment:nombres.clp]]
- [get | view] (2014-03-28 20:52:21, 2965.7 KB) [[attachment:planificationAction.pdf]]
- [get | view] (2014-03-12 16:36:02, 23015.4 KB) [[attachment:planification_1.pdf]]
- [get | view] (2014-03-28 20:38:14, 9302.0 KB) [[attachment:planification_fin.pdf]]
- [get | view] (2014-03-28 21:03:12, 11612.6 KB) [[attachment:raisonnementQualitatif.pdf]]
- [get | view] (2014-03-12 16:38:07, 2.4 KB) [[attachment:singe.pl]]
- [get | view] (2014-03-28 20:39:16, 3.6 KB) [[attachment:situation1.pl]]
- [get | view] (2014-03-28 20:39:38, 3.6 KB) [[attachment:situation2.pl]]
- [get | view] (2014-03-12 16:36:36, 2.9 KB) [[attachment:strips1.pl]]
- [get | view] (2014-03-12 16:36:52, 3.0 KB) [[attachment:strips2.pl]]
- [get | view] (2014-03-12 16:37:10, 3.1 KB) [[attachment:strips3.pl]]
- [get | view] (2014-03-12 16:37:32, 3.2 KB) [[attachment:strips4.pl]]
You are not allowed to attach a file to this page.