From: Mart Lubbers Date: Thu, 30 Oct 2014 10:21:42 +0000 (+0100) Subject: update, het werkt nu maar niet efficient X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=36b2d748e1e638ca220e0badee05cafac7e23817;p=ker1415-1.git update, het werkt nu maar niet efficient --- diff --git a/report/src/domaintask1.pl b/report/src/domaintask1.pl index 1f41f38..20f6593 100644 --- a/report/src/domaintask1.pl +++ b/report/src/domaintask1.pl @@ -11,6 +11,7 @@ poss(move(From, To), S) :- agent(From, S), connected(From, To, _), not(crate(_, To, S)). + poss(push(From, Direction), S) :- agent(From, S), connected(From, CrateLocation, Direction), @@ -21,8 +22,8 @@ poss(push(From, Direction), S) :- % --- Successor state axioms ------------------------------------------ agent(AgentPlek, result(A, S)) :- A = move(_, AgentPlek); - A = push(OudeAgentPlek1, Richting), - connected(OudeAgentPlek1, AgentPlek, Richting); + A = push(OudeAgentPlek, Richting), + connected(OudeAgentPlek, AgentPlek, Richting); not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)), agent(AgentPlek, S). diff --git a/report/src/domaintask4.pl b/report/src/domaintask4.pl new file mode 100644 index 0000000..cdbcfe6 --- /dev/null +++ b/report/src/domaintask4.pl @@ -0,0 +1,36 @@ +% ------------------------- Domain Definition ------------------------- +% --- Cross-file definitions ------------------------------------------ +:- multifile connected/3, crate/3, agent/2. + +% --- Primitive control actions --------------------------------------- +primitive_action(move(_, _)). +primitive_action(push(_, _)). + +% --- Precondition for primitive actions ------------------------------ +poss(move(From, To), S) :- + agent(From, S), + connected(From, To, _), + not(crate(_, To, S)). +poss(push(From, Direction), S) :- + agent(From, S), + connected(From, CrateLocation, Direction), + crate(_, CrateLocation, S), + connected(CrateLocation, CrateTarget, Direction), + not(crate(_, CrateTarget, S)). + +% --- Successor state axioms ------------------------------------------ +agent(AgentPlek, result(A, S)) :- + A = move(_, AgentPlek); + A = push(OudeAgentPlek, Richting), + connected(OudeAgentPlek, AgentPlek, Richting); + not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)), + agent(AgentPlek, S). + +crate(Krat, Kratplek, result(A, S)) :- + A = push(AgentPlek, Richting), + connected(AgentPlek, OudeKratPlek, Richting), + connected(OudeKratPlek, Kratplek, Richting), + crate(Krat, OudeKratPlek, S); + not(A = push(AgentPlek2, Richting2)), + connected(AgentPlek2, Kratplek, Richting2), + crate(Krat, Kratplek, S). diff --git a/report/src/domaintask5.pl b/report/src/domaintask5.pl new file mode 100644 index 0000000..cdbcfe6 --- /dev/null +++ b/report/src/domaintask5.pl @@ -0,0 +1,36 @@ +% ------------------------- Domain Definition ------------------------- +% --- Cross-file definitions ------------------------------------------ +:- multifile connected/3, crate/3, agent/2. + +% --- Primitive control actions --------------------------------------- +primitive_action(move(_, _)). +primitive_action(push(_, _)). + +% --- Precondition for primitive actions ------------------------------ +poss(move(From, To), S) :- + agent(From, S), + connected(From, To, _), + not(crate(_, To, S)). +poss(push(From, Direction), S) :- + agent(From, S), + connected(From, CrateLocation, Direction), + crate(_, CrateLocation, S), + connected(CrateLocation, CrateTarget, Direction), + not(crate(_, CrateTarget, S)). + +% --- Successor state axioms ------------------------------------------ +agent(AgentPlek, result(A, S)) :- + A = move(_, AgentPlek); + A = push(OudeAgentPlek, Richting), + connected(OudeAgentPlek, AgentPlek, Richting); + not(A = move(AgentPlek, _)), not(A = push(AgentPlek, _)), + agent(AgentPlek, S). + +crate(Krat, Kratplek, result(A, S)) :- + A = push(AgentPlek, Richting), + connected(AgentPlek, OudeKratPlek, Richting), + connected(OudeKratPlek, Kratplek, Richting), + crate(Krat, OudeKratPlek, S); + not(A = push(AgentPlek2, Richting2)), + connected(AgentPlek2, Kratplek, Richting2), + crate(Krat, Kratplek, S). diff --git a/report/src/instancetask1.pl b/report/src/instancetask1.pl index ad091b2..28567c7 100644 --- a/report/src/instancetask1.pl +++ b/report/src/instancetask1.pl @@ -4,55 +4,61 @@ % --- Definition of the initial state --------------------------------- % north and east -connected(loc1-1, loc2-1, north). -connected(loc1-1, loc1-2, east). -connected(loc1-2, loc2-2, north). -connected(loc1-2, loc1-3, east). -connected(loc1-3, loc2-3, north). -connected(loc1-3, loc1-4, east). -connected(loc1-4, loc2-4, north). - -connected(loc2-1, loc3-1, north). -connected(loc2-1, loc2-2, east). -connected(loc2-2, loc3-2, north). -connected(loc2-2, loc2-3, east). -connected(loc2-3, loc3-3, north). -connected(loc2-3, loc2-4, east). - -connected(loc3-1, loc3-2, north). -connected(loc3-2, loc3-3, north). +connected(loc11, loc21, east). +connected(loc11, loc12, north). +connected(loc12, loc22, east). +connected(loc12, loc13, north). +connected(loc13, loc23, east). +connected(loc13, loc14, north). +connected(loc14, loc24, east). + +connected(loc21, loc31, east). +connected(loc21, loc22, north). +connected(loc22, loc32, east). +connected(loc22, loc23, north). +connected(loc23, loc33, east). +connected(loc23, loc24, north). + +connected(loc31, loc32, east). +connected(loc32, loc33, east). % The other way around, west and south -connected(loc2-1, loc1-1, south). -connected(loc1-2, loc1-1, west). -connected(loc2-2, loc1-2, south). -connected(loc1-3, loc1-2, west). -connected(loc2-3, loc1-3, south). -connected(loc1-4, loc1-3, west). -connected(loc2-4, loc1-4, south). - -connected(loc3-1, loc2-1, south). -connected(loc2-2, loc2-1, west). -connected(loc3-2, loc2-2, south). -connected(loc2-3, loc2-2, west). -connected(loc3-3, loc2-3, south). -connected(loc2-4, loc2-3, west). - -connected(loc3-2, loc3-1, south). -connected(loc3-3, loc3-2, south). +connected(loc21, loc11, west). +connected(loc12, loc11, south). +connected(loc22, loc12, west). +connected(loc13, loc12, south). +connected(loc23, loc13, west). +connected(loc14, loc13, south). +connected(loc24, loc14, west). + +connected(loc31, loc21, west). +connected(loc22, loc21, south). +connected(loc32, loc22, west). +connected(loc23, loc22, south). +connected(loc33, loc23, west). +connected(loc24, loc23, south). + +connected(loc32, loc31, west). +connected(loc33, loc32, west). %connected(X, Y, east) :- connected(Y, X, west). %connected(X, Y, north) :- connected(Y, X, south). -crate(crate-c, loc2-1, s0). -crate(crate-b, loc2-2, s0). -crate(crate-a, loc2-3, s0). +crate(cratec, loc21, s0). +crate(crateb, loc22, s0). +crate(cratea, loc23, s0). -target(crate-a, loc1-1). -target(crate-b, loc1-3). -target(crate-c, loc1-2). +target(cratea, loc12). +target(crateb, loc13). +target(cratec, loc11). -agent(loc3-2, s0). +agent(loc32, s0). % --- Goal condition that the planner will try to reach --------------- -goal(S) :- forall(crate(Crate, Loc, S), target(Crate, Loc)). +%goal(S) :- forall(crate(Crate, Loc, S), target(Crate, Loc)). +goal(S) :- crate(cratea, Targeta, S), target(cratea, Targeta), + crate(crateb, Targetb, S), target(crateb, Targetb), + crate(cratec, Targetc, S), target(cratec, Targetc). +%goal(S) :- crate(cratea, Targeta, S), target(_, Targeta), +% crate(crateb, Targetb, S), target(_, Targetb), +% crate(cratec, Targetc, S), target(_, Targetc). diff --git a/report/src/instancetask4.pl b/report/src/instancetask4.pl new file mode 100644 index 0000000..9fade9c --- /dev/null +++ b/report/src/instancetask4.pl @@ -0,0 +1,61 @@ +% ------------------------- Problem Instance -------------------------- +% --- Load domain definitions from an external file ------------------- +:- [domaintask4]. + +% --- Definition of the initial state --------------------------------- +% north and east +connected(loc11, loc21, east). +connected(loc11, loc12, north). +connected(loc12, loc22, east). +connected(loc12, loc13, north). +connected(loc13, loc23, east). +connected(loc13, loc14, north). +connected(loc14, loc24, east). + +connected(loc21, loc31, east). +connected(loc21, loc22, north). +connected(loc22, loc32, east). +connected(loc22, loc23, north). +connected(loc23, loc33, east). +connected(loc23, loc24, north). + +connected(loc31, loc32, east). +connected(loc32, loc33, east). + +% The other way around, west and south +connected(loc21, loc11, west). +connected(loc12, loc11, south). +connected(loc22, loc12, west). +connected(loc13, loc12, south). +connected(loc23, loc13, west). +connected(loc14, loc13, south). +connected(loc24, loc14, west). + +connected(loc31, loc21, west). +connected(loc22, loc21, south). +connected(loc32, loc22, west). +connected(loc23, loc22, south). +connected(loc33, loc23, west). +connected(loc24, loc23, south). + +connected(loc32, loc3-1, west). +connected(loc33, loc3-2, west). + +%connected(X, Y, east) :- connected(Y, X, west). +%connected(X, Y, north) :- connected(Y, X, south). + +crate(cratec, loc21, s0). +crate(crateb, loc22, s0). +crate(cratea, loc23, s0). + +target(cratea, loc12). +target(crateb, loc13). +target(cratec, loc11). + +agent(loc32, s0). + +% --- Goal condition that the planner will try to reach --------------- +%goal(S) :- forall(crate(Crate, Loc, S), target(Crate, Loc)). +goal(S) :- crate(cratea, Targeta, S), target(cratea, Targeta), + crate(crateb, Targetb, S), target(crateb, Targetb), + crate(cratec, Targetc, S), target(cratec, Targetc). diff --git a/report/src/instancetask5.pl b/report/src/instancetask5.pl new file mode 100644 index 0000000..81cc483 --- /dev/null +++ b/report/src/instancetask5.pl @@ -0,0 +1,57 @@ +% ------------------------- Problem Instance -------------------------- +% --- Load domain definitions from an external file ------------------- +:- [domaintask5]. + +% --- Definition of the initial state --------------------------------- +% north and east +connected(loc11, loc21, east). +connected(loc11, loc12, north). +connected(loc12, loc22, east). +connected(loc12, loc13, north). +connected(loc13, loc23, east). +connected(loc13, loc14, north). +connected(loc14, loc24, east). + +connected(loc21, loc31, east). +connected(loc21, loc22, north). +connected(loc22, loc32, east). +connected(loc22, loc23, north). +connected(loc23, loc33, east). +connected(loc23, loc24, north). + +connected(loc31, loc32, east). +connected(loc32, loc33, east). + +% The other way around, west and south +connected(loc21, loc11, west). +connected(loc12, loc11, south). +connected(loc22, loc12, west). +connected(loc13, loc12, south). +connected(loc23, loc13, west). +connected(loc14, loc13, south). +connected(loc24, loc14, west). + +connected(loc31, loc21, west). +connected(loc22, loc21, south). +connected(loc32, loc22, west). +connected(loc23, loc22, south). +connected(loc33, loc23, west). +connected(loc24, loc23, south). + +connected(loc32, loc3-1, west). +connected(loc33, loc3-2, west). + +crate(cratec, loc21, s0). +crate(crateb, loc22, s0). +crate(cratea, loc23, s0). + +target(cratea, loc12). +target(crateb, loc13). +target(cratec, loc11). + +agent(loc32, s0). + +% --- Goal condition that the planner will try to reach --------------- +goal(S) :- crate(cratea, Targeta, S), target(_, Targeta), + crate(crateb, Targetb, S), target(_, Targetb), + crate(cratec, Targetc, S), target(_, Targetc).