Thread: [Toss-devel-svn] SF.net SVN: toss:[1289] trunk/Toss/GGP
Status: Beta
Brought to you by:
lukaszkaiser
From: <luk...@us...> - 2011-01-30 02:27:32
|
Revision: 1289 http://toss.svn.sourceforge.net/toss/?rev=1289&view=rev Author: lukaszkaiser Date: 2011-01-30 02:27:25 +0000 (Sun, 30 Jan 2011) Log Message: ----------- Correcting translation, tests and gdl for pawn whopping. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/Makefile trunk/Toss/GGP/examples/pawn_whopping.gdl Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-01-30 00:49:08 UTC (rev 1288) +++ trunk/Toss/GGP/GDL.ml 2011-01-30 02:27:25 UTC (rev 1289) @@ -1980,7 +1980,7 @@ game_description := game_descr; player_name_terms := [|Const "XPLAYER"; Const "OPLAYER"|]; let effort, horizon, heur_adv_ratio = - 2, 100, 4.0 in + 4, 100, 4.0 in effort, horizon, heur_adv_ratio let initialize_game_gomoku state player game_descr startcl = @@ -1998,7 +1998,7 @@ game_description := game_descr; player_name_terms := [|Const "WHITE"; Const "RED"|]; let effort, horizon, heur_adv_ratio = - 2, 100, 4.0 in + 4, 100, 4.0 in effort, horizon, heur_adv_ratio let initialize_game_breakthrough state player game_descr startcl = @@ -2007,7 +2007,7 @@ game_description := game_descr; player_name_terms := [|Const "WHITE"; Const "BLACK"|]; let effort, horizon, heur_adv_ratio = - 2, 100, 2.0 in + 3, 100, 2.0 in effort, horizon, heur_adv_ratio let initialize_game_pawn_whopping state player game_descr startcl = @@ -2016,7 +2016,7 @@ game_description := game_descr; player_name_terms := [|Const "X"; Const "O"|]; let effort, horizon, heur_adv_ratio = - 2, 100, 2.0 in + 4, 100, 2.0 in effort, horizon, heur_adv_ratio let initialize_game state player game_descr startcl = @@ -2121,23 +2121,36 @@ Const "NOOP"] when x1 = x2 && (s2i y2) - (s2i y1) = 1 -> "WhiteStraight", ["a1", Structure.board_coords_name (s2i x1, s2i y1); - "a2", Structure.board_coords_name (s2i x2, s2i y2)] + "a2", Structure.board_coords_name (s2i x2, s2i y2)] + | [Func ("MOVE", [Const x1; Const y1; Const x2; Const y2]); + Const "NOOP"] when x1 = x2 && (s2i y2) - (s2i y1) = 2 -> + "WhiteStraightTwo", + ["a1", Structure.board_coords_name (s2i x1, s2i y1); + "a2", Structure.board_coords_name (s2i x1, (s2i y1) + 1); + "a3", Structure.board_coords_name (s2i x2, s2i y2)] | [Func ("CAPTURE", [Const x1; Const y1; Const x2; Const y2]); Const "NOOP"] -> "WhiteDiag", ["a", Structure.board_coords_name (s2i x1, s2i y1); - "b", Structure.board_coords_name (s2i x2, s2i y2)] + "b", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; Func ("MOVE", [Const x1; Const y1; Const x2; Const y2])] when x1 = x2 && (s2i y1) - (s2i y2) = 1 -> "BlackStraight", ["a2", Structure.board_coords_name (s2i x1, s2i y1); - "a1", Structure.board_coords_name (s2i x2, s2i y2)] + "a1", Structure.board_coords_name (s2i x2, s2i y2)] | [Const "NOOP"; + Func ("MOVE", [Const x1; Const y1; Const x2; Const y2])] + when x1 = x2 && (s2i y1) - (s2i y2) = 2 -> + "BlackStraightTwo", + ["a3", Structure.board_coords_name (s2i x1, s2i y1); + "a2", Structure.board_coords_name (s2i x1, (s2i y1) - 1); + "a1", Structure.board_coords_name (s2i x2, s2i y2)] + | [Const "NOOP"; Func ("CAPTURE", [Const x1; Const y1; Const x2; Const y2])] -> "BlackDiag", ["a", Structure.board_coords_name (s2i x1, s2i y1); - "b", Structure.board_coords_name (s2i x2, s2i y2)] + "b", Structure.board_coords_name (s2i x2, s2i y2)] | _ -> assert false let translate_last_action struc actions = @@ -2190,7 +2203,7 @@ let struc = new_state.Arena.struc in match emb with | [(_,a); (_,b)] -> - let a, b = if rule = "BlackStraight" then b, a else a, b in + let a, b = if rule = "BlackStraight" then a, b else b, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = @@ -2202,6 +2215,8 @@ let struc = new_state.Arena.struc in match emb with | [(_,a); (_,b)] -> + let a, b = + if rule = "BlackStraight" then a, b else b, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = @@ -2211,7 +2226,7 @@ else Printf.sprintf "(CAPTURE %d %d %d %d)" x1 y1 x2 y2 | [(_,a); (_,b); (_, c)] -> - let a, b = if rule = "BlackStraightTwo" then a, c else a, c in + let a, b = if rule = "BlackStraightTwo" then a, c else c, a in let x1, y1 = Structure.board_elem_coords (Structure.elem_str struc a) and x2, y2 = Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-01-30 00:49:08 UTC (rev 1288) +++ trunk/Toss/GGP/Makefile 2011-01-30 02:27:25 UTC (rev 1289) @@ -15,16 +15,28 @@ GDLTestDebug: -%.ggp: examples/%.gdl ../TossServer +%.black: examples/%.gdl ../TossServer ../TossServer -gdl unset -v & - java -jar gamecontroller-cli.jar play $< 120 30 1 -legal 1 -remote 2 toss localhost 8110 1 | grep results + java -jar gamecontroller-cli.jar play $< 120 30 1 -random 1 -remote 2 toss localhost 8110 1 | grep results killall -v TossServer +%.white: examples/%.gdl ../TossServer + ../TossServer -gdl unset -v & + java -jar gamecontroller-cli.jar play $< 120 30 1 -random 2 -remote 1 toss localhost 8110 1 | grep results + killall -v TossServer + tests: make -C .. GGP_tests - make tictactoe.ggp - make breakthrough.ggp - make connect5.ggp + make tictactoe.white + make tictactoe.black + make breakthrough.white + make breakthrough.black + make pawn_whopping.white + make pawn_whopping.black + make connect4.white + make connect4.black + make connect5.white + make connect5.black .PHONY: clean Modified: trunk/Toss/GGP/examples/pawn_whopping.gdl =================================================================== --- trunk/Toss/GGP/examples/pawn_whopping.gdl 2011-01-30 00:49:08 UTC (rev 1288) +++ trunk/Toss/GGP/examples/pawn_whopping.gdl 2011-01-30 02:27:25 UTC (rev 1289) @@ -1,3 +1,8 @@ +; Pawn Whopping with corrected first double jump for black. +; The only changed rule is "(can_move o (move ?x 8 ?x 6))" (to "... 7 ... 5"). +; If possible, please correct the original and remove this game. +; +; ; Pawnville Pawn whopping from Learning to Play Chess with Fritz and Chesster. ; Goal is to either move a pawn to the opposite side or capture all the ; opponent's pawns. @@ -34,6 +39,7 @@ (<= (legal ?p noop) (role ?p) (not (can_move_somewhere ?p))) + ; Move forward (<= (can_move x (move ?x ?y1 ?x ?y2)) (true (cell ?x ?y1 x)) @@ -51,10 +57,10 @@ (true (cell ?x 2 x)) (not (occupied ?x 3)) (not (occupied ?x 4))) -(<= (can_move o (move ?x 8 ?x 6)) - (true (cell ?x 8 o)) - (not (occupied ?x 7)) - (not (occupied ?x 6))) +(<= (can_move o (move ?x 7 ?x 5)) + (true (cell ?x 7 o)) + (not (occupied ?x 6)) + (not (occupied ?x 5))) ; Capture diagonally (<= (can_move x (capture ?x1 ?y1 ?x2 ?y2)) (true (cell ?x1 ?y1 x)) @@ -69,6 +75,7 @@ (or (succ ?x1 ?x2) (succ ?x2 ?x1))) + ; Transition rules (<= (next (cell ?x ?y ?p)) (true (cell ?x ?y ?p)) @@ -142,6 +149,7 @@ (succ 4 5) (succ 5 6) (succ 6 7) -(succ 7 8) +(succ 7 8) + This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-01-30 14:41:01
|
Revision: 1293 http://toss.svn.sourceforge.net/toss/?rev=1293&view=rev Author: lukaszkaiser Date: 2011-01-30 14:40:55 +0000 (Sun, 30 Jan 2011) Log Message: ----------- Back to sane depth for gomoku. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/Makefile Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-01-30 13:53:05 UTC (rev 1292) +++ trunk/Toss/GGP/GDL.ml 2011-01-30 14:40:55 UTC (rev 1293) @@ -1,3 +1,4 @@ + (** {2 Game Description Language.} Type definitions, helper functions, game specification @@ -1989,7 +1990,7 @@ game_description := game_descr; player_name_terms := [|Const "X"; Const "O"|]; let effort, horizon, heur_adv_ratio = - 3, 100, 4.0 in + 2, 100, 4.0 in effort, horizon, heur_adv_ratio let initialize_game_connect4 state player game_descr startcl = Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-01-30 13:53:05 UTC (rev 1292) +++ trunk/Toss/GGP/Makefile 2011-01-30 14:40:55 UTC (rev 1293) @@ -17,12 +17,12 @@ %.black: examples/%.gdl ../TossServer ../TossServer -gdl unset -v & - java -jar gamecontroller-cli.jar play $< 120 30 1 -random 1 -remote 2 toss localhost 8110 1 | grep results + java -jar gamecontroller-cli.jar play $< 120 90 1 -random 1 -remote 2 toss localhost 8110 1 | grep results killall -v TossServer %.white: examples/%.gdl ../TossServer ../TossServer -gdl unset -v & - java -jar gamecontroller-cli.jar play $< 120 30 1 -random 2 -remote 1 toss localhost 8110 1 | grep results + java -jar gamecontroller-cli.jar play $< 120 90 1 -random 2 -remote 1 toss localhost 8110 1 | grep results killall -v TossServer tests: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-01-31 18:22:08
|
Revision: 1296 http://toss.svn.sourceforge.net/toss/?rev=1296&view=rev Author: lukaszkaiser Date: 2011-01-31 18:22:02 +0000 (Mon, 31 Jan 2011) Log Message: ----------- Lower depths again. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/Makefile Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-01-31 01:29:45 UTC (rev 1295) +++ trunk/Toss/GGP/GDL.ml 2011-01-31 18:22:02 UTC (rev 1296) @@ -2001,7 +2001,7 @@ player_name_terms := [|Const "WHITE"; Const "RED"|]; Game.use_monotonic := false; let effort, horizon, heur_adv_ratio = - 8, 100, 4.0 in + 6, 100, 2.0 in effort, horizon, heur_adv_ratio let initialize_game_breakthrough state player game_descr startcl = @@ -2010,7 +2010,7 @@ game_description := game_descr; player_name_terms := [|Const "WHITE"; Const "BLACK"|]; let effort, horizon, heur_adv_ratio = - 4, 100, 2.0 in + 3, 100, 2.0 in effort, horizon, heur_adv_ratio let initialize_game_pawn_whopping state player game_descr startcl = @@ -2019,7 +2019,7 @@ game_description := game_descr; player_name_terms := [|Const "X"; Const "O"|]; let effort, horizon, heur_adv_ratio = - 6, 100, 2.0 in + 4, 100, 2.0 in effort, horizon, heur_adv_ratio let initialize_game state player game_descr startcl = Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-01-31 01:29:45 UTC (rev 1295) +++ trunk/Toss/GGP/Makefile 2011-01-31 18:22:02 UTC (rev 1296) @@ -17,12 +17,12 @@ %.black: examples/%.gdl ../TossServer ../TossServer -gdl unset -v & - java -jar gamecontroller-cli.jar play $< 120 90 1 -random 1 -remote 2 toss localhost 8110 1 | grep results + java -jar gamecontroller-cli.jar play $< 600 180 1 -random 1 -remote 2 toss localhost 8110 1 | grep results killall -v TossServer %.white: examples/%.gdl ../TossServer ../TossServer -gdl unset -v & - java -jar gamecontroller-cli.jar play $< 120 90 1 -random 2 -remote 1 toss localhost 8110 1 | grep results + java -jar gamecontroller-cli.jar play $< 600 180 1 -random 2 -remote 1 toss localhost 8110 1 | grep results killall -v TossServer tests: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-02-24 22:58:02
|
Revision: 1332 http://toss.svn.sourceforge.net/toss/?rev=1332&view=rev Author: lukaszkaiser Date: 2011-02-24 22:57:56 +0000 (Thu, 24 Feb 2011) Log Message: ----------- Make automatic translation default, backtrace on GGP tests. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/Makefile Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-02-24 22:05:29 UTC (rev 1331) +++ trunk/Toss/GGP/GDL.ml 2011-02-24 22:57:56 UTC (rev 1332) @@ -3123,7 +3123,7 @@ -let manual_translation = ref true +let manual_translation = ref false let manual_game = ref "tictactoe" let top_exec_path = ref "." (* path to top Toss directory *) let tictactoe_descr = ref None Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-02-24 22:05:29 UTC (rev 1331) +++ trunk/Toss/GGP/Makefile 2011-02-24 22:57:56 UTC (rev 1332) @@ -16,12 +16,12 @@ GDLTestDebug: %.black: examples/%.gdl ../TossServer - ../TossServer -gdl unset -v & + OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -vv & java -jar gamecontroller-cli.jar play $< 600 10 1 -random 1 -remote 2 toss localhost 8110 1 | grep results killall -v TossServer %.white: examples/%.gdl ../TossServer - ../TossServer -gdl unset -v & + OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -vv & java -jar gamecontroller-cli.jar play $< 600 10 1 -random 2 -remote 1 toss localhost 8110 1 | grep results killall -v TossServer This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-05-02 12:07:35
|
Revision: 1430 http://toss.svn.sourceforge.net/toss/?rev=1430&view=rev Author: lukstafi Date: 2011-05-02 12:07:27 +0000 (Mon, 02 May 2011) Log Message: ----------- GDL: regenerated tests. Modified Paths: -------------- trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/tests/breakthrough-raw.toss trunk/Toss/GGP/tests/breakthrough-simpl.toss trunk/Toss/GGP/tests/connect5-raw.toss trunk/Toss/GGP/tests/connect5-simpl.toss Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-05-01 23:21:01 UTC (rev 1429) +++ trunk/Toss/GGP/GDLTest.ml 2011-05-02 12:07:27 UTC (rev 1430) @@ -276,7 +276,7 @@ let a () = (* regenerate ~debug:false ~game_name:"tictactoe" ~player:"xplayer"; *) - (* regenerate ~debug:false ~game_name:"connect5" ~player:"x"; *) - (* regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; *) - regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; + regenerate ~debug:false ~game_name:"connect5" ~player:"x"; + regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; + (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *) (* regen_with_debug ~game_name:"connect4" ~player:"white" *) Modified: trunk/Toss/GGP/tests/breakthrough-raw.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-05-01 23:21:01 UTC (rev 1429) +++ trunk/Toss/GGP/tests/breakthrough-raw.toss 2011-05-02 12:07:27 UTC (rev 1430) @@ -30,24 +30,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) RULE move_x319_y337_x318_y336_0: [cellholds_x318_y336__blank_, cellholds_x319_y337__blank_, control__blank_ | _opt_cellholds_x2_y2_black { @@ -79,24 +80,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) RULE move_x387_y417_x387_y416_0: [cellholds_x387_y416__blank_, cellholds_x387_y417__blank_, control__blank_ | EQ___cellholds_x2_y2_MV1_x2 @@ -126,24 +128,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) RULE move_x467_y497_x466_y496_1: [cellholds_x466_y496__blank_, cellholds_x467_y497__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -175,24 +178,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) RULE move_x547_y577_x546_y576_1: [cellholds_x546_y576__blank_, cellholds_x547_y577__blank_, control__blank_ | _opt_cellholds_x2_y2_black (control__blank_); @@ -224,24 +228,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) RULE move_x615_y657_x615_y656_1: [cellholds_x615_y656__blank_, cellholds_x615_y657__blank_, control__blank_ | EQ___cellholds_x2_y2_MV1_x2 @@ -271,24 +276,25 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (not - ex cellholds_x616_8__blank_ + not + (ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_) and - cellholds_x2_y2_white(cellholds_x616_8__blank_)) and - ex cellholds_x617_y658__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and - cellholds_x2_y2_black(cellholds_x617_y658__blank_)) and - not + cellholds_x2_y2_white(cellholds_x616_8__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_) and - cellholds_x2_y2_black(cellholds_x618_1__blank_)) and - ex cellholds_x619_y659__blank_ - (index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_) and - index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and - cellholds_x2_y2_white(cellholds_x619_y659__blank_))) + cellholds_x2_y2_black(cellholds_x618_1__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x618_1__blank_)) or + not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x617_y658__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_x2(cellholds_x619_y659__blank_) and + index__cellholds_x2_y2_MV1_y2(cellholds_x619_y659__blank_))) LOC 0 { PLAYER white { Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-05-01 23:21:01 UTC (rev 1429) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-05-02 12:07:27 UTC (rev 1430) @@ -31,18 +31,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and @@ -72,18 +73,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and @@ -110,18 +112,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and @@ -151,18 +154,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and @@ -192,18 +196,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and @@ -230,18 +235,19 @@ emb cellholds_x2_y2_black, cellholds_x2_y2_white, control_black, control_white pre - (ex cellholds_x617_y658__blank_ - (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and - not control_MV1(cellholds_x617_y658__blank_)) and - ex cellholds_x619_y659__blank_ - (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and - not control_MV1(cellholds_x619_y659__blank_)) and - not + not + (not + ex cellholds_x617_y658__blank_ + (cellholds_x2_y2_black(cellholds_x617_y658__blank_) and + not control_MV1(cellholds_x617_y658__blank_)) or + not + ex cellholds_x619_y659__blank_ + (cellholds_x2_y2_white(cellholds_x619_y659__blank_) and + not control_MV1(cellholds_x619_y659__blank_)) or ex cellholds_x616_8__blank_ (cellholds_x2_8_MV1(cellholds_x616_8__blank_) and cellholds_x2_y2_white(cellholds_x616_8__blank_) and - not control_MV1(cellholds_x616_8__blank_)) and - not + not control_MV1(cellholds_x616_8__blank_)) or ex cellholds_x618_1__blank_ (cellholds_x2_1_MV1(cellholds_x618_1__blank_) and cellholds_x2_y2_black(cellholds_x618_1__blank_) and Modified: trunk/Toss/GGP/tests/connect5-raw.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-raw.toss 2011-05-01 23:21:01 UTC (rev 1429) +++ trunk/Toss/GGP/tests/connect5-raw.toss 2011-05-02 12:07:27 UTC (rev 1430) @@ -15,83 +15,39 @@ ] emb cell_x_y_b, cell_x_y_o, cell_x_y_x, control_o, control_x pre - (not - ex cell_x177_e24__blank_, cell_x177_d24__blank_, cell_x177_c32__blank_, - cell_x177_b24__blank_, cell_x177_a24__blank_ - (EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_b24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_c32__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_c32__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_d24__blank_, cell_x177_e24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_d24__blank_, - cell_x177_e24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_c32__blank_, - cell_x177_d24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_b24__blank_, - cell_x177_c32__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_a24__blank_, - cell_x177_b24__blank_) and cell_x_y_x(cell_x177_e24__blank_) and - cell_x_y_x(cell_x177_d24__blank_) and - cell_x_y_x(cell_x177_c32__blank_) and - cell_x_y_x(cell_x177_b24__blank_) and - cell_x_y_x(cell_x177_a24__blank_)) and - not - ex cell_e25_y178__blank_, cell_d25_y178__blank_, cell_c33_y178__blank_, - cell_b25_y178__blank_, cell_a25_y178__blank_ - (EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_b25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_c33_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_c33_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_d25_y178__blank_, cell_e25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d25_y178__blank_, - cell_e25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c33_y178__blank_, - cell_d25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b25_y178__blank_, - cell_c33_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a25_y178__blank_, - cell_b25_y178__blank_) and cell_x_y_x(cell_e25_y178__blank_) and - cell_x_y_x(cell_d25_y178__blank_) and - cell_x_y_x(cell_c33_y178__blank_) and - cell_x_y_x(cell_b25_y178__blank_) and - cell_x_y_x(cell_a25_y178__blank_)) and - not + not + (not ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_) or ex cell_x182_y183__blank_, cell_x181_y182__blank_, cell_x180_y181__blank_, cell_x179_y180__blank_, cell_x178_y179__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x179_y180__blank_, - cell_x178_y179__blank_) and + (cell_x_y_x(cell_x178_y179__blank_) and + cell_x_y_x(cell_x179_y180__blank_) and + cell_x_y_x(cell_x180_y181__blank_) and + cell_x_y_x(cell_x181_y182__blank_) and + cell_x_y_x(cell_x182_y183__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x179_y180__blank_, cell_x178_y179__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x179_y180__blank_, + cell_x178_y179__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x180_y181__blank_, + cell_x179_y180__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x180_y181__blank_, cell_x179_y180__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x180_y181__blank_, - cell_x179_y180__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x181_y182__blank_, + cell_x180_y181__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x181_y182__blank_, cell_x180_y181__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x181_y182__blank_, - cell_x180_y181__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x182_y183__blank_, + cell_x181_y182__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x182_y183__blank_, - cell_x181_y182__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x182_y183__blank_, - cell_x181_y182__blank_) and cell_x_y_x(cell_x178_y179__blank_) and - cell_x_y_x(cell_x179_y180__blank_) and - cell_x_y_x(cell_x180_y181__blank_) and - cell_x_y_x(cell_x181_y182__blank_) and - cell_x_y_x(cell_x182_y183__blank_)) and - not + cell_x181_y182__blank_)) or ex cell_x187_y188__blank_, cell_x186_y187__blank_, cell_x185_y186__blank_, cell_x184_y185__blank_, cell_x183_y184__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x183_y184__blank_, + (cell_x_y_x(cell_x183_y184__blank_) and + cell_x_y_x(cell_x184_y185__blank_) and + cell_x_y_x(cell_x185_y186__blank_) and + cell_x_y_x(cell_x186_y187__blank_) and + cell_x_y_x(cell_x187_y188__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x183_y184__blank_, cell_x184_y185__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x184_y185__blank_, cell_x183_y184__blank_) and @@ -106,88 +62,38 @@ nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x186_y187__blank_, cell_x187_y188__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x187_y188__blank_, - cell_x186_y187__blank_) and cell_x_y_x(cell_x183_y184__blank_) and - cell_x_y_x(cell_x184_y185__blank_) and - cell_x_y_x(cell_x185_y186__blank_) and - cell_x_y_x(cell_x186_y187__blank_) and - cell_x_y_x(cell_x187_y188__blank_)) and - not - ex cell_x188_e26__blank_, cell_x188_d26__blank_, cell_x188_c34__blank_, - cell_x188_b26__blank_, cell_x188_a26__blank_ - (EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_b26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_c34__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_c34__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_d26__blank_, cell_x188_e26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_d26__blank_, - cell_x188_e26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_c34__blank_, - cell_x188_d26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_b26__blank_, - cell_x188_c34__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_a26__blank_, - cell_x188_b26__blank_) and cell_x_y_o(cell_x188_e26__blank_) and - cell_x_y_o(cell_x188_d26__blank_) and - cell_x_y_o(cell_x188_c34__blank_) and - cell_x_y_o(cell_x188_b26__blank_) and - cell_x_y_o(cell_x188_a26__blank_)) and - not - ex cell_e27_y189__blank_, cell_d27_y189__blank_, cell_c35_y189__blank_, - cell_b27_y189__blank_, cell_a27_y189__blank_ - (EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_b27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_c35_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_c35_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_d27_y189__blank_, cell_e27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d27_y189__blank_, - cell_e27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c35_y189__blank_, - cell_d27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b27_y189__blank_, - cell_c35_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a27_y189__blank_, - cell_b27_y189__blank_) and cell_x_y_o(cell_e27_y189__blank_) and - cell_x_y_o(cell_d27_y189__blank_) and - cell_x_y_o(cell_c35_y189__blank_) and - cell_x_y_o(cell_b27_y189__blank_) and - cell_x_y_o(cell_a27_y189__blank_)) and - not + cell_x186_y187__blank_)) or ex cell_x193_y194__blank_, cell_x192_y193__blank_, cell_x191_y192__blank_, cell_x190_y191__blank_, cell_x189_y190__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x190_y191__blank_, - cell_x189_y190__blank_) and + (cell_x_y_o(cell_x189_y190__blank_) and + cell_x_y_o(cell_x190_y191__blank_) and + cell_x_y_o(cell_x191_y192__blank_) and + cell_x_y_o(cell_x192_y193__blank_) and + cell_x_y_o(cell_x193_y194__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x190_y191__blank_, cell_x189_y190__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x190_y191__blank_, + cell_x189_y190__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x191_y192__blank_, + cell_x190_y191__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x191_y192__blank_, cell_x190_y191__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x191_y192__blank_, - cell_x190_y191__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x192_y193__blank_, + cell_x191_y192__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x192_y193__blank_, cell_x191_y192__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x192_y193__blank_, - cell_x191_y192__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x193_y194__blank_, + cell_x192_y193__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x193_y194__blank_, - cell_x192_y193__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x193_y194__blank_, - cell_x192_y193__blank_) and cell_x_y_o(cell_x189_y190__blank_) and - cell_x_y_o(cell_x190_y191__blank_) and - cell_x_y_o(cell_x191_y192__blank_) and - cell_x_y_o(cell_x192_y193__blank_) and - cell_x_y_o(cell_x193_y194__blank_)) and - not + cell_x192_y193__blank_)) or ex cell_x198_y199__blank_, cell_x197_y198__blank_, cell_x196_y197__blank_, cell_x195_y196__blank_, cell_x194_y195__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x194_y195__blank_, + (cell_x_y_o(cell_x194_y195__blank_) and + cell_x_y_o(cell_x195_y196__blank_) and + cell_x_y_o(cell_x196_y197__blank_) and + cell_x_y_o(cell_x197_y198__blank_) and + cell_x_y_o(cell_x198_y199__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x194_y195__blank_, cell_x195_y196__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x195_y196__blank_, cell_x194_y195__blank_) and @@ -202,12 +108,107 @@ nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x197_y198__blank_, cell_x198_y199__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x198_y199__blank_, - cell_x197_y198__blank_) and cell_x_y_o(cell_x194_y195__blank_) and - cell_x_y_o(cell_x195_y196__blank_) and - cell_x_y_o(cell_x196_y197__blank_) and - cell_x_y_o(cell_x197_y198__blank_) and - cell_x_y_o(cell_x198_y199__blank_)) and - ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_)) + cell_x197_y198__blank_)) or + ex cell_e25_y178__blank_, cell_d25_y178__blank_, cell_c33_y178__blank_, + cell_b25_y178__blank_, cell_a25_y178__blank_ + (cell_x_y_x(cell_a25_y178__blank_) and + cell_x_y_x(cell_b25_y178__blank_) and + cell_x_y_x(cell_c33_y178__blank_) and + cell_x_y_x(cell_d25_y178__blank_) and + cell_x_y_x(cell_e25_y178__blank_) and + EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_b25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a25_y178__blank_, + cell_b25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_c33_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_c33_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b25_y178__blank_, + cell_c33_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, + cell_d25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c33_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_d25_y178__blank_, + cell_e25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d25_y178__blank_, + cell_e25_y178__blank_)) or + ex cell_e27_y189__blank_, cell_d27_y189__blank_, cell_c35_y189__blank_, + cell_b27_y189__blank_, cell_a27_y189__blank_ + (cell_x_y_o(cell_a27_y189__blank_) and + cell_x_y_o(cell_b27_y189__blank_) and + cell_x_y_o(cell_c35_y189__blank_) and + cell_x_y_o(cell_d27_y189__blank_) and + cell_x_y_o(cell_e27_y189__blank_) and + EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_b27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a27_y189__blank_, + cell_b27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_c35_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_c35_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b27_y189__blank_, + cell_c35_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, + cell_d27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c35_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_d27_y189__blank_, + cell_e27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d27_y189__blank_, + cell_e27_y189__blank_)) or + ex cell_x177_e24__blank_, cell_x177_d24__blank_, cell_x177_c32__blank_, + cell_x177_b24__blank_, cell_x177_a24__blank_ + (cell_x_y_x(cell_x177_a24__blank_) and + cell_x_y_x(cell_x177_b24__blank_) and + cell_x_y_x(cell_x177_c32__blank_) and + cell_x_y_x(cell_x177_d24__blank_) and + cell_x_y_x(cell_x177_e24__blank_) and + EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_b24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_a24__blank_, + cell_x177_b24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_c32__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_c32__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_b24__blank_, + cell_x177_c32__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, + cell_x177_d24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_c32__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_d24__blank_, + cell_x177_e24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_d24__blank_, + cell_x177_e24__blank_)) or + ex cell_x188_e26__blank_, cell_x188_d26__blank_, cell_x188_c34__blank_, + cell_x188_b26__blank_, cell_x188_a26__blank_ + (cell_x_y_o(cell_x188_a26__blank_) and + cell_x_y_o(cell_x188_b26__blank_) and + cell_x_y_o(cell_x188_c34__blank_) and + cell_x_y_o(cell_x188_d26__blank_) and + cell_x_y_o(cell_x188_e26__blank_) and + EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_b26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_a26__blank_, + cell_x188_b26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_c34__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_c34__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_b26__blank_, + cell_x188_c34__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, + cell_x188_d26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_c34__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_d26__blank_, + cell_x188_e26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_d26__blank_, + cell_x188_e26__blank_))) RULE mark_x175_y176_1: [cell_x175_y176__blank_, control__blank_ | _opt_cell_x_y_b (control__blank_); @@ -224,83 +225,39 @@ ] emb cell_x_y_b, cell_x_y_o, cell_x_y_x, control_o, control_x pre - (not - ex cell_x177_e24__blank_, cell_x177_d24__blank_, cell_x177_c32__blank_, - cell_x177_b24__blank_, cell_x177_a24__blank_ - (EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_b24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_c32__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_c32__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, cell_x177_d24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, cell_x177_e24__blank_) and - EQ___cell_x_y_MV1_x(cell_x177_d24__blank_, cell_x177_e24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_d24__blank_, - cell_x177_e24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_c32__blank_, - cell_x177_d24__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_b24__blank_, - cell_x177_c32__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_a24__blank_, - cell_x177_b24__blank_) and cell_x_y_x(cell_x177_e24__blank_) and - cell_x_y_x(cell_x177_d24__blank_) and - cell_x_y_x(cell_x177_c32__blank_) and - cell_x_y_x(cell_x177_b24__blank_) and - cell_x_y_x(cell_x177_a24__blank_)) and - not - ex cell_e25_y178__blank_, cell_d25_y178__blank_, cell_c33_y178__blank_, - cell_b25_y178__blank_, cell_a25_y178__blank_ - (EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_b25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_c33_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_c33_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, cell_d25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, cell_e25_y178__blank_) and - EQ___cell_x_y_MV1_y(cell_d25_y178__blank_, cell_e25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d25_y178__blank_, - cell_e25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c33_y178__blank_, - cell_d25_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b25_y178__blank_, - cell_c33_y178__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a25_y178__blank_, - cell_b25_y178__blank_) and cell_x_y_x(cell_e25_y178__blank_) and - cell_x_y_x(cell_d25_y178__blank_) and - cell_x_y_x(cell_c33_y178__blank_) and - cell_x_y_x(cell_b25_y178__blank_) and - cell_x_y_x(cell_a25_y178__blank_)) and - not + not + (not ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_) or ex cell_x182_y183__blank_, cell_x181_y182__blank_, cell_x180_y181__blank_, cell_x179_y180__blank_, cell_x178_y179__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x179_y180__blank_, - cell_x178_y179__blank_) and + (cell_x_y_x(cell_x178_y179__blank_) and + cell_x_y_x(cell_x179_y180__blank_) and + cell_x_y_x(cell_x180_y181__blank_) and + cell_x_y_x(cell_x181_y182__blank_) and + cell_x_y_x(cell_x182_y183__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x179_y180__blank_, cell_x178_y179__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x179_y180__blank_, + cell_x178_y179__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x180_y181__blank_, + cell_x179_y180__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x180_y181__blank_, cell_x179_y180__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x180_y181__blank_, - cell_x179_y180__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x181_y182__blank_, + cell_x180_y181__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x181_y182__blank_, cell_x180_y181__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x181_y182__blank_, - cell_x180_y181__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x182_y183__blank_, + cell_x181_y182__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x182_y183__blank_, - cell_x181_y182__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x182_y183__blank_, - cell_x181_y182__blank_) and cell_x_y_x(cell_x178_y179__blank_) and - cell_x_y_x(cell_x179_y180__blank_) and - cell_x_y_x(cell_x180_y181__blank_) and - cell_x_y_x(cell_x181_y182__blank_) and - cell_x_y_x(cell_x182_y183__blank_)) and - not + cell_x181_y182__blank_)) or ex cell_x187_y188__blank_, cell_x186_y187__blank_, cell_x185_y186__blank_, cell_x184_y185__blank_, cell_x183_y184__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x183_y184__blank_, + (cell_x_y_x(cell_x183_y184__blank_) and + cell_x_y_x(cell_x184_y185__blank_) and + cell_x_y_x(cell_x185_y186__blank_) and + cell_x_y_x(cell_x186_y187__blank_) and + cell_x_y_x(cell_x187_y188__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x183_y184__blank_, cell_x184_y185__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x184_y185__blank_, cell_x183_y184__blank_) and @@ -315,88 +272,38 @@ nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x186_y187__blank_, cell_x187_y188__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x187_y188__blank_, - cell_x186_y187__blank_) and cell_x_y_x(cell_x183_y184__blank_) and - cell_x_y_x(cell_x184_y185__blank_) and - cell_x_y_x(cell_x185_y186__blank_) and - cell_x_y_x(cell_x186_y187__blank_) and - cell_x_y_x(cell_x187_y188__blank_)) and - not - ex cell_x188_e26__blank_, cell_x188_d26__blank_, cell_x188_c34__blank_, - cell_x188_b26__blank_, cell_x188_a26__blank_ - (EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_b26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_c34__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_c34__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, cell_x188_d26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, cell_x188_e26__blank_) and - EQ___cell_x_y_MV1_x(cell_x188_d26__blank_, cell_x188_e26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_d26__blank_, - cell_x188_e26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_c34__blank_, - cell_x188_d26__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_b26__blank_, - cell_x188_c34__blank_) and - nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_a26__blank_, - cell_x188_b26__blank_) and cell_x_y_o(cell_x188_e26__blank_) and - cell_x_y_o(cell_x188_d26__blank_) and - cell_x_y_o(cell_x188_c34__blank_) and - cell_x_y_o(cell_x188_b26__blank_) and - cell_x_y_o(cell_x188_a26__blank_)) and - not - ex cell_e27_y189__blank_, cell_d27_y189__blank_, cell_c35_y189__blank_, - cell_b27_y189__blank_, cell_a27_y189__blank_ - (EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_b27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_c35_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_c35_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, cell_d27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, cell_e27_y189__blank_) and - EQ___cell_x_y_MV1_y(cell_d27_y189__blank_, cell_e27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d27_y189__blank_, - cell_e27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c35_y189__blank_, - cell_d27_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b27_y189__blank_, - cell_c35_y189__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a27_y189__blank_, - cell_b27_y189__blank_) and cell_x_y_o(cell_e27_y189__blank_) and - cell_x_y_o(cell_d27_y189__blank_) and - cell_x_y_o(cell_c35_y189__blank_) and - cell_x_y_o(cell_b27_y189__blank_) and - cell_x_y_o(cell_a27_y189__blank_)) and - not + cell_x186_y187__blank_)) or ex cell_x193_y194__blank_, cell_x192_y193__blank_, cell_x191_y192__blank_, cell_x190_y191__blank_, cell_x189_y190__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x190_y191__blank_, - cell_x189_y190__blank_) and + (cell_x_y_o(cell_x189_y190__blank_) and + cell_x_y_o(cell_x190_y191__blank_) and + cell_x_y_o(cell_x191_y192__blank_) and + cell_x_y_o(cell_x192_y193__blank_) and + cell_x_y_o(cell_x193_y194__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x190_y191__blank_, cell_x189_y190__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x190_y191__blank_, + cell_x189_y190__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x191_y192__blank_, + cell_x190_y191__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x191_y192__blank_, cell_x190_y191__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x191_y192__blank_, - cell_x190_y191__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x192_y193__blank_, + cell_x191_y192__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x192_y193__blank_, cell_x191_y192__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x192_y193__blank_, - cell_x191_y192__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x193_y194__blank_, + cell_x192_y193__blank_) and nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x193_y194__blank_, - cell_x192_y193__blank_) and - nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x193_y194__blank_, - cell_x192_y193__blank_) and cell_x_y_o(cell_x189_y190__blank_) and - cell_x_y_o(cell_x190_y191__blank_) and - cell_x_y_o(cell_x191_y192__blank_) and - cell_x_y_o(cell_x192_y193__blank_) and - cell_x_y_o(cell_x193_y194__blank_)) and - not + cell_x192_y193__blank_)) or ex cell_x198_y199__blank_, cell_x197_y198__blank_, cell_x196_y197__blank_, cell_x195_y196__blank_, cell_x194_y195__blank_ - (nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x194_y195__blank_, + (cell_x_y_o(cell_x194_y195__blank_) and + cell_x_y_o(cell_x195_y196__blank_) and + cell_x_y_o(cell_x196_y197__blank_) and + cell_x_y_o(cell_x197_y198__blank_) and + cell_x_y_o(cell_x198_y199__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x194_y195__blank_, cell_x195_y196__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x195_y196__blank_, cell_x194_y195__blank_) and @@ -411,12 +318,107 @@ nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x197_y198__blank_, cell_x198_y199__blank_) and nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_x198_y199__blank_, - cell_x197_y198__blank_) and cell_x_y_o(cell_x194_y195__blank_) and - cell_x_y_o(cell_x195_y196__blank_) and - cell_x_y_o(cell_x196_y197__blank_) and - cell_x_y_o(cell_x197_y198__blank_) and - cell_x_y_o(cell_x198_y199__blank_)) and - ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_)) + cell_x197_y198__blank_)) or + ex cell_e25_y178__blank_, cell_d25_y178__blank_, cell_c33_y178__blank_, + cell_b25_y178__blank_, cell_a25_y178__blank_ + (cell_x_y_x(cell_a25_y178__blank_) and + cell_x_y_x(cell_b25_y178__blank_) and + cell_x_y_x(cell_c33_y178__blank_) and + cell_x_y_x(cell_d25_y178__blank_) and + cell_x_y_x(cell_e25_y178__blank_) and + EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, cell_b25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a25_y178__blank_, + cell_b25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_c33_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_a25_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_c33_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b25_y178__blank_, + cell_c33_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_b25_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, + cell_d25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c33_y178__blank_, + cell_d25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_c33_y178__blank_, + cell_e25_y178__blank_) and EQ___cell_x_y_MV1_y(cell_d25_y178__blank_, + cell_e25_y178__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d25_y178__blank_, + cell_e25_y178__blank_)) or + ex cell_e27_y189__blank_, cell_d27_y189__blank_, cell_c35_y189__blank_, + cell_b27_y189__blank_, cell_a27_y189__blank_ + (cell_x_y_o(cell_a27_y189__blank_) and + cell_x_y_o(cell_b27_y189__blank_) and + cell_x_y_o(cell_c35_y189__blank_) and + cell_x_y_o(cell_d27_y189__blank_) and + cell_x_y_o(cell_e27_y189__blank_) and + EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, cell_b27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_a27_y189__blank_, + cell_b27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_c35_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_a27_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_c35_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_b27_y189__blank_, + cell_c35_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_b27_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, + cell_d27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_c35_y189__blank_, + cell_d27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_c35_y189__blank_, + cell_e27_y189__blank_) and EQ___cell_x_y_MV1_y(cell_d27_y189__blank_, + cell_e27_y189__blank_) and + nextcol__cell_x_y_MV1_x__cell_x_y_MV1_x(cell_d27_y189__blank_, + cell_e27_y189__blank_)) or + ex cell_x177_e24__blank_, cell_x177_d24__blank_, cell_x177_c32__blank_, + cell_x177_b24__blank_, cell_x177_a24__blank_ + (cell_x_y_x(cell_x177_a24__blank_) and + cell_x_y_x(cell_x177_b24__blank_) and + cell_x_y_x(cell_x177_c32__blank_) and + cell_x_y_x(cell_x177_d24__blank_) and + cell_x_y_x(cell_x177_e24__blank_) and + EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, cell_x177_b24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_a24__blank_, + cell_x177_b24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_c32__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_a24__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_c32__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_b24__blank_, + cell_x177_c32__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_b24__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, + cell_x177_d24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_c32__blank_, + cell_x177_d24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_c32__blank_, + cell_x177_e24__blank_) and EQ___cell_x_y_MV1_x(cell_x177_d24__blank_, + cell_x177_e24__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x177_d24__blank_, + cell_x177_e24__blank_)) or + ex cell_x188_e26__blank_, cell_x188_d26__blank_, cell_x188_c34__blank_, + cell_x188_b26__blank_, cell_x188_a26__blank_ + (cell_x_y_o(cell_x188_a26__blank_) and + cell_x_y_o(cell_x188_b26__blank_) and + cell_x_y_o(cell_x188_c34__blank_) and + cell_x_y_o(cell_x188_d26__blank_) and + cell_x_y_o(cell_x188_e26__blank_) and + EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, cell_x188_b26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_a26__blank_, + cell_x188_b26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_c34__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_a26__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_c34__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_b26__blank_, + cell_x188_c34__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_b26__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, + cell_x188_d26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_c34__blank_, + cell_x188_d26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_c34__blank_, + cell_x188_e26__blank_) and EQ___cell_x_y_MV1_x(cell_x188_d26__blank_, + cell_x188_e26__blank_) and + nextcol__cell_x_y_MV1_y__cell_x_y_MV1_y(cell_x188_d26__blank_, + cell_x188_e26__blank_))) LOC 0 { PLAYER x { Modified: trunk/Toss/GGP/tests/connect5-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-simpl.toss 2011-05-01 23:21:01 UTC (rev 1429) +++ trunk/Toss/GGP/tests/connect5-simpl.toss 2011-05-02 12:07:27 UTC (rev 1430) @@ -21,8 +21,8 @@ ] emb cell_x_y_b, cell_x_y_o, cell_x_y_x, control_o, control_x pre - (ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_) and - not + not + (not ex cell_x199_y200__blank_ cell_x_y_b(cell_x199_y200__blank_) or ex cell_x182_y183__blank_, cell_x181_y182__blank_, cell_x180_y181__blank_, cell_x179_y180__blank_, cell_x178_y179__blank_ (R(cell_x179_y180__blank_, cell_x178_y179__blank_) and @@ -33,8 +33,7 @@ cell_x_y_x(cell_x179_y180__blank_) and cell_x_y_x(cell_x180_y181__blank_) and cell_x_y_x(cell_x181_y182__blank_) and - cell_x_y_x(cell_x182_y183__blank_)) and - not + cell_x_y_x(cell_x182_y183__blank_)) or ex cell_x187_y188__blank_, cell_x186_y187__blank_, cell_x185_y186__blank_, cell_x184_y185__blank_, cell_x183_y184__blank_ (R0(cell_x184_y185__blank_, cell_x183_y184__blank_) and @@ -45,8 +44,7 @@ cell_x_y_x(cell_x184_y185__blank_) and cell_x_y_x(cell_x185_y186__blank_) and cell_x_y_x(cell_x186_y187__blank_) and -... [truncated message content] |
From: <luk...@us...> - 2011-07-09 12:37:40
|
Revision: 1508 http://toss.svn.sourceforge.net/toss/?rev=1508&view=rev Author: lukstafi Date: 2011-07-09 12:37:34 +0000 (Sat, 09 Jul 2011) Log Message: ----------- missing files in Reimplementation of GDL to Toss translation: untested work in progress. Added Paths: ----------- trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateGame.ml Added: trunk/Toss/GGP/TranslateFormula.ml =================================================================== --- trunk/Toss/GGP/TranslateFormula.ml (rev 0) +++ trunk/Toss/GGP/TranslateFormula.ml 2011-07-09 12:37:34 UTC (rev 1508) @@ -0,0 +1,341 @@ +(** {2 Translating GDL definition: formulas.} *) + +open GDL + +let rel_atoms body = + let rec aux = function + | Pos (Rel (rel, args)) -> [rel, args] + | Neg (Rel (rel, args)) -> [rel, args] + | Disj ls -> Aux.concat_map aux ls + | _ -> [] in + Aux.concat_map aux body + + + +(* **************************************** *) +(* {3 Translate stable relations and fluents.} *) + +(* [separate_disj] is $\mathrm{TrDistr}$. Separate each disjunct, + splitting disjuncts if necessary, into "positive state terms", + "negative state terms" and "reminder". *) +let separate_disj disj = + let aux conj = + List.fold_right (fun lit acc -> match lit with + | (Pos (True _) | Neg (True _)) as lit -> + List.map (fun conj -> Left lit::conj) acc + | Disj ls as lit -> + if List.for_all (function Pos _ -> true | _ -> false) ls + || List.for_all (function Neg _ -> true | _ -> false) ls + then + List.map (fun conj -> Left lit::conj) acc + else + Aux.concat_map (function + | (Pos (True _) | Neg (True _)) as lit -> + List.map (fun conj -> Left lit::conj) acc + | lit -> List.map (fun conj -> Right lit::conj) acc + ) ls + | lit -> List.map (fun conj -> Right lit::conj) acc + ) conj [[]] in + let disj = Aux.concat_map aux disj in + List.map (fun conj -> + let state_terms, other = Aux.split_choice conj in + let pos_terms, neg_terms = + Aux.partition_map (function + | Pos _ as lit -> Left lit + | Neg _ as lit -> Right lit + | Disj ls as lit + when List.for_all (function Pos _ -> true | _ -> false) ls + -> Left lit + | Disj ls as lit + when List.for_all (function Neg _ -> true | _ -> false) ls + -> Right lit + | _ -> assert false + ) state_terms in + other, pos_terms, neg_terms) disj + +(* Whether $i$th argument is a $\mathrm{DefSide}$ or a + $\mathrm{CallSide}$, and the $p_{R,i}$ path for a relation $R$. *) +type defrel_arg_type = (bool * path) array + +type transl_data { + f_paths : path_set; (* fluent paths *) + m_paths : path_set; (* within-mask paths *) + all_paths : path_set; (* sum of f_paths and m_paths *) + mask_reps : term list; (* mask terms *) + defined_rels : string list; + defrel_arg_type : (string * defrel_arg_type) list ref; + (* late binding to store $ArgType# data *) + term_arities : (string * int) list; +} + +let blank_out data t = + simult_subst data.f_paths blank t + +let var_of_term data t = + Formula.fo_var_of_string (blank_out data t) + +let blank_outside_subterm data path subterm = + let arities = data.term_arities in + List.fold_right + (fun (rel, pos) acc -> + let subterms = Array.make (List.assoc rel arities) blank in + subterms.(pos) <- acc; + Func (rel, subterms)) + path subterm + +let var_of_subterm data path subt = + Formula.fo_var_of_string (blank_outside_subterm data path t) + +(* placeholder *) +let translate_defrel = + ref (fun data sterms_all sterms_in s_subterms sign rel args -> + assert false) + +let transl_rels data rels_phi sterms_all sterms_in = + let s_subterms = List.map + (fun sterm -> sterm, + map_paths (fun path subt -> subt, (sterm, path)) data.f_paths sterm) + sterms_all in + let s_subterms = List.filter + (fun (subt, _) -> subt <> blank) s_subterms in + let s_subterms = Aux.collect s_subterms in + let transl_rel sign rel args = + try + let stuples = + List.map (fun arg -> List.assoc arg s_subterms) args in + let stuples = Aux.product stuples in + let stuples = List.filter + (fun stup -> + List.exists (fun (sterm,_) -> List.mem sterm sterms_in) stup) + stuples in + let atoms = List.map + (fun stup -> + let vartup = List.map (fun (sterm,_) -> + var_of_term data sterm) stup in + let fact_rel = rel_on_paths rel (List.map snd stup) in + Formula.Rel (fact_rel, vartup)) stuples in + if sign then atoms + else List.map (fun a -> Formula.Not a) atoms + with Not_found -> [] in + let transl_defrel sign rel args = + if List.mem rel data.defined_rels + then + !translate_defrel data sterms_all sterms_in s_subterms sign rel args + else transl_rel false rel args in + let rec aux = function + | Pos (Rel (rel, args)) -> transl_defrel true rel args + | Neg (Rel (rel, args)) -> transl_defrel false rel args + | Pos (Does _ | Role _) | Neg (Does _ | Role _) -> + [] + | Disj lits -> + [Formula.Or (List.map (fun l -> [aux l]) lits)] + | _ -> assert false in (* FIXME: what about Distinct? *) + Formula.And (Aux.concat_map aux rels_phi) + +let transl_state data phi = + let transl_sterm sterm = + let s_subterms = + map_paths (fun path subt -> subt, path) data.all_paths sterm in + let s_subterms = List.filter + (fun (subt, _) -> subt <> blank) s_subterms in + let vartup = [|var_of_term data sterm|] in + let anchor_and_fluent_preds = + List.map (fun (subt, path) -> + Formula.Rel (pred_on_path_subterm path subt, vartup)) s_subterms in + let mask_preds = Aux.map_some + (fun mask -> + if mask = simult_subst data.all_paths blank sterm + then Some (Formula.Rel (term_to_name mask, vartup)) + else None) data.mask_reps in + Formula.And (anchor_and_fluent_preds @ mask_preds) in + let rec aux = function + | Pos (True sterm) -> transl_sterm sterm + | Neg (True sterm) -> assert false + | Pos (Does _ | Role _) | Neg (Does _ | Role _) -> + [] + | Disj lits -> + [Formula.Or (Aux.map_some (fun l -> + match aux l with + | [] -> None | [phi] -> phi + | conjs -> Formula.And conjs) lits)] + | _ -> assert false in (* FIXME: what about Distinct? *) + Formula.And (Aux.concat_map aux phi) + + +(* [translate_disjunct] is $\mathrm{Tr}(\Phi_i,E)$, [rels_phi] is + $G_i$, [pos_state_phi] is $ST^{+}_i$, [neg_state_phi] is + $ST^{-}_i$, [ext_phi] is $E$. *) +let transl_disjunct data rels_phi pos_state_phi neg_state_phi ext_phi = + let pos_terms = state_terms pos_state_phi in + let pos_vars = List.map (var_of_term data) pos_terms in + let neg_terms = state_terms pos_state_phi in + let neg_vars = List.map (var_of_term data) neg_terms in + let all_terms = pos_terms @ neg_terms in + let phi_vars = clause_vars + (("", []), + rels_phi @ pos_state_phi @ neg_state_phi) in + let eqs = + List.map (fun v -> Pos (Rel ("EQ_", [v; v]))) phi_vars in + let rels_eqs = rels_phi @ eqs in + let negated_neg_state_transl = + (* negation-normal-form of "not neg_state_phi" *) + Formula.Or ( + List.map (tranls_state data) (nnf_dnf neg_state_phi)) in + Formula.Ex (pos_vars, + Formula.And [ + ext_phi; + transl_rels data rels_eqs pos_terms pos_terms; + transl_state data pos_state_phi; + Formula.Not ( + Formula.Ex (neg_vars, + Formula.And [ + transl_rels data rels_eqs all_terms pos_terms; + negated_neg_state_transl]))]) + + + +(* Translate a disjunction of conjunctions of literals (and disjs of lits). *) +let translate data disj = + let disj = separate_disj disj in + Formula.Or (List.map (fun (rels_phi, pos_state, neg_state) -> + transl_disjunct data rels_phi pos_state neg_state (Formula.And []) + ) disj) + + +(* **************************************** *) +(* {3 Build and use defined relations.} *) + +let build_defrels data clauses = + let all_branches = Aux.concat_map + (fun ((rel,args),body) -> + List.map (fun phi -> rel, (args, phi)) separate_disj [body]) + clauses in + let build_defrel rel = + (* searching for ArgType = DefSide,S,p *) + let branches = Aux.assoc_all rel all_branches in + (* first find the paths, we will find the state terms later *) + let branch_paths = + List.map (fun (args, body) -> + let sterms = state_terms body + and args = Array.of_list args in + Array.map (fun arg -> + Aux.concat_map (fun sterm -> + term_paths (fun subt -> subt = arg) data.m_paths sterm + ) sterms) args + ) branches in + let p_defside = List.fold_left + (Aux.array_map2 Aux.list_inter) branch_sterms in + let p_defside = Array.map + (function path::_ -> Some path | [] -> None) p_defside in + (* now find the mapping $\calS_i$ for the DefSide result *) + let branch_sterms (args, phi) = + let sterms = state_terms phi in + Aux.array_map2 + (fun arg -> function None -> None + | Some path -> + Some (List.find (fun sterm -> + List.mem path + (term_paths (fun subt -> subt = arg) + data.m_paths sterm)) sterms)) + args p_defside in + let s_defside = List.map branch_sterms branches in + (* now computing the ArgType(R,i) = CallSide,p variant *) + let call_branches = Aux.concat_map + (fun (_,(_, phi)) -> + let calls = Aux.assoc_all rel (rel_atoms phi) in + List.map (fun args -> args, phi) calls + ) all_branches in + let callside_for_arg i = + let call_paths = Aux.concat_map + (fun (args, phi) -> + let sterms = state_terms phi and subt = args.(i) in + let paths = + term_paths (fun subt -> subt = arg) data.m_paths sterm in + List.map (fun p -> p, ()) paths + ) call_branches in + let call_paths = List.map + (fun (p, ns) -> List.length ns, p) + (Aux.collect call_paths) in + (* decreasing order *) + match List.sort (fun (x,_) (y,_) -> y-x) call_paths with + | [] -> None + | (_,p)::_ -> Some p in + let p_callside = Array.mapi + (fun i -> + function Some _ -> None | None -> callside_for_arg i) + p_defside in + let arg_paths = Array.map2 + (fun defside callside -> + match defside, callside with + | Some p, _ | None, Some p -> p + | None, None -> (* find a good path *) + failwith "GGP/TranslateFormula: finding path for defined relation argument undetermined by state terms not implemented yet") + p_defside p_callside in + (* now building the translation *) + let defvars = Array.mapi (fun i _ -> + Formula.fo_var_of_string ("v"^string_of_int i)) arg_paths in + let defbody (args,(rels_phi,pos_state,neg_state)) s_defside = + let arg_eqs = Array.mapi + (fun i v -> + let in_I = p_defside.(i) <> None in + if in_I + then Formula.Eq (v, s_defside.(i)) + else Formula.Eq (v, + var_of_subterm data arg_paths.(i) args.(i))) + defvars in + let arg_eqs = Formula.And (Array.to_list arg_eqs) in + let callside_sterms = + Aux.array_mapi_some + (fun i -> function None -> None + | Some path -> + Some (blank_outside_subterm data path args.(i))) + p_defside in + let callside_sterms = Array.to_list + (Array.map (fun sterm -> True sterm) callside_sterms) in + transl_disjunct data rels_phi + (callside_sterms @ pos_state) neg_state arg_eqs in + let def_disjuncts = List.map2 defbody branches s_defside in + let defrel_arg_type = Array.map2 + (fun defside path -> defside <> None, path) + p_defside arg_paths in + data.defrel_arg_type := + (rel, defrel_arg_type) :: !data.defrel_arg_type; + (rel, defvars), Formula.Or def_disjuncts in + List.map build_defrel data.defined_rels + +let transl_defrel data sterms_all sterms_in s_subterms sign rel args = + let arg_type = List.assoc rel !data.defrel_arg_type in + (* the $s \tpos_{p_{R,i}} = t_i$ state terms *) + let arg_sterms = Array.mapi + (fun i (defside, path) -> if defside then None else + try Some ( + List.find (fun s -> at_path path s = args.(i)) sterms_all) + with Not_found -> None) + arg_type in + let var_args = Array.mapi + (fun i (_, path) -> + match arg_sterms.(i) with + | None -> var_of_subterm data path arg (* in J *) + | Some sterm -> var_of_term data sterm) + arg_type in + let defrel_phi = Formula.Rel (rel, var_args) in + let defrel_phi = + if sign then defrel_phi else Formula.Not defrel_phi in + let ex_vars = Array.to_list + (Aux.array_mapi_some (fun i (_,path) -> + if arg_sterms.(i) = None + then Some (var_of_subterm data path args.(i)) + else None) arg_type) in + let in_J_eq_transl i (_,path) = + if arg_sterms.(i) = None + then + let eq_phi = [Pos (Rel ("EQ_", [args.(i); args.(i)]))] in + let v = blank_outside_subterm data path args.(i) in + Some (transl_rels data eq_phi (v::sterms_all) [v]) + else None in + let eqs_phi = Array.to_list + (Aux.array_mapi_some in_J_eq_transl arg_type) in + Formula.Ex (ex_vars, Formula.And (defrel_phi::eqs_phi)) + +let _ = translate_defrel := transl_defrel + Added: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml (rev 0) +++ trunk/Toss/GGP/TranslateGame.ml 2011-07-09 12:37:34 UTC (rev 1508) @@ -0,0 +1,476 @@ +(** {2 Translating GDL definition: Toss rules and initial structure.} + +*) + +open GDL + +(** Translate stable relations that otherwise would be translated as + structure relations, but have arity above the threshold, as + defined relations. *) +let defined_arity_above = ref 2 + +(** Treat "next" clauses which introduce a fluent position for a + variable-variable mismatch, as non-erasing frame clauses (to be + ignored). ("Wave" refers to the process of "propagating the frame + condition" that these clauses are assumed to do, if + [nonerasing_frame_wave] is set to [true].) *) +let nonerasing_frame_wave = ref true + +(** Limit on the number of steps for aggregate playout. *) +let agg_playout_horizon = ref 30 + +(** Use "true" atoms while computing rule cases. *) +let split_on_state_atoms = ref false + + +type tossrule_data = { + lead_legal : term; + (* the "legal"/"does" term of the player that performs the move, we + call its parameters "fixed variables" as they are provided externally *) + precond : Formula.formula; + (* the LHS match condition (the LHS structure and the precondition) *) + rhs_add : (string * string array) list; + (* the elements of LHS/RHS structures, corresponding to the "next" + terms *) + struc_elems : string list; + fixvar_elemvars : + (string * (term * (string * string list) list) list) list; + (* "state" terms indexed by variables that they contain, together + with the mask-path of the variable *) + elemvars : term Aux.StrMap.t; +(* "state" terms indexed by Toss variable names they generate *) +} + +(** Data to be used when translating moves. *) +type gdl_translation = { + (* map between structure elements and their term representations; + the reverse direction is by using element names *) + elem_term : term Aux.IntMap.t; + f_paths : paths; + m_paths : paths; + masks : term list; + tossrule_data : tossrule_data Aux.StrMap.t; + (* rule name to rule translation data *) +} + +(* [most_similar c ts] finds a term from [ts] most similar to [c], and + the set of paths that merges the found term and [c]; as in the + definition of $s_\calC$ and $t_\calC$ for a clause $\calC \in + \mathrm{Next}_{e}$. Among the most similar terms finds one that is + not a "frame wave", if not possible and if {!nonerasing_frame_wave} + is [true] -- raises [Not_found]. *) +let most_similar c ts = + let gens = List.map (fun t -> t, merge_terms c t) ts in + (* worse-or-equal as "leq" *) + let cmp (_, (_, pn1, siz1)) (_, (_, pn2, siz2)) = + not (siz1 > siz2) && pn2 >= pn1 in + let best = Aux.maximal cmp gens in + (* avoid "frame wave" if possible *) + let t, (ps, _, _) = + if !nonerasing_frame_wave + then + List.find (fun (t, (ps, _, _)) -> + c = t || + List.for_all + (fun fluent -> Aux.Strings.is_empty (term_vars fluent)) + (at_paths ps t)) best + else List.hd best in + t, ps + + + +(* Find $s_\calC$ and $t_\calC$ for a clause $\calC \in + \mathrm{Next}_{e}$, i.e. in expanded "next" clauses. Determine + which original clauses are frame clauses, and which have to + be dropped (under assumption of being "frame waves"). Return the + proper frame clauses, the non-frame clauses, and the fluent paths + (as in definition of $\calP_f$). *) +let fluent_paths_and_frames clauses = + let defs = + defs_of_rules (Aux.concat_map rules_of_clause clauses) in + let stable, nonstable = stable_rels defs in + let inline_defs = + List.filter (fun (rel,_) -> List.mem rel nonstable) defs in + (* To determine whether a clause is a frame, we need to know its + expansion, so we expand clauses separately. A proper frame clause + must have *all* expansions being proper frame clauses. But a + clause is dropped as "frame wave" if any of its expansions is + regarded as "frame wave". *) + let next_clauses = + List.filter (fun ((rel,_),_) -> rel="next") clauses in + let next_e = + List.map (fun c -> + c, expand_positive_lits inline_defs [c]) next_clauses in + let find_br_fluents s_C (_,body,neg_body) = + let p_ts = Aux.assoc_all "true" body in + let n_ts = Aux.assoc_all "true" neg_body in + let t_C, ps = most_similar t_C (p_ts @ n_ts) in + (* "negative true" check *) + t_C, ps, List.mem t_C p_ts in + let is_frame s_C (t_C, _, neg_true) = + not neg_true && s_C = t_C in + let find_fluents (c, c_e) = + let s_C = snd (fst c) in + let res = List.map (find_br_fluents s_C) c_e in + if List.for_all is_frame res + then Aux.Left c + else + let f_paths = + List.map (fun (t_C, ps, neg_true) -> + if neg_true + then + term_paths (function Const _ -> true | _ -> false) t_C + else ps) res in + Aux.Right (c, List.fold_left paths_union GDL.Empty f_paths) in + let res = Aux.map_try find_fluents next_e in + let frames, fluents = Aux.partition_choice res in + let move_clauses, f_paths = List.split fluents in + frames, move_clauses, + List.fold_left paths_union GDL.Empty f_paths + + +let rec contains_blank = function + | Const "_BLANK_" -> true + | Func args -> Aux.array_existsi (fun _ -> contains_blank) args + | _ -> false + + +(* Expand role variables, find fluent and mask paths, generate the + initial structure. *) +let create_init_struc clauses = + let players = + Aux.map_some (function + | ("role", [player]), _ -> Some player + | _ -> None + ) clauses in + let stable_rels, nonstable_rels, + stable_base, init_state, (agg_actions, agg_states) = + aggregate_playout players !agg_playout_horizon rules in + let frame_clauses, move_clauses, f_paths = + fluent_paths_and_frames clauses in + let next_clauses = + List.map (fun ((_,s_C),body_C) -> s_C, true, body_C) frame_clauses + @ List.map (fun ((_,s_C),body_C) -> s_C, false, body_C) + move_clauses in + let arities = + ("EQ_", 2):: + Aux.unique_sorted + (List.map (fun ((rel, args),_) -> rel, List.length args) + clauses) in + let element_terms = + List.fold_left (fun acc st -> Aux.unique_sorted (st @ acc)) [] + agg_states in + let element_reps = + Aux.unique_sorted (List.map (fun t -> + simult_subst f_paths blank t) element_terms) in + let m_paths = List.map + (term_paths ~prefix_only:true (neg contains_blank)) element_reps in + let m_paths = + List.fold_left paths_union GDL.Empty m_paths in + let mask_reps = + Aux.unique_sorted (List.map (fun t -> + simult_subst m_paths blank t) element_reps) in + let m_pathl = paths_to_list m_paths in + let f_pathl = paths_to_list f_paths in + (* adding subterm equality relations and fact relations *) + let struc_rels, defined_rels = + List.partition (fun rel -> + List.assoc rel arities <= !defined_arity_above) stable_rels in + let struc_rels = "EQ_"::struc_rels in + let defined_rels = defined_rels @ nonstable_rels in + let struc = + List.fold_left (fun struc rel -> + let arity = List.assoc rel arities in + let elem_tups = Aux.all_ntuples elem_reps arity in + let path_tups = Aux.all_ntuples m_pathl arity in + List.fold_left (fun ptup -> + let fact_rel = rel_on_paths rel ptup in + Aux.fold_left_try (fun etup -> + let tup = List.map2 at_path etup ptup in + if rel = "EQ_" && arity = 2 && + List.hd tup = List.hd (List.tl tup) + || List.mem (rel, tup) stable_base + then + Structure.add_rel_named_elems struc fact_rel + (Aux.array_map_of_list name_of_term tup) + else struc + ) struc elem_tups + ) struc path_tups + ) (Structure.empty ()) struc_rels in + (* adding anchor and fluent predicates *) + let add_pred struc paths elements = + List.fold_left (fun path -> + Aux.fold_left_try (fun elem -> + let pred = + pred_on_path_subterm path (at_path elem path) in + let tup = [|elem|] in + Structure.add_rel_named_elems struc pred + (Aux.array_map_of_list name_of_term tup) + ) struc elements + ) struc paths in + let struc = add_pred struc m_pathl element_reps in + let struc = add_pred struc f_pathl init_state in + (* adding mask predicates *) + let all_paths = paths_union m_paths f_paths in + let struc = + List.fold_left (fun struc m -> + let pred = term_to_name m in + List.fold_left (fun struc elem -> + if simult_subst all_paths blank elem = m + then + Structure.add_rel_named_elems struc pred + [|name_of_term elem|] + else struc + ) struc element_reps + ) struc maks_reps in + next_clauses, f_paths, m_paths, mask_rels, defined_rels, + stable_base, init_state, struc + + +(* Find the rule clauses $\ol{\calC},\ol{\calN}$. *) +let move_tuples used_vars next_cls legal_tuples = + (* computing the $d_i(\calN)$ for each $\calN$ *) + let fresh_x_f () = + let x_f = Aux.not_conflicting_name !used_vars "x_f" in + used_vars := Aux.Strings.add x_f !used_vars; + x_f in + let does_facts (_,body as cl) = + List.fold_right (fun p (sb, dis) -> + let djs = + Aux.map_some (function + | Does (dp, d) when dp = p -> Some d + | _ -> None) body in + let sb = unify_all sb djs in + let d = + match djs with + | [] -> fresh_x_f () + | d::_ -> subst sb d in + sb, d::dis + ) players ([], []) in + let next_cls = + Aux.map_try (fun cl -> + let sb, ds = does_facts cl in + subst_clause sb cl, ds) next_cls in + (* selecting $\ol{\calC},\ol{\calN}$ clauses with + $\sigma_{\ol{\calC},\ol{\calN}}$ applied *) + let tup_unifies ts1 ts2 = + try unify [] ts1 ts2; true + with Not_found -> false in + let move_clauses cs = + (* bag of next clauses for each legal tuple *) + let next_clauses = + List.filter (fun (n_cl, ds) -> tup_unifies cs ds) next_cls in + (* two passes to ensure coverage and maximality *) + let rec coverage = function + | (n_cl, ds)::more_cls as all_cls + , ((sb, tup_ds, n_cls)::other_cl_tups as all_cl_tups) -> + (try + let sb, tup_ds = List.fold_right + (fun (di, acc_di) (sb, tup_ds) -> + let sb = unify sb [di] [acc_di] in + sb, subst sb di::tup_ds + ) (List.combine ds tup_ds) (sb, []) in + coverage (more_cls, (sb, tup_ds, n_cl::n_cls)::other_cl_tups) + with Not_found -> + (* start a new tuple *) + coverage (all_cls, ([], cs, [])::all_cl_tups) + ) + | [], all_cl_tups -> all_cl_tups + | _, [] -> assert false in + let cl_tups = + coverage (next_clauses, [[], cs, []]) in + let maximality cl_tup = + List.fold_left (fun (sb, tup_ds, n_cls as cl_tup) (n_cl, ds) -> + if List.mem n_cl n_cls then cl_tup + else + try + let sb, tup_ds = List.fold_right + (fun (di, acc_di) (sb, tup_ds) -> + let sb = unify sb [di] [acc_di] in + sb, subst sb di::tup_ds + ) (List.combine ds tup_ds) (sb, []) in + (sb, tup_ds, n_cl::n_cls) + with Not_found -> cl_tup + ) cl_tup next_clauses in + List.map maximality cl_tups in + Aux.concat_map move_clauses legal_tuples + + +let add_erasure_clauses (legal_tup, next_cls) = + let fixed_vars = terms_vars legal_tup in + let frame_cls = + Aux.map_some (fun (s, frame, body) -> + if frame then Some (s, body) else None) next_cls in + (* two passes to ensure coverage and maximality *) + (* FIXME-TODO: treat fixed-vars as consts, by substituting them with + Const, and later substituting-back Var *) + let rec coverage = function + | (s, body)::more_cls + , ((sb, s_acc, bodies)::other_frames as all_frames) -> + (try + let sb = unify sb [s] [s_acc] in + let s_acc = subst sb s in + coverage (more_cls, (sb, s_acc, body::bodies)::other_frames) + with Not_found -> + (* start a new frame *) + coverage (more_cls, ([], s, [body])::all_frames) + ) + | [], all_frames -> all_frames + | (s, body)::more_cls, [] -> + coverage (more_cls, [[], s, [body]]) in + let frames = coverage (frame_cls, []) in + let maximality frame = + List.fold_left (fun (sb, s_acc, bodies as frame) (s, body) -> + if List.mem body bodies then frame + else + try + let sb = unify sb [s] [s_acc] in + let s_acc = subst sb s in + (sb, s_acc, body::bodies) + with Not_found -> frame + ) frame frame_cls in + let frames = List.map maximality frames in + let frames = + List.map (fun (sb, s, bodies) -> + s, List.map (subst_rels sb) bodies) in + let erasure_cls = + Aux.concat_map (fun (s, bodies) -> + let nbodies = negate_bodies bodies in + List.map (fun b -> s, b) nbodies + ) frames in + let next_cls = + Aux.map_some (fun (s, frame, body) -> + if not frame then Some (s, body) else None) next_cls in + legal_tup, next_cls @ erasure_cls + + +(* Assign rule clauses to rule cases, i.e. candidates for Toss + rules. Collect the conditions and RHS state terms together. *) +let rule_cases (legal_tup, next_cls) = + let atoms = Aux.concat_map + (fun (_, body) -> Aux.map_some (function + | Pos (Rel _ as a) | Neg (Rel _ as a) -> Some a + | (Pos (True _ as a) | Neg (True _ as a)) + when !split_on_state_atoms -> Some a + | _ -> None) body) next_cls in + let patterns = + let next_cls = Array.of_list next_cls in + List.map (fun a -> + Array.map (fun i (_, body) -> + if List.mem (Neg a) body then -1 + else if List.mem (Pos a) body then 1 + else 0 + ) next_cls, + a) atoms in + let patterns = Aux.collect patterns in + let patterns = List.filter (fun (pat, _) -> + Array.exists (fun v-> v < 1) pat && + Array.exists (fun v-> v > -1) pat) patterns in + let pos_choice = List.map (fun _ -> true) patterns in + let neg_choice = List.map (fun _ -> false) patterns in + let choices = Aux.product [pos_choice; neg_choice] in + let rule_case choice = + let separation_cond = + List.concat + (List.map2 (fun b (_, atoms) -> + if b then List.map (fun a -> Pos a) atoms + else List.map (fun a -> Neg a) atoms) choice patterns) in + let case_cls = + List.filter (fun (_, body) -> + List.for_all2 (fun b (_, atoms) -> + if b then (* atoms not excluded *) + List.for_all (fun a -> not (List.mem (Neg a) body)) atoms + else (* atoms not included *) + List.for_all (fun a -> not (List.mem (Pos a) body)) atoms + ) choice patterns + ) next_cls in + let case_rhs, case_conds = List.split case_cls in + case_rhs, separation_cond @ case_conds in + List.map (fun choice -> + let case_rhs, case_conds = rule_case choice in + let case_conds = case_conds @ + Aux.concat_map snd legal_tup in + case_rhs, case_conds) choices + + +(* The candidates need to be filtered before finishing the + translation of Toss rules. *) +let create_rule_cands used_vars next_cls clauses = + let players = (* Array.of_list *) + Aux.map_some (function + | ("role", [player]), _ -> Some player + | _ -> None + ) clauses in + let legal_cls = + List.filter (fun ((rel,_),_) -> rel="legal") clauses in + (* let next_cls = + List.filter (fun ((rel,_),_) -> rel="next") clauses in *) + (* constructing $(\calC_1,...,\calC_n)$ tuples *) + let legal_by_player = + List.map (fun p -> + Aux.map_some (function + | ("legal",[lp; l]), body when lp = p -> Some (l, body) + | _ -> None) legal_cls + ) players in + let legal_tuples = Aux.product legal_by_player in + let move_tups = move_tuples used_vars next_cls legal_tuples in + let move_tups = + List.map (fun (sb, legal_tup, n_cls) -> + List.map (subst sb) legal_tup, + List.map (subst_clause sb) n_cls) move_tups in + let move_tups = List.map add_erasure_clauses move_tups in + Aux.concat_map rule_cases move_tups + + +let filter_rule_cands stable_base defined_rels rule_cands = + let check_atom = function + | Pos (Rel (rel, _ as a)) -> + List.mem rel defined_rels || + List.exists (rels_unify a) stable_base + | Neg (Rel (rel, _ as a)) -> + List.mem rel defined_rels || + not (List.exists (rels_unify a) stable_base) + | _ -> true in + List.filter (fun (case_rhs, case_conds) -> + List.for_all check_atom case_conds + ) rule_cands + + +let translate_game clauses = + let clauses = expand_players clauses in + let used_vars, clauses = rename_clauses clauses in + let next_cls, f_paths, m_paths, mask_rels, defined_rels, + stable_base, init_state, struc = create_init_struc clauses in + let rule_cands = create_rule_cands used_vars next_cls clauses in + let rule_cands = filter_rule_cands stable_base rule_cands in + let all_state_terms = + Aux.concat_map state_terms (List.map snd clauses) in + let term_arities = Aux.unique_sorted + (Aux.concat_map term_arities all_state_terms) in + + + +(* ************************************************************ *) +(* ************************************************************ *) +(** {3 Translating Moves.} *) + + +let initialize_game player game_descr startcl = + let gdl_transl, state = translate_game player game_descr in + state, None, gdl_transl + + +let translate_last_action gdl_translation state actions = + if actions = [] then (* start of game -- Server will not perform a move *) + "", [] + else translate_incoming_move gdl_translation state actions + + +let translate_move gdl_translation new_state rule emb = + let res = translate_outgoing_move gdl_translation new_state rule emb in + (* {{{ log entry *) + if !debug_level > 0 then ( + Printf.printf "GDL.translate_move: %s\n%!" res + ); + (* }}} *) + res This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-07-10 19:48:05
|
Revision: 1509 http://toss.svn.sourceforge.net/toss/?rev=1509&view=rev Author: lukstafi Date: 2011-07-10 19:47:57 +0000 (Sun, 10 Jul 2011) Log Message: ----------- GDL translation work in progress: file changes. Does not compile yet. Modified Paths: -------------- trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateGame.ml Added Paths: ----------- trunk/Toss/GGP/TranslateFormula.mli trunk/Toss/GGP/TranslateGame.mli trunk/Toss/GGP/TranslateGameTest.ml Removed Paths: ------------- trunk/Toss/GGP/Translate.ml trunk/Toss/GGP/Translate.mli trunk/Toss/GGP/TranslateTest.ml Deleted: trunk/Toss/GGP/Translate.ml =================================================================== --- trunk/Toss/GGP/Translate.ml 2011-07-09 12:37:34 UTC (rev 1508) +++ trunk/Toss/GGP/Translate.ml 2011-07-10 19:47:57 UTC (rev 1509) @@ -1,3711 +0,0 @@ -open GDL - -(** {2 Game Description Language.} - - Type definitions, helper functions, game specification - translation. - - The translation is not complete (yet), and not yet guaranteed to - be sound (but aiming at it) -- report any cases where the - algorithm does not fail explicitly but does not preserve - semantics. - - (1) Aggregate playout: generate successive states as if all moves - legal in the previous state were performed. Do not check the - termination predicate. To avoid ungrounded player variables, add - "role" filter to "legal" rules. - - (1a) Reason for unsoundness: "legal" or "next" preconditions can - depend negatively on state, preventing further moves in the - aggregate state that would be possible in some of valid game - states; the aggregate state does not have enough terms as a - result. Workaround: remove negative literals from "legal"/"next" - conditions for generating aggregate playout. - - (1b) Saturation works on definitions stratified - w.r.t. negation. Positive literals are instantiated one by one, - then negative literals are checked over the facts derived from - previous strata. To avoid redundancy, new facts and new - instantiations are kept separate for the next iteration within a - stratum. - - (1c) Heuristic reason for unsoundness: while we check for fixpoint - in the playout, we rule out state terms "F(X)" where X is a player - (assuming that "F" means "control"). Workaround: turn off fixpoint - checking [aggregate_fixpoint]. - - (2) Arena graph: currently, only a simple cycle is allowed. The - succession of players is determined from the aggregate playout. - - In case of problems, it should be relatively easy to expand the - translation to use a single location per player, and for rules to - determine which player is active after the rule takes effect - (i.e. the target location.) Once Toss has a good system for - simultaneous moves, we can simplify by translating into a single - location game, obsoleting this "chapter". - - (2a) We need to recognize which player actually makes a move in a - state. For this we need to locate the "noop" arguments to "legal" - and "does" relations. A noop action in a location is the only - action in the corresponding state of an aggregate playout for the - player that is also constant. - - (2b) We determine the player of a location by requiring that at - most one player has a non-noop action in an aggregate - state. When all players are noops we select the control player so - that the smallest "game cycle" is preserved. Otherwise (more than - one no-noop move) we fail (simultaneous moves not supported). We - remember the noop actions for each location and player. - - (3) Currently, a constant number of elements is assumed. The rules - processed in (3a)-(3b) are already expanded by (6). - - (3a) Element terms are collected from the aggregate playout: the - sum of state terms. - - (3b) Element masks are generated by generalization from all "next" - rules where the "does" relations are expanded by all unifying - "legal" rules (see also (7a)). - - (3c) Generalization in a single expanded "next" rule is by finding - for the "next" term the closest "true" term in the lexicographic - ordering of (# of matched variables, # of other matched leaves), - but in case the closest term is found in the negative part, it is - further processed. - - (3c1) Unmatched subterms are replaced by meta-variables. - - (3c2) When the generalization comes from the negative part, we - replace all constant leaves with meta-variables. Warning: this - heuristic is a reason for unsoundness -- search for a workaround - once a real counterexample is encountered. - - (3c3) When [nonerasing_frame_wave] is set to [true], remove - branches that have a variable/variable mismatch at proposed fluent - position.(TODO) - - (3d) The masks are all the minimal w.r.t. matching (substitution) - of the generalized terms, with only meta-variable positions of the - mask matching meta-variable positions of a generalized - term. - - TODO: this is wrong! Generates too many masks compared to the - paper method (using fluent paths). Should generalize masks that - do not differ at constant/functor-constant/functor positions. - - (3e) The elements are the equivalence classes of element terms, - where terms are equivalent when they both match a single mask and - their matching substitutions differ only at - meta-variables. (I.e. for t1 and t2 there exists a mask m and - substitutions s1 and s2 such that s1(m)=t1 and s2(m)=t2 and - s1(x)=/=s2(x) implies that x is/contains a meta-variable.) - - (Note that there is "nothing wrong" with a given equiv class not - having any member in the initial state or some other state. The - element is still there in the structure, still participating in - the "static" relations, but not in the "dynamic" predicates in - that particular state. We use a special _BLANK_ term/predicate to - faciliate operations on such "absent" elements.) - - (4) Static relations (their tuples do not change during the game) - are derived from static facts with subterms common with element - terms but not below meta-variables. - - Define mask-paths as the set of a mask together with a path in it - to a position that is not below (or at) a meta-variable. - - Implementation: currently we approximate paths by only taking the - positions of variables in the mask. - - (4a) (Fact relations.) For a static fact (a relation that does not - depend on "true" or "init") (unless it is expanded -- see (6)), - introduce a relation for each mask-paths tuple with arity of the - relation (i.e., introduced relations are a dependent product of - static fact relations and a cartesian n-th power of the mask-paths - set where n is the arity of the relation). An introduced relation - holds over a tuple of elements, iff the corresponding element - terms match the respective masks, and the original relation holds - over the tuple of subterms selected from the element terms by the - corresponding paths. - - (4b) (Equality relations.) For each mask-path, introduce a binary - relation that holds over elements which have the same subterm at - the mask-path position. (Because of mask-paths definition, same - for all element terms in element's equivalence class.) - - (4c) (Anchor predicates.) Add a predicate for being derived from a - mask (which is applied in (7i-4c) only if not adding mask-path - predicates, fact or equivalence relations from which it can be - inferred). For each mask-path pointing to a constant in some of - the elements and that constant, introduce a new predicate with - semantics: "matches the mask and has the constant at the path - position". - - Optionally, also include a positive mask predicate for negative - state terms (rather than a negative one). - - (5) (Mostly) dynamic relations ("fluents": their tuples change - during the game), relations derived from all below-meta-variable - subterms of element terms, initialized by those that appear in the - initial state. (Some relations introduced in this step might not - be fluents.) - - (See also (7k).) For each element term, find the element mask it - matches, and introduce relations for each meta-variable of the - element mask, associated with the subterm that matches the - meta-variable. The semantic is that the relation selects the - element terms that match the mask with the associated subterm - subsituted for the corresponding meta-variable, with existential - interpretation. A relation holds initially over an element, if in - the initial set of element terms at least one from the element's - equivalence class is selected by the relation. An occurrence of - "true" or "next" relation is replaced by a conjunction of - relations whose substituted-masks match the relation's term. - - When generating predicates that hold over an element term, no - predicate is generated for any its meta-variable position that - contains _BLANK_. - - (6) Currently how to introduce defined relations in translation is - not yet solved in the presented framework. Currently, we simply - expand relations that are not static, or (optionally) are static - but do not contain ground facts, by duplicating the branch in - which body an atom of the relation occurs, for each branch of the - relation definition, unifying and applying the unifier. (If the - duplication turns out prohibitive, this will be a huge TODO for - this translation framework.) - - First, we expand all uses of the built-in "role" predicate. - - (6a) The definition: - - [(r, params1) <= body1 ... (r, params_n) <= body_n] - - provides a DNF defining formula (using negation-as-failure): - - [(r, args) <=> exist vars1 (params1 = args /\ body1) \/ ... - \/ exist vars_n (params_n = args /\ body_n)] - - which expands in a natural way for positive occurrences. We - duplicate the branch where [(r, args)] is substitued for each - disjunct and apply the unifier of [params_i = args] in the whole - [i]th cloned branch, eliminating the [params] (rather than the - [args]) when possible. We freshen each [vars_i] to avoid - capture. If unification fails, we drop the corresponding branch - clone. - - (6b) For negative occurrences we transform the defining formula - to: - - [not (r, args) <=> not exist vars1 (args = params1 /\ body1) /\ ... - /\ not exist vars_n (args = params_n /\ body_n)] - - (6b1) If the relation has negative subformulas in any of [body_i], - unless all the negative subformulas are just "distinct" checks - that become ground, we first negate the definition and then expand - the negation as in the positive case. - - (6b1a) Eliminate [args = params_i] by substituting-out variables - from [params_i] whenever possible. - - Note: the [args] need to be instatiated for the particular - solution that is extended (the solution substitution applied). - - (6b1b) We group the positive atoms of body_i together and split - the quantifier if each negative subformula and the positive part - have disjoint [vars_i] variables; if not, the translation fails; - currently, if a negative subformula has free variables in vars_i, - the translation also fails. - - (6b1c) So we have two levels of specification-affecting TODOs; - working around variables shared between negated subformulas or the - positive part -- forbidding pushing quantification inside -- will - require major rethinking of implementation; if the quantification - can be pushed inside but doesn't disappear around a negated - subformula, we will need to extend the universal quantifier - handling from only negated to both negated and positive - subformulas, which shouldn't be problematic. - - (6b1d) Now push the negation inside the conjunction so that all - double negations cancel out (the positive conjuncts are under a - single, now negated, quantifier -- see (6b2) about negated - conjunctions of atoms). Next we pull the disjunctions out - (reducing to DNF-like form), and continue as in the positive case - (6a). - - (6b2) We allow conjunctions of atoms to be negated (not only - literals) in a branch. We expand [not (r, args)] (in general, [not - (and (...(r args)...))]) into the conjunction of negations, with - no branch duplication (in general, duplicating the negated - subformula inside a branch). We only apply the unifier of [args = - params_i] to [body_i] (in general, the whole negated subformula), - eliminating the [params] (rather than the [args]) when - possible. Still, we freshen each [vars_i] to avoid capture. We - remember the (uneliminated) [vars_i] in the set of variables - quantified existentially under the negation (since the free - variables occurring only under the negation are quantified - universally there -- it is a positive position). If unification - fails, we drop the corresponding negated subformula. If - unification succeeds but the corresponding [body_i] is empty (and, - in general, no other disjuncts in the negated subformula are - left), we drop the branch. - - (7) Generation of rewrite rules when the dynamic relations are not - recursive and are expanded in the GDL definition. - - (7a) We translate each branch of the "legal" relation definition - as one or more rewrite rules. Currently, we base availability of - rules in a location on the player in the location and noop actions - of other players in it, compared to the "legal" definition - branch (currently, we do not allow simultaneous moves). If the - branch of "legal" definition has a variable for a player, it is - instantiated for each player in the game, and the variable - substituted in the body of the "legal" branch. A rewrite rule is - associated with a single "lead legal" branch of the location's - player. - - (7a1) Filter "lead legal" rules by satisfiability in the current - location plys of the aggregate playout. - - (7b) We collect all the branches of the "next" relation definition - for which the selected branches of "lead legal" and "noop legal" - (the "joint legal" actions) unify with all (usually one, but we - allow zero or more) occurrences of "does" with a single unifier - per "next" branch. (A "noop legal" actually only matches and - substitutes the local variables of "next" branches.) Split the - unifiers into equivalence classes (w.r.t. substitution), each - class will be a different rewrite rule (or set of rules). (Note - that equivalent unifiers turn out to be those that when truncated - to variables of the "legal" branch are renamings of each other.) - - (7b1) Since the "noop legals" are constants (by current - assumption), we do not need to construct equivalence classes for - them. Their branches will join every rule generated for the "joint - legal" choice. - - (7c) Find a single MGU that unifies the "legal" atom argument and - all the "does" atoms arguments into a single instance, and apply - it to all "next" branches of the rule (i.e. after applying the - original unifier, apply a renaming that makes the unifier equal to - all other unifiers in the equiv. class). We replace all - occurrences of "does" with the body of the selected "legal" - branch. - - (7d) Add all branches of equiv classes smaller than a given equiv - class to its branch set. - - Implementation TODO (reason for unsoundness): currently, we - discard non-maximal equivalence classes, because negation (7e) is - not implemented, and with negation it would still be preferable to - have exhaustiveness check so as to not generate spurious - (unapplicable) rules. TODO: rethink, compare with (7f2). - - (7e) Associate negation of equalities specific to the unifiers - strictly less general than the equivalence class with it, so that - the resulting conditions form a partition of the space of - substitutions for the "legal" branch processed. - - (7f) We remember all variables in the "legal"/"does" instantiation - as "fixed variables". We seggregate "next" atoms into these that - contain some fixed variables or no variables at all, and other - containing only unfixed variables. - - (7f1) Branches with only (TODO: some? (x)) unfixed variables in "next" - atoms that are "identities" are the "frame" branches. "Identity" - here means the "next" atom is equal to one of the positive "true" - atoms. - - (x) It is probably better to not expand "identity" branches that - have both fixed and unfixed variables in the head, as they will be - correctly handled (translated to erasure branches) in the - following code. - - (7f2) Transform the "frame" branches into "erasure" branches: - distribute them into equivalence classes of head terms - (w.r.t. substitution but treating fixed variables as constants), - add smaller elements and negation of larger elements (in the same - manner as in (7b) and (7d) for the "legal" term), disjoin bodies - in each class (a "multi-body"), then: - - (7f3) negate the multi-body, push negation inside (using de Morgan - laws etc.), split into separate "erasure" branch for each - disjunct, place the original "next" atom but with meta-variable - positions replaced by _BLANK_ as the head of the "erasure" branch, - apply (and remove) unification atoms resulting from negating the - "distinct" relation. The local variables of newly created negated - subformulas become existentially-quantified-under-negation - (i.e. universally quantified) (while the local variables of old - negated subformulas are "let free"). - - FIXME: it is probably wrongly assumed in the implementation that - negated "distinct" unifies all terms, instead of disjunction of - pairwise unification, check that. - - (7f4) Drop the erasure branches that contradict the "legal" - condition of their rule. (Add the "legal" condition for early pruning.) - - (7f5) Redistribute the erasure branches in case they were - substituted with the "not distinct" unifier to proper equivalence - classes (remove equivalence classes that become empty). - - (7f6) Filter-out branches that are not satisfiable by their static - part (in the initial structure). - - (7g) NOOP (Was eliminating unfixed variables.) - - (7h) Introduce a new element variable for each class of "next" and - "true" terms equal modulo mask (i.e. there is a mask matching them - and they differ only at-or-below metavariables). (Remember the - atoms "corresponding variable".) From now on until (7l1) we keep - both the (partially) Toss-translated versions and the (complete) - GDL-originals of branches (so to use GDL atoms for "subsumption - checking" in (7l)). - - (7i-7k) Variables corresponding to negated "true" atoms - that contain locally existentially quantified variables are - quantified universally (with a scope containing all their - occurrences). - - Implementation: we only introduce universal quantification after - filtering (7m), is it OK? - - (7i-4a) For all subterms of "next" and "true" atoms, identify the - sets of <mask-path, element variable> they "inhabit". Replace a - static fact relation by relations built over a cartesian product - of <mask-path, element variable> sets derived for each static - fact's argument by applying corresponding (4a) relations. Only - build the relation over positive elements, deferring negated ones - to (7k-4a) so that they are included under common - disjunction. Relations over elements coming from different - negations are not introduced, which agrees with negation-as-failure. - - (7i-4c) Include the (4c) relations for "next" and "true" positive - atoms. - - (7i-4b) (4b) is essentially a special case of (4a). Add an - appropriate equality relation of (4b) for each case of subterm - shared by terms corresponding to different positive elements. - - Implementation: instead of all subterms we currently only consider - subterms that instantiate (ordinary) variables in the mask - corresponding to the "next"/"true" atom. - - (7i0) For "distinct", negate the anchors of the constants at mask - paths of the variables, and equivalences of the variables (if - there are multiple variables). - - TODO: currently only checks whether "distinct" arguments are - syntactically equal. - - (7i1) Remove branches that are unsatisfiable by their static - relations (4a), (4b) and (positive) (4c) alone. - - (7j) Identify variables in "next" & "true" terms that are - at-or-below meta-variables in the corresponding mask. (Most of - such variables should be already removed as belonging to "frame" - branches.) Such fixed variables should be expanded by duplicating - the whole set of branches together with the "lead legal" term. - - Implementation: TODO; currently, we check for such fixed - variables and fail if they're present. - - (7k) Replace the "next" and "true" atoms by the conjunction of - (4b), (4c) and (5) predicates over their corresponding variable. (For - negative "true" literals this will be equivalent to a disjunction - of negations of the predicates.) Note that positive static - relations are already added in (7i-4b,4c). Handle negative subformula - translations of (4a, 4b, 4c, 5) together. - - (7k-4a-1) Add to the disjunction a negation of all what (7i-4a) - would generate (i.e. for positive facts), but over tuples with at - least one of the negated elements of current negation (no elements - from other negations). - - (7k-4a-2) For a negative fact generate result equivalent to a - *conjunction* of negations of generated atoms if all elements are - positive, - - (7k-4a-3) but add a *disjunction* of negations (i.e. a negated - conjunction) of tuples with at least one negated element. - - (7k-4c) Include the (4c) relations for "next" and "true" negative - atoms. - - (7k-4b) It is essentially a special case of (7k-4a-1). Introduce - equivalences as in (7i-4b), but with tuples containing at least - one element from the current negation (no elements from other - negations). Generate the same set of equivalence tuples as a - positive occurrence would so that they can be pruned when - possible. - - TODO: handle "distinct" that contains variable(s)! - - (7l) Build a pre-lattice of branch bodies w.r.t. subsumption, - in a manner similar to (7b). The subsumption test has to say "no" - when there exists a game state where the antecedent holds but the - consequent does not, but does not need to always say "yes" - otherwise. Build a rewrite rule for each equivalence class - w.r.t. subsumption, including also branches that are below the - equiv class, and including negation of conditions that make the - branches strictly above more specific -- so that the classes form - a partition of the nonterminal game states (it is semantically - necessary so that all applicable changes are applied in the - translated game when making a move). The lattice is built by - summing rule bodies. - - (7l0) To avoid contradictions and have a complete partition, we - construct the set of all bit vectors indexed by all atoms - occurring in the bodies (optionally, all atoms in bodies of - branches containing "does" atoms). We collapse atoms that have the - same pattern of occurrence in the branches as single index. - - (7l1) With every index-bit value we associate the set of branches - that do not allow such literal. For every vector we calculate the - complement of the sum of branch sets associated with every - bit. The unique resulting sets are exactly the Toss rules - precursors. Heuristic (FIXME: needed?): We only use atoms that are - deterministically present or absent in at least some branch for - indexing. - - (7l2) Filter rule candidates so that each has a "does"-specific - branch. - - TODO: perhaps should be optional -- perhaps there are "default - all noop rules" in some games. - - (7l3) Optionally, remove synthetic branches that do not have (a) - gdl variables (i.e. Toss equivalence relations) or (b) state terms - (i.e. Toss variables) in common with the non-synthetic branches of - the rule candidate. - - Only translate the formulas after (7l3). - - (7l3b) In this optional case, only keep synthetic branches that - either have non-state-term atoms with gdl variables common with - base branches, or actually have state terms in common with base - branches. (E.g. do not keep a branch with "(R ?x ?y) (true (ST ?v ?x)) - (true (ST ?v ?y))" when only "v" is in common with base branches.) - - (7l4) Filter out rule candidates that contradict all states - from the current location plys of aggregate playout (by their - "true" atoms -- "not true" are not valid in the aggregate playout). - - (7l5) Here a set of branches has conjunctive interpretation, since - they are the "next" clauses that simultaneously match. If a branch - fails, the whole case fails. - - (7m) Filter the final rule candidates by satisfiability of the - static part (same as (7i1) conjoined). - - (7n) Include translated negation of the terminal condition. (Now we - build rewrite rules for a refinement of an equivalence class of - (7b): from the branches with unifiers in the equiv class, from - branches with unifiers more general than the equiv class, and from - the disjointness conditions and the terminal condition.) - - (7n1) Prior to translation, expand all variables under - meta-variables in "terminal" branches, as in (7j). - - The rewrite rule is generated by joining the derived conjunctions - from "next" atoms as RHS, and from bodies as the - precondition. Exactly the RHS variables are listed in the LHS - (other variables are existentially closed in the - precondition). All the relations that appear in either LHS or RHS - are considered embedded. - - (7o) After the rules are translated, perform an aggregated playout - of the Toss variant of the game. Remove the rules that were never - applied. - - (8) We use a single payoff matrix for all locations. Goal patterns - are expanded to regular goals by instantiating the value variable - by all values in its domain (for example, as gathered from the - aggregate playout), and expanding all atoms that contained value - variables (both static and dynamic) using (6); fail if a goal - value cannot be determined. - - (8a) Filter-out goal branches that are contradictory with the - terminal condition (using resolution on the GDL - side). Implementation TODO. - - (8b) For each goal value we collect bodies to form a disjunction. - - (8c) The payoff formula is the sum of "goal" value times the - characterisic function of the corresponding "goal" bodies. To - simplify the result, we find the longest formula, and center the - payoff around it: for the goal value V_i if i-th formula phi_i and - phi_K being the longest formula, we translate the payoff into "K + - (V_1 - V_K) :(phi_1) + ... (V_n - V_K) :(phi_n)" thus removing - phi_K from translation. - - (8d) Finally, we simplify the result. Unused predicates are not - removed, because some of them will be needed for action translation. - - (9) To translate an incoming action, we: - - (9a) find the "lead legal" term to which the "does move" ground - term of the current player matches; - - (9b) earlier, remember which Toss variables of a rule contain which - fixed variables at which positions in their masks; - - (9c) find anchor predicates corresponding to instantiations of the - "lead legal" variables, anchoring positions found by (9b) "fixed - var" - "mask + mask var" correspondence; - - (9d) build a conjunction of anchor predicates over variables that - contain the fixed variable which is "instantiated" by the anchor - of the corresponding position, as established by (9c); - - (9e) conjoin the (9d) with the "matching" formula of a rule, and - evaluate the result for all rules (of the located "lead legal" - class); only a single rule should have a match, and only a single - assignment should be returned; this rule with this assignment is - the translated move. - - (10) To translate an outgoing action, we: - - (10a) associate the rule with its corresponding data: the "lead - legal" term, the fixed variables corresponding to rule elements, - ... - - (10b) earlier, return/store the mapping from an element to the - mask and subsitution that define the element; - - (10c) earlier, for each rule store a mapping from fixed variables - to rule variables and the mask variables that in the rule variable - are instantiated by the fixed variables; - - (10d) to determine how to instantiate the fixed variables in the - "lead legal" term, find the (10b) substitutions of assigned - elements and (10c) mask variables for fixed variables; compose the - maps to get fixed variable to GDL ground term mapping, each - "route" should give the same term. - - Implementation TODO: once the LHS-RHS structures are removed from - the backbone and formula registration is removed, some - simplifications can be done in (9) and (10). - -*) - -let debug_level = ref 0 - -(** Include mask predicates (first part of (4c)) of negative state - term atoms as either positive or negated atoms. *) -type mask_anchors_of_neg = Positive_anch | Negative_anch | No_anch -let mask_anchors_of_neg = ref (* Positive_anch *) Negative_anch - -(** Approximate rule preconditions by dropping parts of "partition - guards" of (7l) -- parts of conditions introduced merely to - distinguish rules that should not be available at the same time. *) -type approximate_rule_preconds = - | Exact (** keep all conditions *) - | Connected (** keep all connected to - variables appearing in the - rest, i.e. containing - common gdl variables *) - | TightConnected (** keep connected but - ignoring equivalence - links, i.e. containing - common gdl state terms *) - | DropAll -let approximate_rule_preconds = ref (* Connected *) Exact - -(** Filter rule candidates by the stable part of precondition either - before or after game simplification. *) -type prune_rulecands = Before_simpl | After_simpl | Never -let prune_rulecands_at = ref (* Before_simpl *) Never - -(** Perhaps generate all tuples for equivalences, to faciliate further - transformations of formulas in the game definition (outside of - translation). *) -type pair_matrix = Pairs_all | Pairs_triang | Pairs_star -let equivalences_all_tuples = ref Pairs_triang -let equivalences_ordered = ref true - -(** Generate test case for the given game name. *) -let generate_test_case = ref None - -open Aux.BasicOperators - -type tossrule_data = { - lead_legal : GDL.term; - (* the "legal"/"does" term of the player that performs the move, we - call its parameters "fixed variables" as they are provided externally *) - precond : Formula.formula; - (* the LHS match condition (the LHS structure and the precondition) *) - rhs_add : (string * string array) list; - (* the elements of LHS/RHS structures, corresponding to the "next" - terms *) - struc_elems : string list; - fixvar_elemvars : - (string * (GDL.term * (string * string list) list) list) list; - (* "state" terms indexed by variables that they contain, together - with the mask-path of the variable *) - elemvars : GDL.term Aux.StrMap.t; -(* "state" terms indexed by Toss variable names they generate *) -} - -type gdl_translation = { - anchor_terms : - (GDL.term * (string * (GDL.term * string) list) list) list; - (* mask path (i.e. mask+var) and a ground term to anchor predicate *) - tossrule_data : tossrule_data Aux.StrMap.t; - (* rule name to rule translation data *) - t_elements : GDL.term Aux.IntMap.t; - (* element terms (with metavariables only) *) - playing_as : int; - (* "active" player *) - noop_actions : GDL.term option array; - (* NOOP actions of "active" player indexed by locations *) - fluents : string list; -} - -let empty_gdl_translation = - {anchor_terms = []; - tossrule_data = Aux.StrMap.empty; - t_elements = Aux.IntMap.empty; - playing_as = 0; - noop_actions = [||]; - fluents = []} - - -let fprint_gdl_transl_data ?(details=false) ppf gdl = - (* TODO: print more data if needed *) - Format.fprintf ppf - "GDL_DATA@,{@[<1>FLUENTS@ %a;@ PLAYING_AS@ %d;@ NOOPS@ %a;" - (Aux.fprint_sep_list "," Format.pp_print_string) gdl.fluents - gdl.playing_as - (Aux.fprint_sep_list "," Format.pp_print_string) - (Array.to_list (Array.mapi (fun i -> function - | None -> string_of_int i ^": None" - | Some noop-> string_of_int i ^": "^GDL.term_str noop) gdl.noop_actions)); - Aux.StrMap.iter (fun rname data -> - Format.fprintf ppf "@ @[<1>RULE@ %s:@ LEGAL=@,%s;@ PRECOND=@,%a;@ " - rname (GDL.term_str data.lead_legal) Formula.fprint data.precond; - Format.fprintf ppf "{@[<1>RHS ADD:@ "; - Aux.fprint_sep_list ";" Format.pp_print_string ppf - (List.map (fun (rel,args) -> rel^"("^String.concat ", " - (Array.to_list args)^")") data.rhs_add); - Format.fprintf ppf "@]}@]" - ) gdl.tossrule_data; - Format.fprintf ppf "@]}" - -let sprint_gdl_transl_data ?(details=false) gdl = - ignore (Format.flush_str_formatter ()); - Format.fprintf Format.str_formatter "@[%a@]" - (fprint_gdl_transl_data ~details) gdl; - Format.flush_str_formatter () - - -(* 3c2 *) -let abstract_consts fresh_count term = - let fresh_count = ref fresh_count in - let rec loop = function - | Const _ -> incr fresh_count; MVar ("MV"^string_of_int !fresh_count) - | Func (f,args) -> Func (f, List.map loop args) - | term -> term in - loop term - - -let game_description = ref [] -let player_terms = ref [| |] - -let state_of_file s = - let f = open_in s in - let res = - ArenaParser.parse_game_state Lexer.lex - (Lexing.from_channel f) in - res - -(* 6 *) - -(* Need a global access so that the support can be reset between - different translations. (Generalization uses a local [fresh_count] - state.) *) -let var_support = ref Aux.Strings.empty - -let freshen_branch (args, body, neg_body) = - let sb = ref [] in - let rec map_vnames = function - | Var x -> - if List.mem_assoc x !sb then Var (List.assoc x !sb) - else - let x1 = Aux.not_conflicting_name ~truncate:true !var_support x in - var_support := Aux.Strings.add x1 !var_support; - sb := (x,x1)::!sb; - Var x1 - | MVar x -> - if List.mem_assoc x !sb then MVar (List.assoc x !sb) - else - let x1 = Aux.not_conflicting_name ~truncate:true !var_support x in - var_support := Aux.Strings.add x1 !var_support; - sb := (x,x1)::!sb; - MVar x1 - | Const _ as t -> t - | Func (f, args) -> - Func (f, List.map map_vnames args) in - let map_rel (rel, args) = - rel, List.map map_vnames args in - let map_neg (vs, atoms) = - let vs = - List.map (fun x -> - if List.mem_assoc x !sb then List.assoc x !sb - else - let x1 = Aux.not_conflicting_name ~truncate:true !var_support x in - var_support := Aux.Strings.add x1 !var_support; - sb := (x,x1)::!sb; x1 - ) (Aux.Strings.elements vs) in - Aux.strings_of_list vs, - List.map map_rel atoms in - List.map map_vnames args, - List.map map_rel body, - List.map map_neg neg_body - -let freshen_def_branches brs = - List.map freshen_branch brs - -let extend_sb sb1 sb = Aux.map_prepend sb1 (fun (x,t)->x, subst sb1 t) sb - - -(* [args] are the actual, instatiated, arguments. *) -let negate_def uni_vs args neg_def = - let global_vars = terms_vars args in - let aux_br (params, body, neg_body) = - let sb = unify [] params args in - let body = subst_rels sb body in - let neg_body = List.map (fun (vs, conjs) -> - vs, subst_rels sb conjs) neg_body in - let subforms = (Aux.Strings.empty, body) :: neg_body in - (* components of [vars_i] by conjuncts *) - let sub_fvars = List.map (fun (_, subphi) -> - Aux.Strings.diff (rels_vars subphi) global_vars) subforms in - let subvars = List.map2 (fun fvs (qvs,_) -> - Aux.Strings.diff fvs qvs) sub_fvars subforms in - if List.exists (fun (vs1, vs2) -> - not (Aux.Strings.is_empty (Aux.Strings.inter vs1 vs2))) - (Aux.pairs subvars) - then failwith - ("GDL.negate_def: variables shared between negated subformulas" ^ - " -- long term TODO (params: "^terms_str params^")"); - (if List.exists (fun (fvs, (qvs,_)) -> - (* [fvs - qvs] must be a subset of the "vars_i" quantified vars *) - not (Aux.Strings.is_empty (Aux.Strings.diff fvs qvs))) - (List.tl (List.combine sub_fvars subforms)) - then - let (fvs,(qvs,_)) = List.find (fun (fvs, (qvs,_)) -> - not (Aux.Strings.is_empty (Aux.Strings.diff fvs qvs))) - (List.tl (List.combine sub_fvars subforms)) in - failwith - ("GDL.negate_def: universal quantification escapes negation" ^ - " -- doable TODO (params: "^terms_str params^") (vars: "^ - String.concat ", " (Aux.Strings.elements - (Aux.Strings.diff fvs qvs))^")")); - Aux.Right (List.hd sub_fvars, body) :: - List.map (fun (_,conjs) -> Aux.Left conjs) neg_body in - (* We drop branches whose heads don't match. *) - let cnf = Aux.map_try aux_br neg_def in - let dnf = Aux.product cnf in - List.map (fun conjs -> - let pos, neg = Aux.partition_choice conjs in - let pos = List.concat pos in - pos, neg - ) dnf - -(* assumption: [defs] bodies are already clean of defined relations *) -let subst_def_branch (defs : exp_def list) - (head, body, neg_body as br : lit_def_branch) : exp_def_branch list = - var_support := Aux.Strings.union !var_support - (lit_def_br_vars br); - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "Expanding branch %s\n%!" (lit_def_str ("BRANCH", [br])); - ); - (* }}} *) - (* 6a *) - let sols = - List.fold_left (fun sols (rel, args as atom) -> - (let try def = - freshen_def_branches (List.assoc rel defs) in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "Expanding positive %s by %s\n%!" rel - (exp_def_str (rel, def)) - ); - (* }}} *) - Aux.concat_map (fun (pos_sol, neg_sol, sb) -> - let args = List.map (subst sb) args in - Aux.map_some (fun (dparams, dbody, dneg_body) -> - try - let sb1 = unify [] dparams args in - Some ( - subst_rels sb1 (dbody @ pos_sol), - List.map (fun (vs,bs)->vs, subst_rels sb1 bs) - (dneg_body @ neg_sol), - extend_sb sb1 sb) - with Not_found -> None - ) def - ) sols - with Not_found -> - List.map (fun (pos_sol, neg_sol, sb) -> - subst_rel sb atom::pos_sol, neg_sol, sb) sols)) - ([[],[],[]]) body in - (* 6b *) - let neg_body_flat, neg_body_rec = - Aux.partition_map (fun (uni_vs, (neg_rel, neg_args) as neg_lit) -> - (let try def = - freshen_def_branches (List.assoc neg_rel defs) in - if not (List.exists (fun (_,_,negb) -> negb<>[]) def) - then Aux.Left (neg_lit, Some def) - else ( - (* {{{ log entry *) - if !debug_level > 3 then ( - let _,_,def_neg_body = - List.find (fun (_,_,negb) -> negb <> []) def in - Printf.printf - "expand: found recursive negative %s(%s): neg_body= not %s\n%!" - neg_rel (terms_str neg_args) - (String.concat " and not " - (List.map facts_str (List.map snd def_neg_body))) - ); - (* }}} *) - Aux.Right (neg_lit, def)) - with Not_found -> Aux.Left (neg_lit, None)) - ) neg_body in - (* checking if all negative bodies are just already satisfied - "distinct" atoms; we could refine the split per-solution, but it - isn't worth the effort *) - let more_neg_flat, neg_body_rec = - Aux.partition_map (fun (_, (_, args) as neg_lit, def as neg_case) -> - if List.for_all (function - | _,_,[] -> true - |_,_,neg_body -> - List.for_all (function - | _, ["distinct", _] -> true | _ -> false) neg_body - ) def - then - if List.for_all (function - | _,_,[] -> true - |params,_,neg_body -> - List.for_all (function - | _, ["distinct", terms] -> - List.for_all (fun (_,_,sb) -> - let args = List.map (subst sb) args in - let sb1 = unify [] params args in - let terms = List.map (subst sb1) terms in - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf - "Checking distinctness of %s after sb=%s; sb1=%s\n%!" - (terms_str terms) - (sb_str sb) (sb_str sb1) - ); - (* }}} *) - Aux.Strings.is_empty (terms_vars terms) - && List.length (Aux.unique_sorted terms) > 1 - ) sols - | _ -> false) neg_body) def - then - let def = List.map (fun (params, body, neg_body) -> - params, body, []) def in - Aux.Left (neg_lit, Some def) - else Aux.Right neg_case - else Aux.Right neg_case - ) neg_body_rec in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "Expanding (%s) negative part: flat %s; rec %s\n%!" - (terms_str head) - (String.concat ", "(List.map (fun ((_,(nr,_)),_) -> nr) neg_body_flat)) - (String.concat ", "(List.map (fun ((_,(nr,_)),_) -> nr) neg_body_rec)) - ); - (* }}} *) - (* 6b1 *) - let sols = - List.fold_left (fun sols ((uni_vs, (rel, args)), neg_def) -> - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "Expanding rec-negative %s by %s\n%!" rel - (exp_def_str (rel, neg_def)) - ); - (* }}} *) - (* we don't keep the substitution from the negated match *) - Aux.concat_map (fun (pos_sol, neg_sol, sb) -> - let args = List.map (subst sb) args in - let branches = negate_def uni_vs args neg_def in - List.map (fun (dbody, dneg_body) -> - dbody @ pos_sol, dneg_body @ neg_sol, sb) branches - ) sols) - sols neg_body_rec in - - (* 6b2 *) - let sols = - List.map (fun (pos_sol, neg_sol, sb) -> - let more_neg_sol = - Aux.concat_map (fun ((uni_vs, (rel, args as atom)), def_opt) -> - (* negated subformulas are duplicated instead of branches *) - match def_opt with - | Some def -> - let args = List.map (subst sb) args in - Aux.map_try (fun (dparams, dbody, _) -> - (let sb1 = unify [] dparams args in - let param_vars = terms_vars dparams in - let body_vars = rels_vars dbody in - let dbody = subst_rels sb1 dbody in - let local_vs = - Aux.Strings.diff body_vars - (Aux.Strings.diff param_vars uni_vs) in - local_vs, dbody) - ) def - | None -> (* rel not in defs *) - [uni_vs, [atom]] - ) (more_neg_flat @ neg_body_flat) in - List.rev pos_sol, List.rev_append neg_sol more_neg_sol, sb - ) sols in - let res = - Aux.map_some (fun (pos_sol, neg_sol, sb) -> - if List.exists (function _,[] -> true | _ -> false) neg_sol - then None - else Some (List.map (subst sb) head, pos_sol, neg_sol)) sols in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "Expansion: res =\n%s\nExpansion done.\n%!" - (String.concat "\n"(List.map (branch_str "exp-unkn") res)) - ); - (* }}} *) - res - -(* Stratify and expand all relations in the given set. *) -let expand_def_rules ?(more_defs=[]) rules = - let rec loop base = function - | [] -> base - | stratum::strata -> - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "expand_def_rules: step base rels = %s\n%!" - (String.concat ", " (List.map fst base)) - ); - (* }}} *) - let step = List.map (fun (rel, branches) -> - rel, Aux.concat_map - (subst_def_branch (more_defs@base)) branches) stratum in - (* {{{ log entry *) -if !debug_level > 3 then ( - Printf.printf "expand_def_rules: step result = %s\nexpand_def_rules: end step\n%!" - (String.concat "\n" (List.map exp_def_str step)) -); -(* }}} *) - loop (base @ step) strata in - match stratify ~def:true [] (lit_defs_of_rules rules) with - | [] -> [] - | [no_defined_rels] when more_defs=[] -> - exp_defs_of_lit_defs no_defined_rels - | def_base::def_strata when more_defs=[] -> - loop (exp_defs_of_lit_defs def_base) def_strata - | def_strata -> loop more_defs def_strata - -(* As [subst_def_branch], but specifically for "legal" definition and - result structured by "legal" definition branches. *) -(* 7b *) -let subst_legal_rule legal - (head, body, neg_body as br) - : (exp_def_branch * exp_def_branch) option = - var_support := Aux.Strings.union !var_support - (exp_def_br_vars br); - let legal = freshen_branch legal in - let legal_args, legal_body, legal_neg_body = legal in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "subst_legal_rule:\n%s\n%s\n%!" - (exp_def_str ("legal", [legal])) - (exp_def_str ("branch", [br])) - ); - (* }}} *) - if List.exists (fun (_,neg_conjs) -> - List.exists (fun (rel,_)->rel="does") neg_conjs) neg_body - then failwith - "GDL.translate_game: negated \"does\" conditions not implemented yet"; - try - let body, more_neg_body, sb = - List.fold_left (fun (body,more_neg_body,sb) (rel, args as atom) -> - if rel = "does" then - ("_DOES_PLACEHOLDER_", args) :: List.rev_append legal_body body, - List.rev_append legal_neg_body more_neg_body, - unify sb legal_args args - else atom::body, more_neg_body, sb) ([],[],[]) body in - let legal_res = - List.map (subst sb) legal_args, - subst_rels sb legal_body, - List.map (fun (uni_vs,neg_conjs) -> - (* local variables so cannot be touched *) - uni_vs, subst_rels sb neg_conjs) - legal_neg_body in - let br_res = - List.map (subst sb) head, - subst_rels sb (List.rev body), - List.map (fun (uni_vs, neg_conjs) -> - uni_vs, subst_rels sb neg_conjs) - (List.rev_append more_neg_body neg_body) in - (* {{{ log entry *) -if !debug_level > 3 then ( - Printf.printf "%s\n%s\n" - (exp_def_str ("legal-res", [legal_res])) - (exp_def_str ("br-res", [br_res])) -); -(* }}} *) - Some (legal_res, br_res) - with Not_found -> None - -let subst_legal_rules def_brs brs = - Aux.unique_sorted - (Aux.concat_map (fun br -> - List.map (fun (_,x) -> br, x) - (Aux.map_some (fun def -> subst_legal_rule def br) def_brs)) brs) - - -let rec blank_out = function - | Const a as c, Const b when a = b -> c - | (*Var _ as*) v, Var _ -> v - | t, MVar _ -> Const "_BLANK_" - | Func (f, f_args), Func (g, g_args) when f = g -> - Func (f, List.map blank_out (List.combine f_args g_args)) - | a, b -> - Printf.printf "blank_out mismatch: term %s, mask %s\n%!" - (term_str a) (term_str b); - assert false - - -let triang_matrix elems = - let rec aux acc = function - | [] -> acc - | hd::tl -> aux (List.map (fun e->[|hd; e|]) tl @ acc) tl in - aux [] elems - - -let term_to_blank masks next_arg = - let mask_cands = - Aux.map_try (fun mask -> - mask, match_meta [] [] [next_arg] [mask] - ) masks in - let mask, sb, m_sb = match mask_cands with - | [mask, (sb, m_sb)] -> mask, sb, m_sb - | _ -> - Printf.printf "GDL.term_to_blank: bad state term %s\n%!" - (term_str next_arg); - assert false in - mask, sb, m_sb, blank_out (next_arg, mask) - -let toss_var masks term = - let mask, _, _, blank = term_to_blank masks term in - mask, Formula.fo_var_of_string (String.lowercase (term_to_name blank)) - - -(* Expand branch variables. If [freshen_unfixed=Right fixed], expand - all variables that don't belong to [fixed] and appear in the head - of some branch. If [freshen_unfixed=Left freshen], then expand all - variables below meta-variables of masks. If [freshen] is true, - rename other (i.e. non-expanded) variables while duplicating - branches. (When [freshen] is false, all remaining variables should - be fixed.) - - With each branch, also return the instantiation used to derive it??? - - As in the expansion of relation definitions, branches are - duplicated for instantiations of positive literals, and - additionally of heads. For instantiations of atoms in negated - subformulas, the subformulas are duplicated within a branch, with - instantiations kept local to the subformula. Final substitution is - re-applied to catch up with later instantiations. *) -let expand_branch_vars masks playout_terms ~freshen_unfixed brs = - let head_vars = List.fold_left (fun acc -> function [head],_,_ -> - Aux.Strings.union acc (term_vars head) - | _ -> assert false) Aux.Strings.empty brs in - let use_fixed, fixed = - match freshen_unfixed with - | Aux.Left _ -> false, Aux.Strings.empty - | Aux.Right fixed -> true, fixed in -(* {{{ log entry *) -if !debug_level > 4 then ( - Printf.printf "expand_branch_vars: head_vars: %s; fixed vars: %s; before=\n%s\n%!" - (String.concat ","(Aux.Strings.elements head_vars)) - (String.concat ","(Aux.Strings.elements fixed)) - (exp_def_str ("before", brs)) -); -(* }}} *) - let expand sb arg = - let arg = subst sb arg in - let mask, _, m_sb, blank = term_to_blank masks arg in - let ivars = Aux.concat_map (fun (_,t) -> - Aux.Strings.elements (term_vars t)) m_sb in - let is_inst_var v = - (*if use_fixed - then - (Aux.Strings.mem v head_vars || List.mem v ivars) - && not (Aux.Strings.mem v fixed) - else*) List.mem v ivars in - Aux.unique_sorted - (Aux.map_try (fun term -> - let sb1, _ = match_meta [] [] [term] [arg] in - let sb1 = List.sort Pervasives.compare - (List.filter (fun (v,_)->is_inst_var v) sb1) in - extend_sb sb1 sb, subst sb1 arg - ) playout_terms) in - let expand_rel atom (sb, acc) = - match atom with - | "true", [arg] -> - List.map (fun (sb,arg) -> sb, ("true",[arg])::acc) (expand sb arg) - | rel, args -> [sb, (rel, List.map (subst sb) args)::acc] in - let expand_neg sb (vs, neg_conj) = - let neg_conjs = - Aux.concat_foldr expand_rel neg_conj [sb, []] in - List.map (fun (sb, neg_conj) -> - let vs = List.filter (fun v -> not (List.mem_assoc v sb)) - (Aux.Strings.elements vs) in - Aux.strings_of_list vs, neg_conj - ) neg_conjs in - let brs = - Aux.concat_map (function ([head],body,neg_body) -> - Aux.concat_map (fun (sb,head) -> - let bodies = Aux.concat_foldr expand_rel body [sb, []] in - Aux.map_some (fun (sb, body) -> - let head = subst sb head in - let body = List.map (subst_rel sb) body in - let neg_body = - Aux.concat_map (expand_neg sb) neg_body in - if List.exists (function _, [] -> true | _ -> false) - neg_body then None - (* need to pack head into a list for [freshen_branch] *) - else Some (sb, ([head], body, neg_body))) bodies) - (if head = Const "_IGNORE_RHS_" then [[], head] - else expand [] head) - | _ -> assert false) brs in - (* {{{ log entry *) -if !debug_level > 4 then ( - Printf.printf "expand_branch_vars: substitutions=\n%s\n%!" - (String.concat ";; " (List.map (sb_str -| fst) brs)) -); -(* }}} *) - match freshen_unfixed with - | Aux.Left true -> - List.map (fun (sb, br) -> sb, freshen_branch br) brs - | _ -> brs - -(* (7l5)-related exception. *) -exception Failed_branch - -let translate_branches ?(conjunctive=false) struc masks playout_terms - static_rnames dyn_rels - (brs : exp_def_branch list) = - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "Translating-branches:\n%s\n%!" - (exp_def_str ("translating", brs)); - ); - (* }}} *) - (* 7i *) - (* the state terms are positive, the relation can be positive or - negative -- negate atoms after generation if the atom was negative *) - let pos_conjs_4a pos_state_subterms (rel, args) = - let ptups = List.map (fun arg -> - Aux.assoc_all arg pos_state_subterms) args in - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "pos_conjs_4a: of %s = subterms %s\n%!" - (fact_str (rel,args)) (String.concat "; " ( - List.map (fun l -> String.concat ", " - (List.map (fun (_,_,term)->term_str term) l)) ptups)) - ); - (* }}} *) - let ptups = Aux.product ptups in - let res = - List.map (fun ptup -> - let rname = rel ^ "__" ^ String.concat "__" - (List.map (fun (mask,v,_)-> - term_to_name mask ^ "_" ^ v) ptup) in - let tup = List.map (fun (_,_,term) -> - snd (toss_var masks term)) ptup in - Formula.Rel (rname, Array.of_list tup)) ptups in - let res = Aux.unique_sorted res in - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "pos_conjs_4a: of %s = %s\n%!" - (fact_str (rel,args)) (Formula.str (Formula.And res)) - ); - (* }}} *) - res in - (* some of the state terms are always negative, the relation can be - positive or negative but always negate resulting atoms *) - let neg_conjs_4a pos_state_subterms - neg_state_terms neg_state_subterms (rel, args) = - let ptups = List.map (fun arg -> - Aux.assoc_all arg pos_state_subterms @ - Aux.assoc_all arg neg_state_subterms) args in - let ptups = Aux.product ptups in - let ptups = List.filter (fun tup -> - List.exists (fun (_,_,term) -> Terms.mem term neg_state_terms) tup) - ptups in - let res = - List.map (fun ptup -> - let rname = rel ^ "__" ^ String.concat "__" - (List.map (fun (mask,v,_)-> - term_to_name mask ^ "_" ^ v) ptup) in - let tup = List.map (fun (_,_,term) -> - snd (toss_var masks term)) ptup in - Formula.Rel (rname, Array.of_list tup)) ptups in - let res = Aux.unique_sorted res in - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "neg_conjs_4a: of %s = %s\n%!" - (fact_str (rel,args)) (Formula.str (Formula.And res)) - ); - (* }}} *) - res in - (* 7i-4b *) - (* FIXME: abandon filtering-out rendundant mask variables during - translation -- this is the job of GameSimplify! *) - let constrained_vars = ref [] in - let pos_conjs_4b pos_path_subterms = - Aux.unique_sorted (Aux.concat_map (fun ((mask, v), terms) -> - let rname = "EQ___" ^ term_to_name mask ^ "_" ^ v in - let terms = Aux.collect terms in - Aux.concat_map (fun (_,terms) -> - let vars = Aux.unique_sorted - (List.map (fun t -> snd (toss_var masks t)) terms) in - constrained_vars := vars @ !constrained_vars; - let tups = - match !equivalences_all_tuples with - | Pairs_all -> - Aux.concat_map (fun v -> Aux.map_some (fun w -> - if v=w then None else Some [|v; w|]) vars) vars - | Pairs_triang -> - (* generating more relations to faciliate "contraction" of - co-occurring relations in GameSimpl -- since it - GameSimpl handles inversion, no need for bidirectional - links *) - triang_matrix vars - | Pairs_star -> - (* (4b) are equivalences, so we just build a "star" *) - match vars with [] -> [] - | v::vs -> List.map (fun w -> [|v; w|]) vs in - if !equivalences_ordered then - List.iter (Array.sort Pervasives.compare) tups; - List.map (fun tup -> Formula.Rel (rname, tup)) tups - ) terms - ) pos_path_subterms) in - let neg_conjs_4b pos_path_subterms nterm = - let nmask, nsb, _, _ = term_to_blank masks nterm in - let _,ntossvar = toss_var masks nterm in - Aux.concat_map (fun ((mask, v), terms) -> - if mask <> nmask then [] - else - let nval = - try List.assoc v nsb with Not_found -> assert false in - match nval with - | Var nval -> - let rname = "EQ___" ^ term_to_name mask ^ "_" ^ v in - let terms = - Aux.assoc_all nval terms in - let tossvars = Aux.unique_sorted - (List.map (fun t -> snd (toss_var masks t)) terms) in - (* these don't get constrained since they'll occur negatively *) - let tups = - match !equivalences_all_tuples with - | Pairs_all -> - Aux.concat_map - (fun v -> - if v = ntossvar then [] - else [[|v; ntossvar|]; [|ntossvar; v|]]) tossvars - | Pairs_triang | Pairs_star -> - Aux.map_some (fun v -> - if v = ntossvar then None - else Some [|v; ntossvar|]) tossvars in - if !equivalences_ordered then - List.iter (Array.sort Pervasives.compare) tups; - List.map (fun tup -> Formula.Rel (rname, tup)) tups - | _ -> [] - ) pos_path_subterms in - (* calculate state terms twice: before and after filtering branches *) - let pos_state_terms = - List.fold_left (fun acc -> function - | [next_arg], body, _ -> - let res = - List.fold_left (fun acc -> function - | "true", [true_arg] -> Terms.add true_arg acc - | "true", _ -> assert false - | _ -> acc) acc body in - if next_arg = Const "_IGNORE_RHS_" - then res - else Terms.add next_arg res - | _ -> assert false - ) Terms.empty brs in - let pos_state_terms = Terms.elements pos_state_terms in - (* {{{ log entry *) - if !debug_level > 4 then ( - Printf.printf "pos_state_terms: %s\n%!" - (String.concat ", " (List.map term_str pos_state_terms)) - ); - (* }}} *) - let pos_state_subterms = - Aux.concat_map (fun term -> - let mask, sb, m_sb, blanked = term_to_blank masks term in - List.map (fun (v,t) -> t, (mask, v, term)) sb - ) pos_state_terms in - let pos_path_subterms = - Aux.concat_map (fun term -> - let mask, sb, m_sb, blanked = term_to_blank masks term in - Aux.map_some (function - | v, Var t -> - Some ((mask, v), (t, term)) - | _ -> None) sb - ) pos_state_terms in - let pos_path_subterms = Aux.collect pos_path_subterms in - (* only compute the static part to filter-out inconsistent branches *) - let pconjs_4b = pos_conjs_4b pos_path_subterms in - let brs = Aux.map_some (function - | [next_arg],body,neg_body as br -> - let phi = - if next_arg = Const "_IGNORE_RHS_" then [] - else - let mask, sb, m_sb, blanked = term_to_blank masks next_arg in - let rname = term_to_name mask in - let _, svar = toss_var masks next_arg in - (* if List.mem svar !constrained_... [truncated message content] |
From: <luk...@us...> - 2011-08-03 14:57:54
|
Revision: 1523 http://toss.svn.sourceforge.net/toss/?rev=1523&view=rev Author: lukstafi Date: 2011-08-03 14:57:48 +0000 (Wed, 03 Aug 2011) Log Message: ----------- GDL translation bugfixing started: [rules_of_clause] disjunction distribution fix; (both aggregate and) random playouts; GDL tests. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGame.mli trunk/Toss/GGP/TranslateGameTest.ml Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/GDL.ml 2011-08-03 14:57:48 UTC (rev 1523) @@ -10,8 +10,8 @@ open Aux.BasicOperators let debug_level = ref 0 -let aggregate_drop_negative = ref false -let aggregate_fixpoint = ref true +let aggregate_drop_negative = ref true +let playout_fixpoint = ref true type term = | Const of string @@ -104,14 +104,14 @@ | "does", [|arg1; arg2|] -> Does (arg1, arg2) | rel, args -> Rel (rel, args) -let rec body_of_literal = function +let rec bodies_of_literal = function | Pos (Distinct args) -> [Aux.Right ("distinct", args)] (* not negated actually! *) | Neg (Distinct _) -> assert false | Pos atom -> [Aux.Left (rel_of_atom atom)] | Neg atom -> [Aux.Right (rel_of_atom atom)] | Disj disjs -> - Aux.concat_map body_of_literal disjs + Aux.concat_map bodies_of_literal disjs let func_graph f terms = Aux.map_some (function Func (g, args) when f=g -> Some args | _-> None) terms @@ -135,13 +135,17 @@ (Aux.concat_map (fun (hd,body,neg_body) -> ("",hd)::body @ neg_body) (Aux.concat_map snd defs)) -let rule_of_clause (head, body) = - let body, neg_body = - Aux.partition_choice (Aux.concat_map body_of_literal body) in - head, body, neg_body +let rules_of_clause (head, body) = + let bodies = Aux.product + (List.map bodies_of_literal body) in + let bodies = List.map Aux.partition_choice bodies in + List.map (fun (body, neg_body) -> head, body, neg_body) + bodies -let clause_vars cl = gdl_rule_vars (rule_of_clause cl) +let clause_vars cl = + List.fold_left Aux.Strings.union Aux.Strings.empty + (List.map gdl_rule_vars (rules_of_clause cl)) let defs_of_rules rules = Aux.map_reduce (fun ((rel, args), body, neg_body) -> @@ -465,7 +469,7 @@ let negate_bodies conjs = let placeholder = "", [] in let clauses = List.map (fun body -> placeholder, body) conjs in - let clauses = List.map rule_of_clause clauses in + let clauses = Aux.concat_map rules_of_clause clauses in let clauses = List.map (fun (_,body,neg_body) -> List.map (fun a -> Pos (atom_of_rel a)) body @ List.map (fun a -> Neg (atom_of_rel a)) neg_body) clauses in @@ -525,24 +529,32 @@ (* ************************************************************ *) (** {3 GDL whole-game operations.} - Aggregate playout, player-denoting variable elimination. *) + Aggregate and random playouts, player-denoting variable elimination. *) -(* Collect the aggregate playout, but also the actions available in - the state. *) +(* Collect the playout, but also the actions available in the + state. *) exception Playout_over -let aggregate_ply players static current rules = +(* [~aggregate:true] performs an aggregate ply, [~aggregate:false] + performs a random ply. *) +let ply ~aggregate players static current rules = let base = Aux.map_prepend static (fun term -> "true", [|term|]) current in let base = saturate (base @ static) rules in (* {{{ log entry *) if !debug_level > 4 then ( - Printf.printf "GDL.aggregate_ply: updated base -- %s\n%!" + Printf.printf "GDL.ply: updated base -- %s\n%!" (rel_atoms_str base) ); (* }}} *) let does = Aux.map_some (fun (rel, args) -> if rel = "legal" then Some ("does", args) else None) base in + let does = + if aggregate then does + else + List.map (Aux.random_elem -| snd) + (Aux.collect (List.map (fun (_,args as atom) -> + args.(0), atom) does)) in if (* no move *) Aux.array_existsi (fun _ player -> List.for_all (function @@ -558,7 +570,7 @@ | _ -> true) does) players in Printf.printf - "GDL.aggregate_ply: playout over due to no move for %s\n%!" + "GDL.ply: playout over due to no move for %s\n%!" (String.concat ", " (List.map term_str players_nomove)) ); (* }}} *) @@ -567,7 +579,7 @@ let step = saturate (does @ base) rules in let step = Aux.map_some (function ("next", [|arg|]) -> Some arg | _ -> None) step in - if !aggregate_fixpoint && (* fixpoint reached *) + if !playout_fixpoint && (* fixpoint reached *) List.for_all (function | Func (_,[|arg|]) when Aux.array_existsi (fun _ player -> arg=player) players -> true @@ -576,17 +588,26 @@ then ( (* {{{ log entry *) if !debug_level > 0 then ( - Printf.printf "GDL.aggregate_ply: playout over due to fixpoint\n%!"; + Printf.printf "GDL.ply: playout over due to fixpoint\n%!"; ); (* }}} *) raise Playout_over) else List.map snd does, step -(* Besides the aggregate playout, also return the separation of rules +(* Besides the playout, also return the separation of rules into static and dynamic. Note that the list of playout states is - one longer than that of playout actions. *) -let aggregate_playout players horizon rules = + one longer than that of playout actions. + + When [aggregate_drop_negative] is true, to keep monotonicity, + besides removing negative literals from "legal" clauses, we also + add old terms to the state. (Only when [~aggregate:true].) + + [~aggregate:true] performs an aggregate ply, [~aggregate:false] + performs a random ply. Aggregate playouts are "deprecated", + especially for uses other than generating all possible state + terms. *) +let playout ~aggregate players horizon rules = (* separate and precompute the static part *) let rec separate static_rels state_rels = let static, more_state = @@ -607,24 +628,28 @@ List.map (function | ("legal", [|player; _|] as head), body, neg_body -> head, ("role", [|player|])::body, - if !aggregate_drop_negative then [] else neg_body + if aggregate && !aggregate_drop_negative + then [] else neg_body | ("does", _ (* as head *)), body, _ -> assert false (* head, body, [] *) | rule -> rule) dynamic_rules in let rec loop actions_accu state_accu step state = (* {{{ log entry *) if !debug_level > 0 then ( - Printf.printf "aggregate_playout: step %d...\n%!" step + Printf.printf "playout: step %d...\n%!" step ); (* }}} *) (let try actions, next = - aggregate_ply players static_base state state_rules in + ply ~aggregate players static_base state state_rules in (* {{{ log entry *) if !debug_level > 0 then ( - Printf.printf "aggregate_playout: state %s\n%!" + Printf.printf "playout: state %s\n%!" (String.concat " " (List.map term_str next)) ); (* }}} *) + let next = + if aggregate && !aggregate_drop_negative then state @ next + else next in if step < horizon then loop (actions::actions_accu) (state::state_accu) (step+1) next else @@ -639,7 +664,7 @@ | _ -> None) init_base in (* {{{ log entry *) if !debug_level > 0 then ( - Printf.printf "aggregate_playout: init %s\n%!" + Printf.printf "playout: init %s\n%!" (String.concat " " (List.map term_str init_state)) ); (* }}} *) @@ -647,6 +672,7 @@ loop [] [] 0 init_state + let find_cycle cands = (* {{{ log entry *) if !debug_level > 0 then ( Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/GDL.mli 2011-08-03 14:57:48 UTC (rev 1523) @@ -3,7 +3,7 @@ val debug_level : int ref val aggregate_drop_negative : bool ref -val aggregate_fixpoint : bool ref +val playout_fixpoint : bool ref (** {3 Datalog programs: Type definitions and saturation.} *) @@ -54,7 +54,7 @@ val clause_vars : clause -> Aux.Strings.t val defs_of_rules : gdl_rule list -> gdl_defs -val rule_of_clause : clause -> gdl_rule +val rules_of_clause : clause -> gdl_rule list val nnf_dnf : literal list -> literal list list @@ -70,6 +70,10 @@ val subst_literals : substitution -> literal list -> literal list val subst_clause : substitution -> clause -> clause +(** Saturation currently exposed for testing purposes. *) +val saturate : + rel_atom list -> gdl_rule list -> rel_atom list + (** {3 Transformations of GDL clauses: inlining, negation.} *) (** Expand branches of a definition inlining the provided definitions, @@ -99,9 +103,11 @@ val state_terms : literal list -> term list val term_arities : term -> (string * int) list +val rel_atom_str : rel_atom -> string + (** {3 GDL whole-game operations.} - Aggregate playout, player-denoting variable elimination. *) + Aggregate and random playout, player-denoting variable elimination. *) (** Partition relations into stable (not depending, even indirectly, on "true") and remaining ones. *) @@ -110,9 +116,18 @@ (** Besides the aggregate playout, also return the separation of rules into static and dynamic. Note that the list of playout states is - one longer than that of playout actions. *) -val aggregate_playout : - term array -> int -> gdl_rule list -> + one longer than that of playout actions. + + When [aggregate_drop_negative] is true, to keep monotonicity, + besides removing negative literals from "legal" clauses, we also + add old terms to the state. (Only when [~aggregate:true].) + + [~aggregate:true] performs an aggregate ply, [~aggregate:false] + performs a random ply. Aggregate playouts are "deprecated", + especially for uses other than generating all possible state + terms. *) +val playout : + aggregate:bool -> term array -> int -> gdl_rule list -> gdl_rule list * gdl_rule list * rel_atom list * term list * (term array list list * term list list) Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/GDLTest.ml 2011-08-03 14:57:48 UTC (rev 1523) @@ -46,7 +46,7 @@ let tests = "GDL" >::: [ -(* "saturate" >:: + "saturate" >:: (fun () -> let descr = parse_game_descr " @@ -58,11 +58,11 @@ (theta scisors) (gamma scisors)" in (* GDL.debug_level := 3; *) let res = GDL.saturate [] - (Aux.concat_map GDL.rules_of_entry descr) in + (Aux.concat_map GDL.rules_of_clause descr) in assert_equal ~printer:(fun x->x) ~msg:"simple stratified" "(alpha paper) (alpha rock) (beta paper) (beta rock) (beta scisors) (gamma paper) (gamma scisors) (theta scisors) (zeta rock)" (String.concat " " - (List.map GDL.fact_str res)); + (List.map GDL.rel_atom_str res)); let descr = parse_game_descr " @@ -70,11 +70,11 @@ (a 1) (a 2) (a 3)" in (* GDL.debug_level := 3; *) let res = GDL.saturate [] - (Aux.concat_map GDL.rules_of_entry descr) in + (Aux.concat_map GDL.rules_of_clause descr) in assert_equal ~printer:(fun x->x) ~msg:"simple distinct" "(a 1) (a 2) (a 3) (two-of-three 1 2) (two-of-three 1 3) (two-of-three 2 1) (two-of-three 2 3) (two-of-three 3 1) (two-of-three 3 2)" (String.concat " " - (List.map GDL.fact_str res)); + (List.map GDL.rel_atom_str res)); ); "saturate recursive" >:: @@ -97,12 +97,65 @@ " in (* GDL.debug_level := 3; *) let res = GDL.saturate [] - (Aux.concat_map GDL.rules_of_entry descr) in + (Aux.concat_map GDL.rules_of_clause descr) in assert_equal ~printer:(fun x->x) ~msg:"simple stratified" "(lte 0 0) (lte 0 1) (lte 0 2) (lte 0 3) (lte 0 4) (lte 0 5) (lte 0 6) (lte 0 7) (lte 0 8) (lte 1 1) (lte 1 2) (lte 1 3) (lte 1 4) (lte 1 5) (lte 1 6) (lte 1 7) (lte 1 8) (lte 2 2) (lte 2 3) (lte 2 4) (lte 2 5) (lte 2 6) (lte 2 7) (lte 2 8) (lte 3 3) (lte 3 4) (lte 3 5) (lte 3 6) (lte 3 7) (lte 3 8) (lte 4 4) (lte 4 5) (lte 4 6) (lte 4 7) (lte 4 8) (lte 5 5) (lte 5 6) (lte 5 7) (lte 5 8) (lte 6 6) (lte 6 7) (lte 6 8) (lte 7 7) (lte 7 8) (lte 8 8) (number 0) (number 1) (number 2) (number 3) (number 4) (number 5) (number 6) (number 7) (number 8) (succ 0 1) (succ 1 2) (succ 2 3) (succ 3 4) (succ 4 5) (succ 5 6) (succ 6 7) (succ 7 8)" (String.concat " " - (List.map GDL.fact_str res)); - ); *) + (List.map GDL.rel_atom_str res)); + ); + + "playout" >:: + (fun () -> + let descr = parse_game_descr + " +(role x) +(role o) +(init (cell a a b)) +(init (cell b a b)) +(init (control x)) +(<= (next (control ?r)) + (does ?r noop)) +(<= (next (cell ?x ?y ?r)) + (does ?r (mark ?x ?y))) +(<= (next (cell ?x ?y ?c)) + (true (cell ?x ?y ?c)) + (does ?r (mark ?x1 ?y1)) + (or (distinct ?x ?x1) + (distinct ?y ?y1))) +(<= (legal ?r (mark ?x ?y)) + (true (control ?r)) + (true (cell ?x ?y b)) + ) +(<= (legal ?r noop) + (role ?r) + (not (true (control ?r)))) +" in + + let _, _, _, _, (agg_actions, _) = + GDL.playout ~aggregate:true [|GDL.Const "x"; GDL.Const "o"|] + 10 (Aux.concat_map GDL.rules_of_clause descr) in + let actions = List.map (List.map (fun a->"does", a)) agg_actions in + assert_equal ~printer:(fun x->x) ~msg:"aggregate" + "(does o noop) (does x noop) (does x (mark a a)) (does x (mark b a)); +(does o noop) (does o (mark a a)) (does o (mark b a)) (does x noop) (does x (mark a a)) (does x (mark b a))" + (String.concat ";\n" (List.map (fun step -> String.concat " " + (List.map GDL.rel_atom_str step)) actions)); + + let _, _, _, _, (rand_actions, _) = + GDL.playout ~aggregate:false [|GDL.Const "x"; GDL.Const "o"|] + 10 (Aux.concat_map GDL.rules_of_clause descr) in + let actions = List.map (List.map (fun a->"does", a)) rand_actions in + let res = + String.concat ";\n" (List.map (fun step -> String.concat " " + (List.map GDL.rel_atom_str step)) actions) in + assert_bool ( + "random (see expected result in the test source): got " ^ res) + (List.mem res ["(does o noop) (does x (mark b a)); +(does o (mark a a)) (does x noop)"; +"(does o noop) (does x (mark a a)); +(does o (mark b a)) (does x noop)"]) + ); + ] let exec = Aux.run_test_if_target "GDLTest" tests Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-03 14:57:48 UTC (rev 1523) @@ -5,6 +5,9 @@ open GDL open TranslateFormula +(** Local level of logging. *) +let debug_level = ref 0 + (** Translate stable relations that otherwise would be translated as structure relations, but have arity above the threshold, as defined relations. *) @@ -119,7 +122,7 @@ (as in definition of $\calP_f$). *) let fluent_paths_and_frames clauses = let defs = - defs_of_rules (List.map rule_of_clause clauses) in + defs_of_rules (Aux.concat_map rules_of_clause clauses) in let stable, nonstable = stable_rels defs in let inline_defs = List.filter (fun (rel,_) -> List.mem rel nonstable) defs in @@ -134,7 +137,7 @@ List.map (fun c -> (* it should actually be a single element association *) let brs_c = - List.assoc "next" (defs_of_rules [rule_of_clause c]) in + List.assoc "next" (defs_of_rules (rules_of_clause c)) in c, expand_positive_lits inline_defs brs_c) next_clauses in let find_br_fluents s_C (_,body,neg_body) = let true_args body = List.map @@ -182,10 +185,10 @@ | _ -> None ) clauses in let players = Array.of_list players in - let rules = List.map rule_of_clause clauses in + let rules = Aux.concat_map rules_of_clause clauses in let stable_rel_defs, nonstable_rel_defs, stable_base, init_state, (agg_actions, agg_states) = - aggregate_playout players !agg_playout_horizon rules in + playout ~aggregate:true players !agg_playout_horizon rules in let stable_rels = Aux.unique_sorted (List.map (fun ((rel,_),_,_)->rel) stable_rel_defs) in let nonstable_rels = Aux.unique_sorted Modified: trunk/Toss/GGP/TranslateGame.mli =================================================================== --- trunk/Toss/GGP/TranslateGame.mli 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/TranslateGame.mli 2011-08-03 14:57:48 UTC (rev 1523) @@ -1,3 +1,5 @@ +(** Local level of logging. *) +val debug_level : int ref type tossrule_data = { legal_tuple : GDL.term array; Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-07-31 22:11:24 UTC (rev 1522) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-03 14:57:48 UTC (rev 1523) @@ -95,27 +95,6 @@ let tests = "TranslateGame" >::: [ - (* - "expand_def_rules" >:: - (fun () -> - let descr = parse_game_descr - " -(<= (alpha ?X) (beta ?X) (not (theta ?X))) -(<= (zeta ?X) (beta ?X) (not (gamma ?X))) -(<= (beta ?X) (rho ?X)) -(<= (theta ?X) (gamma ?X) (rho ?X))" in - (* GDL.debug_level := 3; *) - let res = Translate.expand_def_rules - (Aux.concat_map GDL.rules_of_entry descr) in - assert_equal ~printer:(fun x->x) ~msg:"simple stratified" - "((beta ?X) <= (rho ?X) ) -((theta ?X) <= (gamma ?X) (rho ?X) ) -((alpha ?X) <= (rho ?X) (not (and (gamma ?X) (rho ?X)))) -((zeta ?X) <= (rho ?X) (not (and (gamma ?X))))" - (String.concat "\n" - (List.map GDL.exp_def_str res)); - ); - "tictactoe" >:: (fun () -> game_test_case ~game_name:"tictactoe" ~player:"xplayer" @@ -130,7 +109,7 @@ "cell_x71_y26__blank_", "cell_1_1_MV1"; "control__blank_", "control_MV1"] ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)" - ); *) + ); ] let bigtests = "TranslateGameBig" >::: [ @@ -191,20 +170,29 @@ ); ] - -let a = - Aux.run_test_if_target "TranslateGameTest" tests - -let a = - Aux.run_test_if_target "TranslateGameTest" bigtests - let a () = - GDL.debug_level := 4; - (* GameSimpl.debug_level := 4; *) + (* GDL.debug_level := 5; *) + TranslateGame.debug_level := 4; + GameSimpl.debug_level := 4; (* DiscreteRule.debug_level := 4; *) () let a () = + game_test_case ~game_name:"connect5" ~player:"x" + ~own_plnum:0 ~opponent_plnum:1 + ~loc0_rule_name:"mark_x161_y162_0" + ~loc0_emb:[ + "cell_x161_y162__blank_", "cell_e_f_MV1"; + "control__blank_", "control_MV1"] + ~loc0_move:"(mark e f)" ~loc0_noop:"noop" + ~loc1:1 ~loc1_rule_name:"mark_x175_y176_1" + ~loc1_emb:[ + "cell_x175_y176__blank_", "cell_f_g_MV1"; + "control__blank_", "control_MV1"] + ~loc1_noop:"noop" ~loc1_move:"(mark f g)" + + +let a () = match test_filter [(* "GDLBig:1:breakthrough" *) "GDLBig:0:connect5"] bigtests This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-05 12:10:01
|
Revision: 1526 http://toss.svn.sourceforge.net/toss/?rev=1526&view=rev Author: lukstafi Date: 2011-08-05 12:09:48 +0000 (Fri, 05 Aug 2011) Log Message: ----------- GDL translation fixing: fluent paths bug, initial structure generation test. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGame.mli trunk/Toss/GGP/TranslateGameTest.ml Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-08-04 16:40:12 UTC (rev 1525) +++ trunk/Toss/GGP/GDL.ml 2011-08-05 12:09:48 UTC (rev 1526) @@ -436,12 +436,11 @@ used_vars := Aux.add_strings (List.map snd sb) !used_vars; let sb = List.map (fun (v,t) -> v, Var t) sb in List.map (subst_br sb) brs in - (* FIXME: make sure it's OK!!! *) let expand_atom (rel, args as atom) (sb, (head, r_body, r_neg_body)) = (let try def_brs = freshen_brs (List.assoc rel defs) in let args = Array.map (subst sb) args in - List.map (fun (params,d_body,d_neg_body) -> + Aux.map_try (fun (params,d_body,d_neg_body) -> let sb = unify sb (Array.to_list params) (Array.to_list args) in let r_br = head, d_body @ r_body, d_neg_body @ r_neg_body in @@ -733,21 +732,21 @@ List.map (fun sb -> subst_clause sb clause) sbs in Aux.concat_map exp_clause clauses -(** Partition relations into stable (not depending, even indirectly, +(** Partition relations into static (not depending, even indirectly, on "true") and remaining ones. *) -let stable_rels defs = - let rec aux nonstable remaining = +let static_rels defs = + let rec aux nonstatic remaining = let more = Aux.map_some (fun (rel, branches) -> if List.exists (fun (_, body, neg_body) -> let called = List.map fst (body @ neg_body) in List.exists (fun rel -> rel = "true" || - List.mem rel nonstable) called + List.mem rel nonstatic) called ) branches then Some rel else None ) remaining in - if more = [] then List.map fst remaining, nonstable - else aux (more @ nonstable) + if more = [] then List.map fst remaining, nonstatic + else aux (more @ nonstatic) (List.filter (fun (rel,_) -> not (List.mem rel more)) remaining) in aux [] defs Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-08-04 16:40:12 UTC (rev 1525) +++ trunk/Toss/GGP/GDL.mli 2011-08-05 12:09:48 UTC (rev 1526) @@ -110,9 +110,9 @@ Aggregate and random playout, player-denoting variable elimination. *) -(** Partition relations into stable (not depending, even indirectly, +(** Partition relations into static (not depending, even indirectly, on "true") and remaining ones. *) -val stable_rels : gdl_defs -> string list * string list +val static_rels : gdl_defs -> string list * string list (** Besides the aggregate playout, also return the separation of rules @@ -178,3 +178,5 @@ (** List the paths in a set. *) val paths_to_list : path_set -> path list + +val path_str : path -> string Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-08-04 16:40:12 UTC (rev 1525) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-05 12:09:48 UTC (rev 1526) @@ -1,5 +1,21 @@ (** {2 Translating GDL definition: Toss rules and initial structure.} + Some terminology -- try to comply. + + static relation: GDL relation not even indirectly depending on + "true" nor "does" + + dynamic relation: GDL relation depending on "true" (a relation + that is not static) + + stable relation: a Toss structure relation that is not changed by + any rewrite + + fluent relation: a Toss structure relation that is changed by + rewriting + + defined relation: a Toss defined relation (i.e. does not normally + occur in the structure) *) open GDL @@ -8,7 +24,7 @@ (** Local level of logging. *) let debug_level = ref 0 -(** Translate stable relations that otherwise would be translated as +(** Translate static relations that otherwise would be translated as structure relations, but have arity above the threshold, as defined relations. *) let defined_arity_above = ref 2 @@ -101,6 +117,7 @@ not (siz1 > siz2) && pn2 >= pn1 in let best = Aux.maximal cmp gens in (* avoid "frame wave" if possible *) + (* FIXME: TODO: handle frame waves as in updated reference spec *) let t, (ps, _, _) = if !nonerasing_frame_wave then @@ -123,9 +140,18 @@ let fluent_paths_and_frames clauses = let defs = defs_of_rules (Aux.concat_map rules_of_clause clauses) in - let stable, nonstable = stable_rels defs in + let static, nonstatic = static_rels defs in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "fluent_paths_and_frames: static=%s; nonstatic=%s\n%!" + (String.concat ", " static) (String.concat ", " nonstatic) + ); + (* }}} *) let inline_defs = - List.filter (fun (rel,_) -> List.mem rel nonstable) defs in + List.filter (fun (rel,_) -> List.mem rel nonstatic) defs in + let inline_defs = + ("does", List.assoc "legal" defs)::inline_defs in (* To determine whether a clause is a frame, we need to know its expansion, so we expand clauses separately. A proper frame clause must have *all* expansions being proper frame clauses. But a @@ -133,12 +159,30 @@ regarded as "frame wave". *) let next_clauses = List.filter (fun ((rel,_),_) -> rel="next") clauses in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "fluent_paths_and_frames: initial next_clauses=\n%s\n\n" + (String.concat "\n" + (List.map GDL.def_str + (GDL.defs_of_rules + (Aux.concat_map GDL.rules_of_clause next_clauses)))) + ); + (* }}} *) let next_e = List.map (fun c -> (* it should actually be a single element association *) let brs_c = List.assoc "next" (defs_of_rules (rules_of_clause c)) in c, expand_positive_lits inline_defs brs_c) next_clauses in + (* {{{ log entry *) + if !debug_level > 2 then ( + let next_exp = Aux.concat_map snd next_e in + Printf.printf + "fluent_paths_and_frames: expanded next_e=\n%s\n\n" + (GDL.def_str ("next", next_exp)) + ); + (* }}} *) let find_br_fluents s_C (_,body,neg_body) = let true_args body = List.map (function [|t|] -> t | _ -> assert false) @@ -147,12 +191,22 @@ let n_ts = true_args neg_body in let t_C, ps = most_similar s_C (p_ts @ n_ts) in (* "negative true" check *) - t_C, ps, List.mem t_C p_ts in + t_C, ps, List.mem t_C n_ts in let is_frame s_C (t_C, _, neg_true) = not neg_true && s_C = t_C in let find_fluents (c, c_e) = let s_C = (snd (fst c)).(0) in - let res = List.map (find_br_fluents s_C) c_e in + (* discarding frame waves *) + (* FIXME: TODO: handle frame waves as in updated reference spec *) + let res = Aux.map_try (find_br_fluents s_C) c_e in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf + "find_fluents: most_similar for s_C=%s expansions t_C=%s\n" + (term_str s_C) (String.concat ", " + (List.map (fun (t,_,_)->term_str t) res)) + ); + (* }}} *) if List.for_all (is_frame s_C) res then Aux.Left c else @@ -163,7 +217,7 @@ term_paths (function Const _ -> true | _ -> false) t_C else ps) res in Aux.Right (c, List.fold_left paths_union empty_path_set f_paths) in - let res = Aux.map_try find_fluents next_e in + let res = List.map find_fluents next_e in let frames, fluents = Aux.partition_choice res in let move_clauses, f_paths = List.split fluents in frames, move_clauses, @@ -186,15 +240,30 @@ ) clauses in let players = Array.of_list players in let rules = Aux.concat_map rules_of_clause clauses in - let stable_rel_defs, nonstable_rel_defs, - stable_base, init_state, (agg_actions, agg_states) = + let static_rel_defs, nonstatic_rel_defs, + static_base, init_state, (agg_actions, agg_states) = playout ~aggregate:true players !playout_horizon rules in - let stable_rels = Aux.unique_sorted - (List.map (fun ((rel,_),_,_)->rel) stable_rel_defs) in - let nonstable_rels = Aux.unique_sorted - (List.map (fun ((rel,_),_,_)->rel) nonstable_rel_defs) in + let static_rels = Aux.unique_sorted + (List.map (fun ((rel,_),_,_)->rel) static_rel_defs) in + let nonstatic_rels = Aux.unique_sorted + (List.map (fun ((rel,_),_,_)->rel) nonstatic_rel_defs) in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: static_rels=%s; nonstatic_rels=%s\n%!" + (String.concat ", " static_rels) (String.concat ", " nonstatic_rels) + ); + (* }}} *) let frame_clauses, move_clauses, f_paths = fluent_paths_and_frames clauses in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: f_paths=%s\n%!" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list f_paths))) + ); + (* }}} *) let next_clauses = List.map (function | (_,[|s_C|]),body_C -> s_C, true, body_C @@ -213,21 +282,51 @@ let element_reps = Aux.unique_sorted (List.map (fun t -> simult_subst f_paths blank t) element_terms) in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: element_reps=\n%s\n%!" + (String.concat ", " (List.map term_str element_reps)) + ); + (* }}} *) + let m_paths = List.map (term_paths ~prefix_only:true (Aux.neg contains_blank)) element_reps in let m_paths = List.fold_left paths_union empty_path_set m_paths in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: m_paths=%s\n%!" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list m_paths))) + ); + (* }}} *) let mask_reps = Aux.unique_sorted (List.map (fun t -> simult_subst m_paths blank t) element_reps) in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: mask_reps=\n%s\n%!" + (String.concat ", " (List.map term_str mask_reps)) + ); + (* }}} *) let m_pathl = paths_to_list m_paths in let f_pathl = paths_to_list f_paths in (* adding subterm equality relations and fact relations *) let struc_rels, defined_rels = List.partition (fun rel -> - List.assoc rel arities <= !defined_arity_above) stable_rels in + List.assoc rel arities <= !defined_arity_above) static_rels in let struc_rels = "EQ_"::struc_rels in - let defined_rels = defined_rels @ nonstable_rels in + let defined_rels = defined_rels @ nonstatic_rels in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf + "create_init_struc: struc_rels=%s; defined_rels=%s\n%!" + (String.concat ", " struc_rels) (String.concat ", " defined_rels) + ); + (* }}} *) let struc = List.fold_left (fun struc rel -> let arity = List.assoc rel arities in @@ -238,7 +337,7 @@ Aux.fold_left_try (fun struc etup -> let tup = Array.of_list (List.map2 at_path etup ptup) in if rel = "EQ_" && arity = 2 && tup.(0) = tup.(1) - || List.mem (rel, tup) stable_base + || List.mem (rel, tup) static_base then Structure.add_rel_named_elems struc fact_rel (Array.map term_to_name tup) @@ -252,10 +351,12 @@ Aux.fold_left_try (fun struc elem -> let pred = pred_on_path_subterm path (at_path elem path) in - rels := pred :: !rels; - let tup = [|elem|] in - Structure.add_rel_named_elems struc pred - (Array.map term_to_name tup) + if List.mem pred !rels then struc + else ( + rels := pred :: !rels; + let tup = [|elem|] in + Structure.add_rel_named_elems struc pred + (Array.map term_to_name tup)) ) struc elements ) struc paths in let stable_rels = ref [] in @@ -267,15 +368,21 @@ let struc = List.fold_left (fun struc m -> let pred = term_to_name m in + stable_rels := pred :: !stable_rels; List.fold_left (fun struc elem -> if simult_subst all_paths blank elem = m then ( - stable_rels := pred :: !stable_rels; Structure.add_rel_named_elems struc pred [|term_to_name elem|]) else struc ) struc element_reps ) struc mask_reps in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "create_init_struc: resulting struc=\n%s\n%!" + (Structure.str struc) + ); + (* }}} *) (* let elem_term_map = Aux.strmap_of_assoc (List.map (fun e -> term_to_name e, e) element_reps) in @@ -286,7 +393,7 @@ players, rules, next_clauses, f_paths, m_paths, mask_reps, defined_rels, !stable_rels, !fluents, - stable_base, init_state, struc, agg_actions, elem_term_map + static_base, init_state, struc, agg_actions, elem_term_map (* substitute a "next" clause with frame info *) let subst_fnextcl sb (head, frame, body) = @@ -607,14 +714,14 @@ result, is_concurrent -let filter_rule_cands stable_base defined_rels rule_cands = +let filter_rule_cands static_base defined_rels rule_cands = let check_atom = function | Pos (Rel (rel, _ as a)) -> List.mem rel defined_rels || - List.exists (rels_unify a) stable_base + List.exists (rels_unify a) static_base | Neg (Rel (rel, _ as a)) -> List.mem rel defined_rels || - not (List.exists (rels_unify a) stable_base) + not (List.exists (rels_unify a) static_base) | _ -> true in let check_cands cands = List.filter (fun (_, _, case_conds) -> @@ -992,7 +1099,7 @@ let players, rules, next_cls, f_paths, m_paths, mask_reps, defined_rels, stable_rels, fluents, - stable_base, init_state, struc, agg_actions, elem_term_map = + static_base, init_state, struc, agg_actions, elem_term_map = create_init_struc clauses in let turn_data = try Some (check_turn_based players rules) @@ -1000,7 +1107,7 @@ let rule_cands, is_concurrent = create_rule_cands (turn_data <> None) used_vars next_cls clauses in let rule_cands = - filter_rule_cands stable_base defined_rels rule_cands in + filter_rule_cands static_base defined_rels rule_cands in let all_state_terms = Aux.concat_map state_terms (List.map snd clauses) in let term_arities = Aux.unique_sorted Modified: trunk/Toss/GGP/TranslateGame.mli =================================================================== --- trunk/Toss/GGP/TranslateGame.mli 2011-08-04 16:40:12 UTC (rev 1525) +++ trunk/Toss/GGP/TranslateGame.mli 2011-08-05 12:09:48 UTC (rev 1526) @@ -48,6 +48,22 @@ val empty_gdl_translation : gdl_translation +(* Create the initial structure and assorted data. Exposed for testing + purposes. + + [players, rules, next_cls, f_paths, m_paths, mask_reps, + defined_rels, stable_rels, fluents, stable_base, init_state, + struc, agg_actions, elem_term_map = create_init_struc clauses] *) +val create_init_struc : + GDL.clause list -> + GDL.term array * GDL.gdl_rule list * + (GDL.term * bool * GDL.literal list) list * GDL.path_set * + GDL.path_set * GDL.term list * string list * string list * + string list * GDL.rel_atom list * GDL.term list * + Structure.structure * GDL.term array list list * + GDL.term Aux.IntMap.t + + (* [playing_as] is only used for building move translation data, the game translation is independent of the selected player (a dummy term can be provided). *) Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-08-04 16:40:12 UTC (rev 1525) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-05 12:09:48 UTC (rev 1526) @@ -98,7 +98,7 @@ "tictactoe" >:: (fun () -> game_test_case ~game_name:"tictactoe" ~player:"xplayer" - ~own_plnum:0 ~opponent_plnum:1 + ~own_plnum:0 ~opponent_plnum:1 ~loc0_rule_name:"mark_x64_y19_0" ~loc0_emb:[ "cell_x64_y19__blank_", "cell_2_2_MV1"; @@ -110,9 +110,54 @@ "control__blank_", "control_MV1"] ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)" ); + ] let bigtests = "TranslateGameBig" >::: [ + + "connect5 translation data" >:: + (fun () -> + (* perhaps should be a small test, takes mediocrily long *) + let descr = load_rules ("./GGP/examples/connect5.gdl") in + let clauses = GDL.expand_players descr in + let players, rules, + next_cls, f_paths, m_paths, mask_reps, defined_rels, + stable_rels, fluents, + stable_base, init_state, struc, agg_actions, elem_term_map = + TranslateGame.create_init_struc clauses in + + assert_equal ~msg:"f_paths" ~printer:(fun x->x) + "cell_2; control_0" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list f_paths))); + + assert_equal ~msg:"m_paths" ~printer:(fun x->x) + "cell_0; cell_1" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list m_paths))); + + assert_equal ~msg:"mask_reps" ~printer:(fun x->x) + "(cell _BLANK_ _BLANK_ _BLANK_); (control _BLANK_)" + (String.concat "; " + (List.map GDL.term_str mask_reps)); + + assert_equal ~msg:"defined_rels" ~printer:(fun x->x) + "adjacent_cell, col, conn5, diag1, diag2, exists_empty_cell, exists_line_of_five, goal, legal, next, row, terminal" + (String.concat ", " defined_rels); + + assert_equal ~msg:"fluents" ~printer:(fun x->x) + "control_0x, control_0o, cell_2b, cell_2x, cell_2o" + (String.concat ", " fluents); + + assert_equal ~msg:"stable_rels" ~printer:(fun x->x) + "A LOT OF THEM" + (String.concat ", " stable_rels); + + assert_equal ~msg:"structure elements" ~printer:(fun x->x) + "cell_a_a__BLANK_, cell_a_b__BLANK_, cell_a_c__BLANK_, cell_a_d__BLANK_, cell_a_e__BLANK_, cell_a_f__BLANK_, cell_a_g__BLANK_, cell_a_h__BLANK_, cell_b_a__BLANK_, cell_b_b__BLANK_, cell_b_c__BLANK_, cell_b_d__BLANK_, cell_b_e__BLANK_, cell_b_f__BLANK_, cell_b_g__BLANK_, cell_b_h__BLANK_, cell_c_a__BLANK_, cell_c_b__BLANK_, cell_c_c__BLANK_, cell_c_d__BLANK_, cell_c_e__BLANK_, cell_c_f__BLANK_, cell_c_g__BLANK_, cell_c_h__BLANK_, cell_d_a__BLANK_, cell_d_b__BLANK_, cell_d_c__BLANK_, cell_d_d__BLANK_, cell_d_e__BLANK_, cell_d_f__BLANK_, cell_d_g__BLANK_, cell_d_h__BLANK_, cell_e_a__BLANK_, cell_e_b__BLANK_, cell_e_c__BLANK_, cell_e_d__BLANK_, cell_e_e__BLANK_, cell_e_f__BLANK_, cell_e_g__BLANK_, cell_e_h__BLANK_, cell_f_a__BLANK_, cell_f_b__BLANK_, cell_f_c__BLANK_, cell_f_d__BLANK_, cell_f_e__BLANK_, cell_f_f__BLANK_, cell_f_g__BLANK_, cell_f_h__BLANK_, cell_g_a__BLANK_, cell_g_b__BLANK_, cell_g_c__BLANK_, cell_g_d__BLANK_, cell_g_e__BLANK_, cell_g_f__BLANK_, cell_g_g__BLANK_, cell_g_h__BLANK_, cell_h_a__BLANK_, cell_h_b__BLANK_, cell_h_c__BLANK_, cell_h_d__BLANK_, cell_h_e__BLANK_, cell_h_f__BLANK_, cell_h_g__BLANK_, cell_h_h__BLANK_" + (String.concat ", " + (List.map (Structure.elem_name struc) (Structure.elements struc))) + ); "connect5" >:: (fun () -> @@ -171,7 +216,7 @@ ] let a () = - GDL.debug_level := 2; + (* GDL.debug_level := 2; *) TranslateGame.debug_level := 4; GameSimpl.debug_level := 4; (* DiscreteRule.debug_level := 4; *) @@ -191,7 +236,48 @@ "control__blank_", "control_MV1"] ~loc1_noop:"noop" ~loc1_move:"(mark f g)" +let a () = + let descr = load_rules ("./GGP/examples/connect5.gdl") in + let clauses = GDL.expand_players descr in + let players, rules, + next_cls, f_paths, m_paths, mask_reps, defined_rels, + stable_rels, fluents, + stable_base, init_state, struc, agg_actions, elem_term_map = + TranslateGame.create_init_struc clauses in + assert_equal ~msg:"f_paths" ~printer:(fun x->x) + "cell_2; control_0" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list f_paths))); + + assert_equal ~msg:"m_paths" ~printer:(fun x->x) + "cell_0; cell_1" + (String.concat "; " + (List.map GDL.path_str (GDL.paths_to_list m_paths))); + + assert_equal ~msg:"mask_reps" ~printer:(fun x->x) + "(cell _BLANK_ _BLANK_ _BLANK_); (control _BLANK_)" + (String.concat "; " + (List.map GDL.term_str mask_reps)); + + assert_equal ~msg:"defined_rels" ~printer:(fun x->x) + "adjacent_cell, col, conn5, diag1, diag2, exists_empty_cell, exists_line_of_five, goal, legal, next, row, terminal" + (String.concat ", " defined_rels); + + assert_equal ~msg:"fluents" ~printer:(fun x->x) + "control_0x, control_0o, cell_2b, cell_2x, cell_2o" + (String.concat ", " fluents); + + assert_equal ~msg:"stable_rels" ~printer:(fun x->x) + "A LOT OF THEM" + (String.concat ", " stable_rels); + + assert_equal ~msg:"structure elements" ~printer:(fun x->x) + "cell_a_a__BLANK_, cell_a_b__BLANK_, cell_a_c__BLANK_, cell_a_d__BLANK_, cell_a_e__BLANK_, cell_a_f__BLANK_, cell_a_g__BLANK_, cell_a_h__BLANK_, cell_b_a__BLANK_, cell_b_b__BLANK_, cell_b_c__BLANK_, cell_b_d__BLANK_, cell_b_e__BLANK_, cell_b_f__BLANK_, cell_b_g__BLANK_, cell_b_h__BLANK_, cell_c_a__BLANK_, cell_c_b__BLANK_, cell_c_c__BLANK_, cell_c_d__BLANK_, cell_c_e__BLANK_, cell_c_f__BLANK_, cell_c_g__BLANK_, cell_c_h__BLANK_, cell_d_a__BLANK_, cell_d_b__BLANK_, cell_d_c__BLANK_, cell_d_d__BLANK_, cell_d_e__BLANK_, cell_d_f__BLANK_, cell_d_g__BLANK_, cell_d_h__BLANK_, cell_e_a__BLANK_, cell_e_b__BLANK_, cell_e_c__BLANK_, cell_e_d__BLANK_, cell_e_e__BLANK_, cell_e_f__BLANK_, cell_e_g__BLANK_, cell_e_h__BLANK_, cell_f_a__BLANK_, cell_f_b__BLANK_, cell_f_c__BLANK_, cell_f_d__BLANK_, cell_f_e__BLANK_, cell_f_f__BLANK_, cell_f_g__BLANK_, cell_f_h__BLANK_, cell_g_a__BLANK_, cell_g_b__BLANK_, cell_g_c__BLANK_, cell_g_d__BLANK_, cell_g_e__BLANK_, cell_g_f__BLANK_, cell_g_g__BLANK_, cell_g_h__BLANK_, cell_h_a__BLANK_, cell_h_b__BLANK_, cell_h_c__BLANK_, cell_h_d__BLANK_, cell_h_e__BLANK_, cell_h_f__BLANK_, cell_h_g__BLANK_, cell_h_h__BLANK_" + (String.concat ", " + (List.map (Structure.elem_name struc) (Structure.elements struc))) + + let a () = match test_filter [(* "GDLBig:1:breakthrough" *) "GDLBig:0:connect5"] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-10 12:15:40
|
Revision: 1533 http://toss.svn.sourceforge.net/toss/?rev=1533&view=rev Author: lukstafi Date: 2011-08-10 12:15:33 +0000 (Wed, 10 Aug 2011) Log Message: ----------- GDL translation fixing: eliminating ground arguments of relations integrated. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/GDLTest.ml trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateFormula.mli trunk/Toss/GGP/TranslateFormulaTest.ml trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGame.mli trunk/Toss/GGP/TranslateGameTest.ml Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/GDL.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -555,7 +555,7 @@ let sb = unify sb [ground] [inst_arg] in let r_gr = rel ^ "__" ^ term_to_name ground in let r_br = head, add_lit (Rel (r_gr, short_args)) body in - sb, subst_clause sb r_br) + sb, (* subst_clause sb *) r_br) grounding in let rec expand_literal emb_lit literal (sb, (head, body) as accu) = @@ -580,7 +580,7 @@ Aux.concat_foldr (expand_literal (fun l body-> l::body)) body init in List.map (fun (sb, cl) -> subst_clause sb cl) result -let elim_ground_arg rel arg clauses = +let elim_ground_arg new_rels rel arg clauses = let rel_brs, clauses = List.partition (fun ((r,_),_) -> r=rel) clauses in let grounding = Aux.unique_sorted @@ -590,24 +590,33 @@ let short_args = Array.init (Array.length args - 1) (fun i -> if i < arg then args.(i) else args.(i+1)) in let rname = rel ^ "__" ^ term_to_name args.(arg) in + new_rels := rname:: !new_rels; (rname, short_args), body) rel_brs in Aux.concat_map (elim_ground_arg_in_body rel arg grounding) (renamed_brs @ clauses) let elim_ground_args rels clauses = - let modified = ref false in + let new_rels = ref [] and all_rels = ref [] in let rec aux clauses = function | [] -> clauses | rel::rels -> (let try arg = find_ground_arg rel clauses in - modified := true; - aux (elim_ground_arg rel arg clauses) rels - with Not_found -> aux clauses rels) in + aux (elim_ground_arg new_rels rel arg clauses) rels + with Not_found -> + all_rels := rel:: !all_rels; aux clauses rels) in let rec fix clauses = - modified := false; + all_rels := !new_rels @ !all_rels; + new_rels := []; let clauses = aux clauses rels in - if !modified then fix clauses else clauses in + if !new_rels <> [] + then fix clauses + else + let all_rels = List.filter + (fun r->List.exists + (function ((rel,_),_) when r=rel -> true | _ -> false) clauses) + (Aux.unique_sorted !all_rels) in + all_rels, clauses in fix clauses @@ -799,6 +808,7 @@ let player_vars_of rels = Aux.map_some (function + | "role", [|Var v|] -> Some v | "goal", [|Var v; _|] -> Some v | "does", [|Var v; _|] -> Some v | "legal", [|Var v; _|] -> Some v Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/GDL.mli 2011-08-10 12:15:33 UTC (rev 1533) @@ -91,7 +91,11 @@ val func_graph : string -> term list -> term array list -val elim_ground_args : string list -> clause list -> clause list +(** Eliminate arguments of relations that are constant in each + defining clause. Return the new clauses, and also the new + relation set. *) +val elim_ground_args : + string list -> clause list -> string list * clause list (** {3 GDL translation helpers.} *) Modified: trunk/Toss/GGP/GDLTest.ml =================================================================== --- trunk/Toss/GGP/GDLTest.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/GDLTest.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -218,10 +218,14 @@ (nextcol ?d ?e) (true (cell ?x ?e o))) " in - let result = elim_ground_args ["conn5"; "col"; "row"] descr in + let defined_rels, result = + elim_ground_args ["conn5"; "col"; "row"] descr in let res_s = (String.concat "\n" (List.map GDL.clause_str result)) in assert_equal ~printer:(fun x->x) + "col__o, col__x, conn5__o, conn5__x, row__o, row__x" + (String.concat ", " defined_rels); + assert_equal ~printer:(fun x->x) "(<= (conn5__o ) (or (col__o ) (row__o ))) (<= (conn5__x ) Modified: trunk/Toss/GGP/TranslateFormula.ml =================================================================== --- trunk/Toss/GGP/TranslateFormula.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateFormula.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -2,6 +2,8 @@ open GDL +let debug_level = ref 0 + let rel_atoms body = Aux.map_some (function Rel (rel, args) -> Some (rel, args) | _ -> None) (atoms_of_body body) @@ -226,6 +228,12 @@ let build_defrel rel = (* searching for ArgType = DefSide,S,p *) let branches = Aux.assoc_all rel all_branches in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "build_defrel: rel=%s, no of brs=%d\n%!" + rel (List.length branches) + ); + (* }}} *) (* first find the common paths, we will find the state terms later *) let branch_paths = List.map (fun (args, (_, sterms_pos, sterms_neg)) -> @@ -290,10 +298,13 @@ match defside, callside with | Some p, _ | None, Some p -> p | None, None -> - (* the ArgType(R,i) = NoSide,p variant is precomputed *) - match (List.assoc rel data.rel_default_path).(i) with - | Some p -> p - | None -> failwith + (* the ArgType(R,i) = NoSide,p variant is precomputed *) + try + match (List.assoc rel data.rel_default_path).(i) with + | Some p -> p + | None -> raise Not_found + with Not_found -> + failwith (Printf.sprintf "TranslateFormula.build_defrels: could not \ determine path for relation %s argument %d" rel i) @@ -313,7 +324,7 @@ | None -> assert false in Formula.Eq (v, s_i) else Formula.Eq (v, - var_of_subterm data arg_paths.(i) args.(i))) + var_of_subterm data arg_paths.(i) args.(i))) defvars in let arg_eqs = Formula.And (Array.to_list arg_eqs) in let callside_sterms = Modified: trunk/Toss/GGP/TranslateFormula.mli =================================================================== --- trunk/Toss/GGP/TranslateFormula.mli 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateFormula.mli 2011-08-10 12:15:33 UTC (rev 1533) @@ -1,3 +1,5 @@ +val debug_level : int ref + (* Whether $i$th argument is a $\mathrm{DefSide}$ or a $\mathrm{CallSide}$, and the $p_{R,i}$ path for a relation $R$. *) type defrel_arg_type = (bool * GDL.path) array Modified: trunk/Toss/GGP/TranslateFormulaTest.ml =================================================================== --- trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -30,15 +30,18 @@ ["control", 1; "cell", 3; "x", 0; "o", 0; "b", 0; "mark", 2; "a", 0; "b", 0; "c", 0; "d", 0; "e", 0; "f", 0; "g", 0; "h", 0] in let arities f = List.assoc f term_arities in + let f_paths = [["cell", 2]; ["control", 0]] in + let ground_flu = [GDL.Const "x"; GDL.Const "o"; GDL.Const "b"] in + let ground_at_f_paths = List.map (fun f -> f, ground_flu) f_paths in let f_paths = List.fold_right (GDL.add_path arities) - [["cell", 2]; ["control", 0]] GDL.empty_path_set in + f_paths GDL.empty_path_set in let m_paths = List.fold_right (GDL.add_path arities) [["cell", 0]; ["cell", 1]] GDL.empty_path_set in let all_paths = GDL.paths_union f_paths m_paths in let mask_reps = [GDL.Func ("control", [|GDL.blank|]); GDL.Func ("cell", [|GDL.blank; GDL.blank; GDL.blank|])] in - let defrel_arities = [ + let exp_defrel_arities = [ "adjacent_cell", 4; "col__x", 0; "col__o", 0; "col__b", 0; "conn5__x", 0; "conn5__o", 0; "conn5__b", 0; @@ -46,10 +49,13 @@ "diag2__x", 0; "diag2__o", 0; "diag2__b", 0; "exists_empty_cell", 0; "exists_line_of_five", 0; "row__x", 0; "row__o", 0; "row__b", 0] in - let defined_rels = List.map fst defrel_arities in + let defined_rels = + ["adjacent_cell"; "col"; "conn5"; "diag1"; "diag2"; + "exists_empty_cell"; "exists_line_of_five"; "row"] in let default_path = Some ["cell", 0] in let rel_default_path = List.map - (fun (rel, ar) -> rel, Array.make ar default_path) defrel_arities in + (fun (rel, ar) -> rel, Array.make ar default_path) exp_defrel_arities in + ground_at_f_paths, { f_paths = f_paths; m_paths = m_paths; @@ -66,10 +72,19 @@ "defined relations connect5" >:: (fun () -> let descr = load_rules ("./GGP/examples/connect5.gdl") in - let transl_data = connect5_data in + let ground_at_f_paths, transl_data = connect5_data in let clauses = GDL.expand_players descr in let clauses = + GDL.ground_vars_at_paths ground_at_f_paths clauses in + let defined_rels, clauses = GDL.elim_ground_args transl_data.defined_rels clauses in + (* {{{ log entry *) + if !TranslateFormula.debug_level > 2 then ( + Printf.printf "defined relations connect5: clauses =\n%s\n%!" + (String.concat "\n" (List.map GDL.clause_str clauses)) + ); + (* }}} *) + let transl_data = {transl_data with defined_rels = defined_rels} in let defined_rels = TranslateFormula.build_defrels transl_data clauses in let res = String.concat "\n" @@ -78,9 +93,39 @@ ") = "^Formula.str body) defined_rels) in assert_equal ~msg:"connect5 noop moves by players" ~printer:(fun x->x) - "" res; + "" res ); ] +let a () = + TranslateFormula.debug_level := 5; + GDL.debug_level := 2; + () + +let a () = + let descr = load_rules ("./GGP/examples/connect5.gdl") in + let ground_at_f_paths, transl_data = connect5_data in + let clauses = GDL.expand_players descr in + let clauses = + GDL.ground_vars_at_paths ground_at_f_paths clauses in + let defined_rels, clauses = + GDL.elim_ground_args transl_data.defined_rels clauses in + (* {{{ log entry *) + if !TranslateFormula.debug_level > 2 then ( + Printf.printf "defined relations connect5: clauses =\n%s\n%!" + (String.concat "\n" (List.map GDL.clause_str clauses)) + ); + (* }}} *) + let transl_data = {transl_data with defined_rels = defined_rels} in + let defined_rels = + TranslateFormula.build_defrels transl_data clauses in + let res = String.concat "\n" + (List.map (fun (rel,(args,body)) -> + rel^"("^String.concat ", " args^ + ") = "^Formula.str body) defined_rels) in + assert_equal ~msg:"connect5 noop moves by players" + ~printer:(fun x->x) + "" res + let exec = Aux.run_test_if_target "TranslateFormulaTest" tests Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -231,7 +231,8 @@ (* Expand role variables, find fluent and mask paths, generate the - initial structure. *) + initial structure. Encode frame clauses by using the unique + relation name "frame next". *) let create_init_struc clauses = let players = Aux.map_some (function @@ -389,8 +390,13 @@ let elem_term_map = Aux.intmap_of_assoc (List.map (fun e -> Structure.find_elem struc (term_to_name e), e) element_reps) in + let clauses = + List.filter (fun ((rel,_),_) -> rel <> "next") clauses in + let frame_clauses = List.map + (fun ((_,args),body) -> ("frame next", args), body) frame_clauses in players, rules, - frame_clauses, move_clauses, f_paths, m_paths, mask_reps, defined_rels, + frame_clauses @ move_clauses @ clauses, + f_paths, m_paths, mask_reps, defined_rels, Aux.Strings.elements !stable_rels, Aux.Strings.elements !fluents, static_base, init_state, struc, ground_state_terms, elem_term_map @@ -1124,7 +1130,7 @@ let clauses = expand_players clauses in let used_vars, clauses = rename_clauses clauses in let players, rules, - frame_clauses, move_clauses, f_paths, m_paths, + clauses, f_paths, m_paths, mask_reps, defined_rels, stable_rels, fluents, static_base, init_state, struc, ground_state_terms, elem_term_map = create_init_struc clauses in @@ -1135,20 +1141,15 @@ let ground_at_f_paths = ground_at f_paths in let clauses = ground_vars_at_paths ground_at_f_paths clauses in - let frame_clauses = - ground_vars_at_paths ground_at_f_paths frame_clauses in - let move_clauses = - ground_vars_at_paths ground_at_f_paths move_clauses in let defined_rels = Aux.list_diff defined_rels ["goal"; "legal"; "next"; "terminal"] in - let clauses = elim_ground_args defined_rels clauses in - let next_cls = - List.map (function - | (_,[|s_C|]),body_C -> s_C, true, body_C - | _ -> assert false) frame_clauses - @ List.map (function - | (_,[|s_C|]),body_C -> s_C, false, body_C - | _ -> assert false) move_clauses in + let defined_rels, clauses = elim_ground_args defined_rels clauses in + let next_cls = Aux.map_some + (function + | ("frame next",[|s_C|]),body_C -> Some (s_C, true, body_C) + | ("next",[|s_C|]),body_C -> Some (s_C, false, body_C) + | _ -> None) + clauses in let turn_data = try Some (check_turn_based players rules) with Not_turn_based -> None in Modified: trunk/Toss/GGP/TranslateGame.mli =================================================================== --- trunk/Toss/GGP/TranslateGame.mli 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateGame.mli 2011-08-10 12:15:33 UTC (rev 1533) @@ -49,7 +49,8 @@ val empty_gdl_translation : gdl_translation (* Create the initial structure and assorted data. Exposed for testing - purposes. + purposes. Encode frame clauses by using the unique + relation name "frame next". [players, rules, frame_cls, move_cls, f_paths, m_paths, mask_reps, defined_rels, stable_rels, fluents, stable_base, init_state, @@ -57,7 +58,7 @@ val create_init_struc : GDL.clause list -> GDL.term array * GDL.gdl_rule list * - GDL.clause list * GDL.clause list * GDL.path_set * + GDL.clause list * GDL.path_set * GDL.path_set * GDL.term list * string list * string list * string list * GDL.rel_atom list * GDL.term list * Structure.structure * GDL.term list * Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-08-10 03:31:00 UTC (rev 1532) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-10 12:15:33 UTC (rev 1533) @@ -120,7 +120,7 @@ let descr = load_rules ("./GGP/examples/connect5.gdl") in let clauses = GDL.expand_players descr in let players, rules, - frame_cls, move_cls, f_paths, m_paths, mask_reps, defined_rels, + clauses, f_paths, m_paths, mask_reps, defined_rels, stable_rels, fluents, stable_base, init_state, struc, ground_state_terms, elem_term_map = TranslateGame.create_init_struc clauses in This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-11 00:29:08
|
Revision: 1534 http://toss.svn.sourceforge.net/toss/?rev=1534&view=rev Author: lukstafi Date: 2011-08-11 00:29:00 +0000 (Thu, 11 Aug 2011) Log Message: ----------- GDL translation fixing: two small bugs in preparing for formula translation (which somehow is very wrong but can be debugged now). Modified Paths: -------------- trunk/Toss/GGP/GDLParser.mly trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateFormula.mli trunk/Toss/GGP/TranslateFormulaTest.ml Modified: trunk/Toss/GGP/GDLParser.mly =================================================================== --- trunk/Toss/GGP/GDLParser.mly 2011-08-10 12:15:33 UTC (rev 1533) +++ trunk/Toss/GGP/GDLParser.mly 2011-08-11 00:29:00 UTC (rev 1534) @@ -14,9 +14,10 @@ %token FORALL EXISTS EOF -%start parse_game_description parse_request parse_term +%start parse_game_description parse_request parse_term parse_literal_list %type <GDL.request> parse_request request %type <GDL.term> parse_term +%type <GDL.literal list> parse_literal_list %type <GDL.clause list> parse_game_description game_description @@ -146,3 +147,6 @@ parse_term: | term EOF { $1 } + +parse_literal_list: + | body=list (literal) EOF { body } Modified: trunk/Toss/GGP/TranslateFormula.ml =================================================================== --- trunk/Toss/GGP/TranslateFormula.ml 2011-08-10 12:15:33 UTC (rev 1533) +++ trunk/Toss/GGP/TranslateFormula.ml 2011-08-11 00:29:00 UTC (rev 1534) @@ -17,21 +17,26 @@ splitting disjuncts if necessary, into "positive state terms", "negative state terms" and "reminder". *) let separate_disj disj = + (* FIXME see tests *) let aux conj = List.fold_right (fun lit acc -> match lit with | (Pos (True _) | Neg (True _)) as lit -> List.map (fun conj -> Aux.Left lit::conj) acc | Disj ls as lit -> - if List.for_all (function Pos _ -> true | _ -> false) ls - || List.for_all (function Neg _ -> true | _ -> false) ls + if List.for_all (function Pos (True _) -> true | _ -> false) ls + || List.for_all (function Neg (True _) -> true | _ -> false) ls then List.map (fun conj -> Aux.Left lit::conj) acc - else + else if List.exists + (function Pos (True _) | Neg (True _) -> true | _ -> false) ls + then Aux.concat_map (function | (Pos (True _) | Neg (True _)) as lit -> List.map (fun conj -> Aux.Left lit::conj) acc | lit -> List.map (fun conj -> Aux.Right lit::conj) acc ) ls + else (* none is [True _] *) + List.map (fun conj -> Aux.Right lit::conj) acc | lit -> List.map (fun conj -> Aux.Right lit::conj) acc ) conj [[]] in let disj = Aux.concat_map aux disj in @@ -42,10 +47,10 @@ | Pos _ as lit -> Aux.Left lit | Neg _ as lit -> Aux.Right lit | Disj ls as lit - when List.for_all (function Pos _ -> true | _ -> false) ls + when List.for_all (function Pos (True _) -> true | _ -> false) ls -> Aux.Left lit | Disj ls as lit - when List.for_all (function Neg _ -> true | _ -> false) ls + when List.for_all (function Neg (True _) -> true | _ -> false) ls -> Aux.Right lit | _ -> assert false ) state_terms in @@ -130,15 +135,15 @@ if sign then atoms else List.map (fun a -> Formula.Not a) atoms with Not_found -> [] in - let transl_defrel sign rel args = + let transl_posdefrel sign rel args = if List.mem rel data.defined_rels then [!translate_defrel data sterms_all sterms_in s_subterms sign rel args] - else transl_rel false rel args in + else transl_rel sign rel args in let rec aux = function - | Pos (Rel (rel, args)) -> transl_defrel true rel args - | Neg (Rel (rel, args)) -> transl_defrel false rel args + | Pos (Rel (rel, args)) -> transl_posdefrel true rel args + | Neg (Rel (rel, args)) -> transl_posdefrel false rel args | Pos (Does _ | Role _) | Neg (Does _ | Role _) -> [] | Disj lits -> @@ -147,6 +152,12 @@ Formula.And (Aux.concat_map aux rels_phi) let transl_state data phi = + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "transl_state:\n%s\n%!" + (clause_str (("transl_state phi", [||]),phi)) + ); + (* }}} *) let transl_sterm sterm = let s_subterms = map_paths (fun path subt -> subt, path) data.all_paths sterm in @@ -182,7 +193,7 @@ let transl_disjunct data rels_phi pos_state_phi neg_state_phi ext_phi = let pos_terms = state_terms pos_state_phi in let pos_vars = List.map (var_of_term data) pos_terms in - let neg_terms = state_terms pos_state_phi in + let neg_terms = state_terms neg_state_phi in let neg_vars = List.map (var_of_term data) neg_terms in let all_terms = pos_terms @ neg_terms in let phi_vars = clause_vars @@ -192,6 +203,15 @@ List.map (fun v -> Pos (Rel ("EQ_", [|Var v; Var v|]))) (Aux.Strings.elements phi_vars) in let rels_eqs = rels_phi @ eqs in + (* {{{ log entry *) +if !debug_level > 2 then ( + Printf.printf "\ntransl_disjunct:\n%s\n%s\n%s\n%s\n%!" + (clause_str (("rels_phi", [||]),rels_phi)) + (clause_str (("pos_state_phi", [||]),pos_state_phi)) + (clause_str (("neg_state_phi", [||]),neg_state_phi)) + ("ext_phi="^Formula.str ext_phi) +); +(* }}} *) let negated_neg_state_transl = (* negation-normal-form of "not neg_state_phi" *) Formula.Or ( @@ -220,12 +240,9 @@ (* **************************************** *) (* {3 Build and use defined relations.} *) -let build_defrels data clauses = - let all_branches = Aux.concat_map - (fun ((rel,args),body) -> - List.map (fun phi -> rel, (args, phi)) (separate_disj [body])) - clauses in - let build_defrel rel = +let select_defrel_argpaths data all_branches = + (* TODO: code-review this and [build_defrel] functions *) + let select_for_defrel rel = (* searching for ArgType = DefSide,S,p *) let branches = Aux.assoc_all rel all_branches in (* {{{ log entry *) @@ -309,7 +326,25 @@ "TranslateFormula.build_defrels: could not \ determine path for relation %s argument %d" rel i) ) p_defside in + let defrel_arg_type = Aux.array_map2 + (fun defside path -> defside <> None, path) + p_defside arg_paths in + data.defrel_arg_type := + (rel, defrel_arg_type) :: !(data.defrel_arg_type); + rel, (p_defside, s_defside, arg_paths) in + List.map select_for_defrel data.defined_rels + + +let build_defrels data clauses = + let all_branches = Aux.concat_map + (fun ((rel,args),body) -> + List.map (fun phi -> rel, (args, phi)) (separate_disj [body])) + clauses in + let sel_argpaths = select_defrel_argpaths data all_branches in + let build_defrel rel = (* now building the translation *) + let (p_defside, s_defside, arg_paths) = + List.assoc rel sel_argpaths in let defvars = Array.mapi (fun i _ -> "v"^string_of_int i) arg_paths in let defbody (args,(rels_phi,pos_state,neg_state)) s_defside = @@ -323,8 +358,7 @@ | Some s -> var_of_term data s | None -> assert false in Formula.Eq (v, s_i) - else Formula.Eq (v, - var_of_subterm data arg_paths.(i) args.(i))) + else Formula.Eq (v, var_of_subterm data arg_paths.(i) args.(i))) defvars in let arg_eqs = Formula.And (Array.to_list arg_eqs) in let callside_sterms = @@ -338,17 +372,19 @@ (Array.map (fun sterm -> Pos (True sterm)) callside_sterms) in transl_disjunct data rels_phi (callside_sterms @ pos_state) neg_state arg_eqs in + let branches = Aux.assoc_all rel all_branches in let def_disjuncts = List.map2 defbody branches s_defside in - let defrel_arg_type = Aux.array_map2 - (fun defside path -> defside <> None, path) - p_defside arg_paths in - data.defrel_arg_type := - (rel, defrel_arg_type) :: !(data.defrel_arg_type); rel, (Array.to_list defvars, Formula.Or def_disjuncts) in List.map build_defrel data.defined_rels let transl_defrel data sterms_all sterms_in s_subterms sign rel args = + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "transl_defrel: phi=%s, sign=%b\n" + (rel_atom_str (rel, args)) sign + ); + (* }}} *) let arg_type = List.assoc rel !(data.defrel_arg_type) in (* the $s \tpos_{p_{R,i}} = t_i$ state terms *) let arg_sterms = Array.mapi Modified: trunk/Toss/GGP/TranslateFormula.mli =================================================================== --- trunk/Toss/GGP/TranslateFormula.mli 2011-08-10 12:15:33 UTC (rev 1533) +++ trunk/Toss/GGP/TranslateFormula.mli 2011-08-11 00:29:00 UTC (rev 1534) @@ -21,6 +21,11 @@ val empty_transl_data : transl_data +(** Exposed for testing purposes only. *) +val separate_disj : + GDL.literal list list -> + (GDL.literal list * GDL.literal list * GDL.literal list) list + val translate : transl_data -> GDL.literal list list -> Formula.formula Modified: trunk/Toss/GGP/TranslateFormulaTest.ml =================================================================== --- trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-10 12:15:33 UTC (rev 1533) +++ trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-11 00:29:00 UTC (rev 1534) @@ -9,6 +9,10 @@ GDLParser.parse_term KIFLexer.lex (Lexing.from_string s) +let parse_literal_list s = + GDLParser.parse_literal_list KIFLexer.lex + (Lexing.from_string s) + let pte = parse_term let state_of_file s = @@ -69,6 +73,72 @@ let tests = "TranslateFormula" >::: [ + "separate_disj" >:: + (fun () -> + let i2s = string_of_int in + let str_res disj = Array.mapi + (fun i (rels, pos_s, neg_s) -> + GDL.clause_str (("rels#"^i2s i, [||]),rels) ^"\n" ^ + GDL.clause_str (("pos_s#"^i2s i, [||]),pos_s) ^"\n" ^ + GDL.clause_str (("neg_s#"^i2s i, [||]),neg_s) ^"\n") + (Array.of_list disj) in + + let phi = "(or (col ?r) (row ?r) (diag1 ?r) (diag2 ?r))" in + let conj = parse_literal_list phi in + let disj = separate_disj [conj] in + assert_equal ~msg:phi ~printer:(fun x->x) + "(<= (rels#0 ) + (or (col ?r) (row ?r) (diag1 ?r) (diag2 ?r))) +(<= (pos_s#0 ) + ) +(<= (neg_s#0 ) + ) +" + (String.concat "\n" (Array.to_list (str_res disj))); + + let phi = "(or (arel x) (true s1)) (brel y)" in + let conj = parse_literal_list phi in + let disj = separate_disj [conj] in + assert_equal ~msg:phi ~printer:(fun x->x) + "(<= (rels#0 ) + (arel x) + (brel y)) +(<= (pos_s#0 ) + ) +(<= (neg_s#0 ) + ) + +(<= (rels#1 ) + (brel y)) +(<= (pos_s#1 ) + (true s1)) +(<= (neg_s#1 ) + ) +" + (String.concat "\n" (Array.to_list (str_res disj))); + + let phi = "(or (arel x) (true s1)) (not (true s2))" in + let conj = parse_literal_list phi in + let disj = separate_disj [conj] in + assert_equal ~msg:phi ~printer:(fun x->x) + "(<= (rels#0 ) + (arel x)) +(<= (pos_s#0 ) + ) +(<= (neg_s#0 ) + (not (true s2))) + +(<= (rels#1 ) + ) +(<= (pos_s#1 ) + (true s1)) +(<= (neg_s#1 ) + (not (true s2))) +" + (String.concat "\n" (Array.to_list (str_res disj))); + + ); + "defined relations connect5" >:: (fun () -> let descr = load_rules ("./GGP/examples/connect5.gdl") in @@ -100,7 +170,7 @@ let a () = TranslateFormula.debug_level := 5; - GDL.debug_level := 2; + (* GDL.debug_level := 2; *) () let a () = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-11 14:04:30
|
Revision: 1535 http://toss.svn.sourceforge.net/toss/?rev=1535&view=rev Author: lukstafi Date: 2011-08-11 14:04:23 +0000 (Thu, 11 Aug 2011) Log Message: ----------- GDL translation fixing: simple bugs, TranslateFormula tests pass. Modified Paths: -------------- trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateFormulaTest.ml Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-08-11 00:29:00 UTC (rev 1534) +++ trunk/Toss/GGP/GDL.mli 2011-08-11 14:04:23 UTC (rev 1535) @@ -109,6 +109,7 @@ val rel_atom_str : rel_atom -> string val def_str : string * def_branch list -> string +val literal_str : literal -> string val clause_str : clause -> string (** {3 GDL whole-game operations.} Modified: trunk/Toss/GGP/TranslateFormula.ml =================================================================== --- trunk/Toss/GGP/TranslateFormula.ml 2011-08-11 00:29:00 UTC (rev 1534) +++ trunk/Toss/GGP/TranslateFormula.ml 2011-08-11 14:04:23 UTC (rev 1535) @@ -115,26 +115,39 @@ sterms_all in let s_subterms = List.filter (fun (subt, _) -> subt <> blank) s_subterms in + (* {{{ log entry *) + if !debug_level > 2 then ( + Printf.printf "transl_rels: rels_phi=%s; s_subterms=\n%s\n%!" + (String.concat " " (List.map literal_str rels_phi)) + (String.concat ", " (List.map (fun (subt,(sterm,path)) -> + Printf.sprintf "{sterm=%s; subt=%s; path=%s}" + (term_str sterm) (term_str subt) (path_str path)) s_subterms)) + ); + (* }}} *) let s_subterms = Aux.collect s_subterms in let transl_rel sign rel args = - try - let (stuples : (GDL.term * GDL.path) list list) = - List.map (fun arg -> List.assoc arg s_subterms) - (Array.to_list args) in - let (stuples : (GDL.term * GDL.path) list list) = Aux.product stuples in - let stuples = List.filter - (fun stup -> - List.exists (fun (sterm,_) -> List.mem sterm sterms_in) stup) - stuples in - let atoms = List.map - (fun stup -> - let vartup = List.map (fun (sterm,_) -> - var_of_term data sterm) stup in - let fact_rel = rel_on_paths rel (List.map snd stup) in - Formula.Rel (fact_rel, Array.of_list vartup)) stuples in - if sign then atoms - else List.map (fun a -> Formula.Not a) atoms - with Not_found -> [] in + (let try stuples = + List.map (fun arg -> List.assoc arg s_subterms) + (Array.to_list args) in + let stuples = Aux.product stuples in + let stuples = List.filter + (fun stup -> + List.exists (fun (sterm,_) -> List.mem sterm sterms_in) stup) + stuples in + let atoms = Aux.map_some + (fun stup -> + let vartup = Aux.array_map_of_list + (fun (sterm,_) -> var_of_term data sterm) stup in + (* a bit of simplification for easier debugging *) + if rel = "EQ_" && vartup.(0) = vartup.(1) + then None + else + let fact_rel = rel_on_paths rel (List.map snd stup) in + Some (Formula.Rel (fact_rel, vartup))) + stuples in + if sign then atoms + else List.map (fun a -> Formula.Not a) atoms + with Not_found -> []) in let transl_posdefrel sign rel args = if List.mem rel data.defined_rels then @@ -162,7 +175,9 @@ let s_subterms = map_paths (fun path subt -> subt, path) data.all_paths sterm in let s_subterms = List.filter - (fun (subt, _) -> subt <> blank) s_subterms in + (fun (subt, _) -> + subt <> blank && Aux.Strings.is_empty (term_vars subt)) + s_subterms in let vartup = [|var_of_term data sterm|] in let anchor_and_fluent_preds = List.map (fun (subt, path) -> @@ -204,28 +219,35 @@ (Aux.Strings.elements phi_vars) in let rels_eqs = rels_phi @ eqs in (* {{{ log entry *) -if !debug_level > 2 then ( + if !debug_level > 2 then ( Printf.printf "\ntransl_disjunct:\n%s\n%s\n%s\n%s\n%!" (clause_str (("rels_phi", [||]),rels_phi)) (clause_str (("pos_state_phi", [||]),pos_state_phi)) (clause_str (("neg_state_phi", [||]),neg_state_phi)) ("ext_phi="^Formula.str ext_phi) -); -(* }}} *) + ); + (* }}} *) let negated_neg_state_transl = (* negation-normal-form of "not neg_state_phi" *) Formula.Or ( List.map (transl_state data) (nnf_dnf neg_state_phi)) in - Formula.Ex ((pos_vars :> Formula.var list), - Formula.And [ - ext_phi; - transl_rels data rels_eqs pos_terms pos_terms; - transl_state data pos_state_phi; - Formula.Not ( - Formula.Ex ((neg_vars :> Formula.var list), - Formula.And [ - transl_rels data rels_eqs all_terms pos_terms; - negated_neg_state_transl]))]) + let universal_part = + if neg_terms = [] then [] + else [Formula.Not ( + Formula.Ex ((neg_vars :> Formula.var list), + Formula.And [ + (* positive because they form a "premise" *) + transl_rels data rels_eqs all_terms neg_terms; + (* the universal "conclusion" *) + negated_neg_state_transl]))] in + let base_part = + Formula.And ( + [ ext_phi; + transl_rels data rels_eqs pos_terms pos_terms; + transl_state data pos_state_phi] @ + universal_part) in + if pos_vars = [] then base_part + else Formula.Ex ((pos_vars :> Formula.var list), base_part) @@ -247,7 +269,7 @@ let branches = Aux.assoc_all rel all_branches in (* {{{ log entry *) if !debug_level > 2 then ( - Printf.printf "build_defrel: rel=%s, no of brs=%d\n%!" + Printf.printf "select_defrel_argpaths: rel=%s, no of brs=%d\n%!" rel (List.length branches) ); (* }}} *) @@ -348,7 +370,7 @@ let defvars = Array.mapi (fun i _ -> "v"^string_of_int i) arg_paths in let defbody (args,(rels_phi,pos_state,neg_state)) s_defside = - let arg_eqs = Array.mapi + let arg_eqs = Array.mapi (* $E_{j,l}$ *) (fun i v -> let v = Formula.fo_var_of_string v in let in_I = p_defside.(i) <> None in @@ -361,12 +383,12 @@ else Formula.Eq (v, var_of_subterm data arg_paths.(i) args.(i))) defvars in let arg_eqs = Formula.And (Array.to_list arg_eqs) in - let callside_sterms = + let callside_sterms = (* $S_{j,l}$ *) Aux.array_mapi_some - (fun i -> function None -> None - | Some path -> - Some (blank_outside_subterm data path args.(i))) - p_defside in + (fun i path -> + if p_defside.(i) <> None then None (* only for not in I *) + else Some (blank_outside_subterm data path args.(i))) + arg_paths in (* packing sterms back as a formula *) let callside_sterms = Array.to_list (Array.map (fun sterm -> Pos (True sterm)) callside_sterms) in @@ -416,8 +438,11 @@ else None in let eqs_phi = Array.to_list (Aux.array_mapi_some in_J_eq_transl arg_type) in - Formula.Ex ((ex_vars :> Formula.var list), - Formula.And (defrel_phi::eqs_phi)) + let base = + if eqs_phi = [] then defrel_phi + else Formula.And (defrel_phi::eqs_phi) in + if ex_vars = [] then base + else Formula.Ex ((ex_vars :> Formula.var list), base) let _ = translate_defrel := transl_defrel Modified: trunk/Toss/GGP/TranslateFormulaTest.ml =================================================================== --- trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-11 00:29:00 UTC (rev 1534) +++ trunk/Toss/GGP/TranslateFormulaTest.ml 2011-08-11 14:04:23 UTC (rev 1535) @@ -157,13 +157,89 @@ let transl_data = {transl_data with defined_rels = defined_rels} in let defined_rels = TranslateFormula.build_defrels transl_data clauses in - let res = String.concat "\n" - (List.map (fun (rel,(args,body)) -> - rel^"("^String.concat ", " args^ - ") = "^Formula.str body) defined_rels) in - assert_equal ~msg:"connect5 noop moves by players" + let result drel = + let args, body = List.assoc drel defined_rels in + drel^"("^String.concat ", " args^ + ") = "^Formula.str (FormulaOps.simplify body) in + + assert_equal ~msg:"adjacent_cell defined relation translation" ~printer:(fun x->x) - "" res + "adjacent_cell(v0, v1, v2, v3) = ex cell_x__BLANK___BLANK_, cell_y__BLANK___BLANK_, cell_x1__BLANK___BLANK_, + cell_y1__BLANK___BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_x__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y1__BLANK___BLANK_) and + adjacent__cell_0__cell_0(cell_x__BLANK___BLANK_, + cell_x1__BLANK___BLANK_) and + adjacent__cell_0__cell_0(cell_y__BLANK___BLANK_, + cell_y1__BLANK___BLANK_) and v0 = cell_x__BLANK___BLANK_ and + v1 = cell_y__BLANK___BLANK_ and v2 = cell_x1__BLANK___BLANK_ and + v3 = cell_y1__BLANK___BLANK_) or + ex cell_x__BLANK___BLANK_, cell_y__BLANK___BLANK_, cell_x1__BLANK___BLANK_, + cell_y__BLANK___BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_x__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y__BLANK___BLANK_) and + adjacent__cell_0__cell_0(cell_x__BLANK___BLANK_, + cell_x1__BLANK___BLANK_) and + coordinate__cell_0(cell_y__BLANK___BLANK_) and + v0 = cell_x__BLANK___BLANK_ and v1 = cell_y__BLANK___BLANK_ and + v2 = cell_x1__BLANK___BLANK_ and v3 = cell_y__BLANK___BLANK_) or + ex cell_x__BLANK___BLANK_, cell_y__BLANK___BLANK_, cell_x__BLANK___BLANK_, + cell_y1__BLANK___BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_y__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y1__BLANK___BLANK_) and + adjacent__cell_0__cell_0(cell_y__BLANK___BLANK_, + cell_y1__BLANK___BLANK_) and + coordinate__cell_0(cell_x__BLANK___BLANK_) and + v0 = cell_x__BLANK___BLANK_ and v1 = cell_y__BLANK___BLANK_ and + v2 = cell_x__BLANK___BLANK_ and v3 = cell_y1__BLANK___BLANK_)" + (result "adjacent_cell"); + assert_equal ~msg:"conn5__o defined relation translation" + ~printer:(fun x->x) + "conn5__o() = col__o() or diag1__o() or diag2__o() or row__o()" + (result "conn5__o"); + assert_equal ~msg:"col__o defined relation translation" + ~printer:(fun x->x) + "col__o() = ex cell_x_a__BLANK_, cell_x_b__BLANK_, cell_x_c__BLANK_, cell_x_d__BLANK_, + cell_x_e__BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_x_a__BLANK_) and + cell_2o(cell_x_a__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x_b__BLANK_) and + cell_2o(cell_x_b__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x_c__BLANK_) and + cell_2o(cell_x_c__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x_d__BLANK_) and + cell_2o(cell_x_d__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x_e__BLANK_) and + cell_2o(cell_x_e__BLANK_) and nextcol__cell_1__cell_1(cell_x_a__BLANK_, + cell_x_b__BLANK_) and nextcol__cell_1__cell_1(cell_x_b__BLANK_, + cell_x_c__BLANK_) and nextcol__cell_1__cell_1(cell_x_c__BLANK_, + cell_x_d__BLANK_) and nextcol__cell_1__cell_1(cell_x_d__BLANK_, + cell_x_e__BLANK_) and EQ___cell_0__cell_0(cell_x_a__BLANK_, + cell_x_b__BLANK_) and EQ___cell_0__cell_0(cell_x_a__BLANK_, + cell_x_c__BLANK_) and EQ___cell_0__cell_0(cell_x_a__BLANK_, + cell_x_d__BLANK_) and EQ___cell_0__cell_0(cell_x_a__BLANK_, + cell_x_e__BLANK_) and EQ___cell_0__cell_0(cell_x_b__BLANK_, + cell_x_a__BLANK_) and EQ___cell_0__cell_0(cell_x_b__BLANK_, + cell_x_c__BLANK_) and EQ___cell_0__cell_0(cell_x_b__BLANK_, + cell_x_d__BLANK_) and EQ___cell_0__cell_0(cell_x_b__BLANK_, + cell_x_e__BLANK_) and EQ___cell_0__cell_0(cell_x_c__BLANK_, + cell_x_a__BLANK_) and EQ___cell_0__cell_0(cell_x_c__BLANK_, + cell_x_b__BLANK_) and EQ___cell_0__cell_0(cell_x_c__BLANK_, + cell_x_d__BLANK_) and EQ___cell_0__cell_0(cell_x_c__BLANK_, + cell_x_e__BLANK_) and EQ___cell_0__cell_0(cell_x_d__BLANK_, + cell_x_a__BLANK_) and EQ___cell_0__cell_0(cell_x_d__BLANK_, + cell_x_b__BLANK_) and EQ___cell_0__cell_0(cell_x_d__BLANK_, + cell_x_c__BLANK_) and EQ___cell_0__cell_0(cell_x_d__BLANK_, + cell_x_e__BLANK_) and EQ___cell_0__cell_0(cell_x_e__BLANK_, + cell_x_a__BLANK_) and EQ___cell_0__cell_0(cell_x_e__BLANK_, + cell_x_b__BLANK_) and EQ___cell_0__cell_0(cell_x_e__BLANK_, + cell_x_c__BLANK_) and EQ___cell_0__cell_0(cell_x_e__BLANK_, + cell_x_d__BLANK_))" + (result "col__o"); ); ] @@ -174,28 +250,6 @@ () let a () = - let descr = load_rules ("./GGP/examples/connect5.gdl") in - let ground_at_f_paths, transl_data = connect5_data in - let clauses = GDL.expand_players descr in - let clauses = - GDL.ground_vars_at_paths ground_at_f_paths clauses in - let defined_rels, clauses = - GDL.elim_ground_args transl_data.defined_rels clauses in - (* {{{ log entry *) - if !TranslateFormula.debug_level > 2 then ( - Printf.printf "defined relations connect5: clauses =\n%s\n%!" - (String.concat "\n" (List.map GDL.clause_str clauses)) - ); - (* }}} *) - let transl_data = {transl_data with defined_rels = defined_rels} in - let defined_rels = - TranslateFormula.build_defrels transl_data clauses in - let res = String.concat "\n" - (List.map (fun (rel,(args,body)) -> - rel^"("^String.concat ", " args^ - ") = "^Formula.str body) defined_rels) in - assert_equal ~msg:"connect5 noop moves by players" - ~printer:(fun x->x) - "" res + () let exec = Aux.run_test_if_target "TranslateFormulaTest" tests This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-16 14:50:00
|
Revision: 1541 http://toss.svn.sourceforge.net/toss/?rev=1541&view=rev Author: lukstafi Date: 2011-08-16 14:49:54 +0000 (Tue, 16 Aug 2011) Log Message: ----------- GDL translation fixing: minor Prolog integration bugs, adding non-terminal-state condition to rules, minor move translation bugs. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml trunk/Toss/GGP/tests/connect5-raw.toss trunk/Toss/GGP/tests/connect5-simpl.toss trunk/Toss/GGP/tests/tictactoe-raw.toss trunk/Toss/GGP/tests/tictactoe-simpl.toss Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/GDL.ml 2011-08-16 14:49:54 UTC (rev 1541) @@ -235,6 +235,30 @@ (List.map (subst_one sb1) terms2) | _ -> raise Not_found + +(** A "blank" term. *) +let blank = Const "_BLANK_" + +(* Match terms on the left to ground terms on the right, ignoring + [Const "_BLANK_"] on the right. *) +let rec match_nonblank sb terms1 terms2 = + match terms1, terms2 with + | [], [] -> sb + | Const a::terms1, Const b::terms2 when a=b -> + match_nonblank sb terms1 terms2 + | Func (f,args1)::terms1, Func (g,args2)::terms2 when f=g -> + match_nonblank sb (Array.to_list args1 @ terms1) + (Array.to_list args2 @ terms2) + | _::terms1, Const "_BLANK_"::terms2 -> + match_nonblank sb terms1 terms2 + | Var x::terms1, c::terms2 -> + let sb1 = x, c in + match_nonblank (sb1::List.map (fun (x,t)->x, subst_one sb1 t) sb) + (List.map (subst_one sb1) terms1) + (List.map (subst_one sb1) terms2) + | _ -> raise Not_found + + let unify_args ?(sb=[]) args1 args2 = unify sb (Array.to_list args1) (Array.to_list args2) @@ -1422,10 +1446,7 @@ let pred_on_path_subterm path subterm = path_str path ^ term_to_name subterm -(** A "blank" term. *) -let blank = Const "_BLANK_" - (* [expand_path_vars_by prepare_lits p ts clauses] expands variables that have occurrences at path [p] in some state term of a clause (from which pre-processed literals are extracted by Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/GDL.mli 2011-08-16 14:49:54 UTC (rev 1541) @@ -62,6 +62,9 @@ type substitution = (string * term) list val unify : substitution -> term list -> term list -> substitution +(** Match terms on the left to ground terms on the right, ignoring + [Const "_BLANK_"] on the right. *) +val match_nonblank : substitution -> term list -> term list -> substitution val unify_all : substitution -> term list -> substitution val rels_unify : rel_atom -> rel_atom -> bool val subst : substitution -> term -> term Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-16 14:49:54 UTC (rev 1541) @@ -346,7 +346,7 @@ let tup = Array.of_list (List.map2 at_path etup ptup) in if rel = "EQ_" && arity = 2 && tup.(0) = tup.(1) || (* List.mem (rel, tup) static_base *) - run_prolog_check_atom (rel, tup) program + rel <> "EQ_" && run_prolog_check_atom (rel, tup) program then ( stable_rels := Aux.Strings.add fact_rel !stable_rels; Structure.add_rel_named_elems struc fact_rel @@ -967,6 +967,7 @@ (* {{{ log entry *) if !debug_level > 1 then ( Printf.printf "filter_rule_cands: generating states...\n%!"; + (* GDL.debug_level := 4; *) ); (* }}} *) let states = Aux.fold_n @@ -977,6 +978,7 @@ states @ acc) [] !playouts_for_rule_filtering in (* {{{ log entry *) if !debug_level > 1 then ( + (* GDL.debug_level := 0; *) Printf.printf "filter_rule_cands: generated %d states.\n%!" (List.length states) ); @@ -1132,7 +1134,10 @@ let case_precond = (* singleton disjunct, i.e. no disjunction *) TranslateFormula.translate transl_data [case_cond] in - let precond = Formula.And (synch_precond @ [case_precond]) in + (* a defined relation for checking game termination *) + let nonterminal = Formula.Not (Formula.Rel ("terminal", [||])) in + let precond = + Formula.And (nonterminal :: synch_precond @ [case_precond]) in (* {{{ log entry *) if !debug_level > 2 then ( Printf.printf "build_toss_rule: synch precond = %s; main precond = %s\n%!" @@ -1429,7 +1434,7 @@ let clauses = GDL.ground_vars_at_paths prepare_lits ground_at_f_paths clauses in let defined_rels = Aux.list_diff defined_rels - ["goal"; "legal"; "next"; "terminal"] in + ["goal"; "legal"; "next"] in let defined_rels, clauses = elim_ground_args defined_rels clauses in let next_cls = Aux.map_some (function @@ -1439,8 +1444,11 @@ clauses in (* For determining turn-based we could use the original program, but for filtering the rule candidates we need the transformed - clauses. *) - let program = preprocess_program clauses in + clauses. We restore the frame clauses. *) + let program = preprocess_program + (List.map (fun ((rel,args),body as cl)-> + if rel = "frame next" then ("next", args), body + else cl) clauses) in let turn_data = try Some (check_turn_based players program) with Not_turn_based -> None in @@ -1581,7 +1589,6 @@ ) fixed_inst in let precond = Formula.And (anchors @ [rdata.precond]) in (* {{{ log entry *) - if !debug_level > 2 then ( Printf.printf "GDL.translate_incoming_move: rule=%s; trying precond=\n%s\n...%!" @@ -1595,6 +1602,13 @@ ~emb_rels:fluents ~signat ~struc_elems:rdata.struc_elems in let lhs_struc = rule.DiscreteRule.lhs_struc in let rule = DiscreteRule.compile_rule signat [] rule in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf + "GDL.translate_incoming_move: struc=\n%s\n%!" + (Structure.str struc) + ); + (* }}} *) let asgns = DiscreteRule.find_matchings struc rule in (* {{{ log entry *) @@ -1781,10 +1795,18 @@ let sb = try List.fold_left (fun sb (v_term, e_term) -> - unify sb [e_term] [v_term]) [] emb - with Not_found -> failwith - ("GDL.translate_outgoing_move: inconsistent match for rule " - ^rname) in + match_nonblank sb [v_term] [e_term]) [] emb + with Not_found -> + (* {{{ log entry *) + if !debug_level > 0 then ( + Printf.printf "translate_outgoing_move: inconsistent sb: %s\n%!" + (String.concat "; "(List.map (fun (vt, et) -> + term_str vt ^"<-"^term_str et) emb)) + ); + (* }}} *) + failwith + ("GDL.translate_outgoing_move: inconsistent match for rule " + ^rname) in let legal_term = if Array.length tossrule.legal_tuple > 1 then tossrule.legal_tuple.(gdl.playing_as) Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-16 14:49:54 UTC (rev 1541) @@ -50,18 +50,15 @@ let game = load_rules ("./GGP/examples/"^game_name^".gdl") in let gdl, res = TranslateGame.translate_game ~playing_as:(Const player) game in - let goal_name = - (*if !GDL.prune_rulecands_at = GDL.Never - then game_name^"-simpl-unpruned.toss" - else if !GDL.prune_rulecands_at = GDL.After_simpl - then game_name^"-simpl-pruned.toss" - else *) game_name^"-simpl.toss" in - let goal = state_of_file ("./GGP/tests/"^goal_name) in + let goal_name = game_name^"-simpl.toss" in + (* let goal = state_of_file ("./GGP/tests/"^goal_name) in *) + let goal_str = Aux.input_file (open_in ("./GGP/tests/"^goal_name)) in let resf = open_out ("./GGP/tests/"^game_name^"-temp.toss") in let res_str = Arena.state_str res in output_string resf res_str; close_out resf; - let eq, msg = Arena.compare_diff goal res in + (* let eq, msg = Arena.compare_diff goal res in *) + let eq, msg = goal_str = res_str, "sorry, just comparing as strings" in assert_bool ("GGP/examples/"^game_name^".gdl to GGP/tests/"^goal_name^ ", see GGP/tests/"^game_name^"-temp.toss: "^msg) @@ -99,15 +96,15 @@ (fun () -> game_test_case ~game_name:"tictactoe" ~player:"xplayer" ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"mark_x64_y19_0" + ~loc0_rule_name:"mark_x6_y_noop" ~loc0_emb:[ - "cell_x64_y19__blank_", "cell_2_2_MV1"; - "control__blank_", "control_MV1"] + "cell_x6_y__BLANK_", "cell_2_2__BLANK_"; + "control__BLANK_", "control__BLANK_"] ~loc0_move:"(mark 2 2)" ~loc0_noop:"noop" - ~loc1:1 ~loc1_rule_name:"mark_x71_y26_1" + ~loc1:1 ~loc1_rule_name:"noop_mark_x7_y0" ~loc1_emb:[ - "cell_x71_y26__blank_", "cell_1_1_MV1"; - "control__blank_", "control_MV1"] + "cell_x7_y0__BLANK_", "cell_1_1__BLANK_"; + "control__BLANK_", "control__BLANK_"] ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)" ); @@ -175,7 +172,7 @@ "control__blank_", "control_MV1"] ~loc1_noop:"noop" ~loc1_move:"(mark f g)" ); - +(* "breakthrough" >:: (fun () -> game_test_case ~game_name:"breakthrough" ~player:"white" @@ -214,10 +211,11 @@ "control__blank_", "control_MV1"] ~loc1_noop:"noop" ~loc1_move:"(mark f g)" ); +*) ] let a () = - GDL.debug_level := 2; + (* GDL.debug_level := 4; *) TranslateGame.debug_level := 4; GameSimpl.debug_level := 4; DiscreteRule.debug_level := 4; @@ -225,18 +223,18 @@ let a () = - game_test_case ~game_name:"connect5" ~player:"x" + game_test_case ~game_name:"tictactoe" ~player:"xplayer" ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"mark_x161_y162_0" + ~loc0_rule_name:"mark_x6_y_noop" ~loc0_emb:[ - "cell_x161_y162__blank_", "cell_e_f_MV1"; - "control__blank_", "control_MV1"] - ~loc0_move:"(mark e f)" ~loc0_noop:"noop" - ~loc1:1 ~loc1_rule_name:"mark_x175_y176_1" + "cell_x6_y__BLANK_", "cell_2_2__BLANK_"; + "control__BLANK_", "control__BLANK_"] + ~loc0_move:"(mark 2 2)" ~loc0_noop:"noop" + ~loc1:1 ~loc1_rule_name:"noop_mark_x7_y0" ~loc1_emb:[ - "cell_x175_y176__blank_", "cell_f_g_MV1"; - "control__blank_", "control_MV1"] - ~loc1_noop:"noop" ~loc1_move:"(mark f g)" + "cell_x7_y0__BLANK_", "cell_1_1__BLANK_"; + "control__BLANK_", "control__BLANK_"] + ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)" let a () = @@ -272,7 +270,7 @@ TranslateGame.generate_test_case := None let a () = - regenerate ~debug:true ~game_name:"tictactoe" ~player:"xplayer"; + regenerate ~debug:false ~game_name:"tictactoe" ~player:"xplayer"; (* regenerate ~debug:false ~game_name:"connect5" ~player:"x"; *) (* regenerate ~debug:true ~game_name:"breakthrough" ~player:"white"; *) (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *) Modified: trunk/Toss/GGP/tests/connect5-raw.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-raw.toss 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/tests/connect5-raw.toss 2011-08-16 14:49:54 UTC (rev 1541) @@ -408,6 +408,9 @@ cell__BLANK___BLANK___BLANK_(cell_d_y8__BLANK_) and cell_2x(cell_e_y8__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_e_y8__BLANK_)) +REL terminal() = + (true and not exists_empty_cell() and true) or + (true and exists_line_of_five() and true) PLAYERS x, o RULE mark_x5_y5_noop: [cell_x5_y5__BLANK_, control__BLANK_ | @@ -422,7 +425,7 @@ ] -> [cell_x5_y5__BLANK_, control__BLANK_ | cell_2x (cell_x5_y5__BLANK_); control_0o (control__BLANK_) | - ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x + ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x pre not terminal() RULE noop_mark_x6_y6: [cell_x6_y6__BLANK_, control__BLANK_ | _opt_cell_2b (control__BLANK_); @@ -436,7 +439,7 @@ ] -> [cell_x6_y6__BLANK_, control__BLANK_ | cell_2o (cell_x6_y6__BLANK_); control_0x (control__BLANK_) | - ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x + ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x pre not terminal() LOC 0 { PLAYER x { Modified: trunk/Toss/GGP/tests/connect5-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/connect5-simpl.toss 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/tests/connect5-simpl.toss 2011-08-16 14:49:54 UTC (rev 1541) @@ -204,6 +204,7 @@ not control__BLANK_(cell_c1_y8__BLANK_) and not control__BLANK_(cell_d_y8__BLANK_) and not control__BLANK_(cell_e_y8__BLANK_)) +REL terminal() = exists_line_of_five() or not exists_empty_cell() PLAYERS x, o DATA R2: EQ___cell_1__cell_1__AND__nextcol__cell_0__cell_0, R0: nextcol__cell_0__cell_0__AND__nextcol__cell_1__cell_1, @@ -221,7 +222,7 @@ ] -> [cell_x5_y5__BLANK_, control__BLANK_ | cell_2x (cell_x5_y5__BLANK_); control_0o (control__BLANK_) | - ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x + ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x pre not terminal() RULE noop_mark_x6_y6: [cell_x6_y6__BLANK_, control__BLANK_ | _opt_cell_2b (control__BLANK_); @@ -234,7 +235,7 @@ ] -> [cell_x6_y6__BLANK_, control__BLANK_ | cell_2o (cell_x6_y6__BLANK_); control_0x (control__BLANK_) | - ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x + ] emb cell_2b, cell_2o, cell_2x, control_0o, control_0x pre not terminal() LOC 0 { PLAYER x { PAYOFF 100. * :(conn5__x()) + 50. * :(not exists_line_of_five()) Modified: trunk/Toss/GGP/tests/tictactoe-raw.toss =================================================================== --- trunk/Toss/GGP/tests/tictactoe-raw.toss 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/tests/tictactoe-raw.toss 2011-08-16 14:49:54 UTC (rev 1541) @@ -186,6 +186,9 @@ cell__BLANK___BLANK___BLANK_(cell_m4_2__BLANK_) and cell_13(cell_m4_3__BLANK_) and cell_2x(cell_m4_3__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_m4_3__BLANK_)) +REL terminal() = + (true and not open() and true) or (true and line__o() and true) or + (true and line__x() and true) PLAYERS xplayer, oplayer RULE mark_x6_y_noop: [cell_x6_y__BLANK_, control__BLANK_ | @@ -202,23 +205,7 @@ cell_2x (cell_x6_y__BLANK_); control_0oplayer (control__BLANK_) | ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer -RULE mark_x6_y_noop0: - [cell_x6_y__BLANK_, control__BLANK_ | - _opt_cell_2b (control__BLANK_); - _opt_cell_2o {cell_x6_y__BLANK_; control__BLANK_}; - _opt_cell_2x {cell_x6_y__BLANK_; control__BLANK_}; - _opt_control_0oplayer (cell_x6_y__BLANK_); - _opt_control_0xplayer (cell_x6_y__BLANK_); cell_2b (cell_x6_y__BLANK_); - cell__BLANK___BLANK___BLANK_ (cell_x6_y__BLANK_); - control_0oplayer (control__BLANK_); control_0xplayer (control__BLANK_); - control__BLANK_ (control__BLANK_) - | - ] -> - [cell_x6_y__BLANK_, control__BLANK_ | - cell_2x (cell_x6_y__BLANK_); control_0oplayer (control__BLANK_); - control_0xplayer (control__BLANK_) - | - ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer + pre not terminal() RULE noop_mark_x7_y0: [cell_x7_y0__BLANK_, control__BLANK_ | _opt_cell_2b (control__BLANK_); @@ -234,23 +221,7 @@ cell_2o (cell_x7_y0__BLANK_); control_0xplayer (control__BLANK_) | ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer -RULE noop_mark_x7_y00: - [cell_x7_y0__BLANK_, control__BLANK_ | - _opt_cell_2b (control__BLANK_); - _opt_cell_2o {cell_x7_y0__BLANK_; control__BLANK_}; - _opt_cell_2x {cell_x7_y0__BLANK_; control__BLANK_}; - _opt_control_0oplayer (cell_x7_y0__BLANK_); - _opt_control_0xplayer (cell_x7_y0__BLANK_); cell_2b (cell_x7_y0__BLANK_); - cell__BLANK___BLANK___BLANK_ (cell_x7_y0__BLANK_); - control_0oplayer (control__BLANK_); control_0xplayer (control__BLANK_); - control__BLANK_ (control__BLANK_) - | - ] -> - [cell_x7_y0__BLANK_, control__BLANK_ | - cell_2o (cell_x7_y0__BLANK_); control_0oplayer (control__BLANK_); - control_0xplayer (control__BLANK_) - | - ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer + pre not terminal() LOC 0 { PLAYER xplayer { @@ -258,7 +229,7 @@ 100. * :((true and line__x() and true)) + 50. * :((true and not line__x() and not line__o() and not open() and true)) - MOVES [mark_x6_y_noop -> 1]; [mark_x6_y_noop0 -> 1] } + MOVES [mark_x6_y_noop -> 1] } PLAYER oplayer { PAYOFF 100. * :((true and line__o() and true)) + @@ -279,7 +250,7 @@ 100. * :((true and line__o() and true)) + 50. * :((true and not line__x() and not line__o() and not open() and true)) - MOVES [noop_mark_x7_y0 -> 0]; [noop_mark_x7_y00 -> 0] } + MOVES [noop_mark_x7_y0 -> 0] } } MODEL [cell_1_1__BLANK_, cell_1_2__BLANK_, cell_1_3__BLANK_, cell_2_1__BLANK_, Modified: trunk/Toss/GGP/tests/tictactoe-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/tictactoe-simpl.toss 2011-08-16 11:29:29 UTC (rev 1540) +++ trunk/Toss/GGP/tests/tictactoe-simpl.toss 2011-08-16 14:49:54 UTC (rev 1541) @@ -115,6 +115,7 @@ v0 = cell_m4_1__BLANK_ and not control__BLANK_(cell_m4_1__BLANK_) and not control__BLANK_(cell_m4_2__BLANK_) and not control__BLANK_(cell_m4_3__BLANK_)) +REL terminal() = line__o() or line__x() or not open() PLAYERS xplayer, oplayer DATA R3: cell_03__AND__cell_11, R2: cell_01__AND__cell_13, R1: cell_03__AND__cell_13, R0: cell_02__AND__cell_12, @@ -133,22 +134,7 @@ cell_2x (cell_x6_y__BLANK_); control_0oplayer (control__BLANK_) | ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer -RULE mark_x6_y_noop0: - [cell_x6_y__BLANK_, control__BLANK_ | - _opt_cell_2b (control__BLANK_); - _opt_cell_2o {cell_x6_y__BLANK_; control__BLANK_}; - _opt_cell_2x {cell_x6_y__BLANK_; control__BLANK_}; - _opt_control_0oplayer (cell_x6_y__BLANK_); - _opt_control_0xplayer (cell_x6_y__BLANK_); cell_2b (cell_x6_y__BLANK_); - control_0oplayer (control__BLANK_); control_0xplayer (control__BLANK_); - control__BLANK_ (control__BLANK_) - | - ] -> - [cell_x6_y__BLANK_, control__BLANK_ | - cell_2x (cell_x6_y__BLANK_); control_0oplayer (control__BLANK_); - control_0xplayer (control__BLANK_) - | - ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer + pre not terminal() RULE noop_mark_x7_y0: [cell_x7_y0__BLANK_, control__BLANK_ | _opt_cell_2b (control__BLANK_); @@ -163,29 +149,14 @@ cell_2o (cell_x7_y0__BLANK_); control_0xplayer (control__BLANK_) | ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer -RULE noop_mark_x7_y00: - [cell_x7_y0__BLANK_, control__BLANK_ | - _opt_cell_2b (control__BLANK_); - _opt_cell_2o {cell_x7_y0__BLANK_; control__BLANK_}; - _opt_cell_2x {cell_x7_y0__BLANK_; control__BLANK_}; - _opt_control_0oplayer (cell_x7_y0__BLANK_); - _opt_control_0xplayer (cell_x7_y0__BLANK_); cell_2b (cell_x7_y0__BLANK_); - control_0oplayer (control__BLANK_); control_0xplayer (control__BLANK_); - control__BLANK_ (control__BLANK_) - | - ] -> - [cell_x7_y0__BLANK_, control__BLANK_ | - cell_2o (cell_x7_y0__BLANK_); control_0oplayer (control__BLANK_); - control_0xplayer (control__BLANK_) - | - ] emb cell_2b, cell_2o, cell_2x, control_0oplayer, control_0xplayer + pre not terminal() LOC 0 { PLAYER xplayer { PAYOFF 100. * :(line__x()) + 50. * :((not line__o() and not line__x() and not open())) - MOVES [mark_x6_y_noop -> 1]; [mark_x6_y_noop0 -> 1] } + MOVES [mark_x6_y_noop -> 1] } PLAYER oplayer { PAYOFF 100. * :(line__o()) + @@ -203,7 +174,7 @@ PAYOFF 100. * :(line__o()) + 50. * :((not line__o() and not line__x() and not open())) - MOVES [noop_mark_x7_y0 -> 0]; [noop_mark_x7_y00 -> 0] } + MOVES [noop_mark_x7_y0 -> 0] } } MODEL [cell_1_1__BLANK_, cell_1_2__BLANK_, cell_1_3__BLANK_, cell_2_1__BLANK_, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-08-27 09:44:54
|
Revision: 1545 http://toss.svn.sourceforge.net/toss/?rev=1545&view=rev Author: lukstafi Date: 2011-08-27 09:44:45 +0000 (Sat, 27 Aug 2011) Log Message: ----------- GDL translation fixing: also simplify precondition stored in data for move translation. GameSimpl: remove undefined relations (replace with Or []), process additional formulas (assuming they do not introduce additional simplification data). Connect4: preconditions have redundant parts but too difficult to simplify. Modified Paths: -------------- trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/GameSimpl.mli trunk/Toss/GGP/GameSimplTest.ml trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml Added Paths: ----------- trunk/Toss/GGP/tests/connect4-raw.toss trunk/Toss/GGP/tests/connect4-simpl.toss Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-08-26 14:33:35 UTC (rev 1544) +++ trunk/Toss/GGP/GameSimpl.ml 2011-08-27 09:44:45 UTC (rev 1545) @@ -14,6 +14,11 @@ instead of [DiscreteRule.special_rel_of rel <> None]? (To protect against GDL using identifiers starting with underscore.) + (0) Cleanup. + + (0a) Replace relations missing from the structure and defined + relations list, with "false", i.e. [Or []]. + (1) Reduce equivalent or complement relations. (1a) If [introduce_complement] is on, for each (unary) predicate @@ -145,7 +150,11 @@ module Tups = Structure.Tuples -let simplify ?(keep_nonempty_predicates=true) (game, state) = +let map_all_formulas f more_formulas game = + Aux.StrMap.map f more_formulas, + Arena.map_to_formulas f game + +let simplify ?(keep_nonempty_predicates=true) ~more_formulas (game, state) = (* {{{ log entry *) if !debug_level > 0 then ( Printf.printf "GameSimpl: defined_rels = %s\n%!" @@ -165,13 +174,24 @@ (String.concat ", " (Aux.Strings.elements fluents)) ); (* }}} *) + (* 0 *) + let present_rel rel = + List.mem_assoc rel signat || + List.mem_assoc rel game.Arena.defined_rels in + let remove_absent = FormulaOps.map_formula + {FormulaOps.identity_map with FormulaOps.map_Rel = + fun rel args -> + if present_rel rel then Formula.Rel (rel, args) + else Formula.Or []} in + let more_formulas, game = + map_all_formulas remove_absent more_formulas game in (* 1 *) let add_rel rel acc = match rel with | Rel (rel,_) -> Aux.Strings.add rel acc | _ -> acc in let used_rels = - Arena.fold_over_formulas ~include_defined_rels:false + Arena.fold_over_formulas ~include_defined_rels:false (* FIXME: why? *) (FormulaOps.fold_over_atoms add_rel) game Aux.Strings.empty in let complemented = ref [] in @@ -314,8 +334,9 @@ if neg then Not (Rel (orig, args)) else Rel (orig, args) else phi | phi -> phi in - let game = - Arena.map_to_formulas (FormulaOps.map_to_atoms repl_equiv) game in + let more_formulas, game = + map_all_formulas (FormulaOps.map_to_atoms repl_equiv) + more_formulas game in let state = {state with Arena.struc = Structure.clear_rels struc removable} in (* Also have to apply to LHS structures... Don't use @@ -448,8 +469,9 @@ List.mem_assoc rel2 game.Arena.defined_rels) && included_in rel1 rel2 | _ -> false in - let game = - Arena.map_to_formulas (FormulaOps.remove_redundant ~implies) game in + let more_formulas, game = + map_all_formulas (FormulaOps.remove_redundant ~implies) + more_formulas game in (* 3 *) let intersect_rels struc grel rels = @@ -647,8 +669,8 @@ let res = glue_phi (Formula.flatten_sort phi) in if old_used_rels == !used_rels then res else glue_fixpoint res in - let game = - Arena.map_to_formulas glue_fixpoint game in + let more_formulas, game = + map_all_formulas glue_fixpoint more_formulas game in (* 3e *) let more_data = Aux.map_some (fun (crel, orig_rel) -> @@ -885,4 +907,4 @@ Structure.add_rel_name rel arity struc) struc signat in Structure.clear_rels struc clear_rel) (game, state) in - game, state + more_formulas, (game, state) Modified: trunk/Toss/GGP/GameSimpl.mli =================================================================== --- trunk/Toss/GGP/GameSimpl.mli 2011-08-26 14:33:35 UTC (rev 1544) +++ trunk/Toss/GGP/GameSimpl.mli 2011-08-27 09:44:45 UTC (rev 1545) @@ -12,4 +12,6 @@ val simplify : ?keep_nonempty_predicates:bool -> - Arena.game * Arena.game_state -> Arena.game * Arena.game_state + more_formulas:Formula.formula Aux.StrMap.t -> + Arena.game * Arena.game_state -> + Formula.formula Aux.StrMap.t * (Arena.game * Arena.game_state) Modified: trunk/Toss/GGP/GameSimplTest.ml =================================================================== --- trunk/Toss/GGP/GameSimplTest.ml 2011-08-26 14:33:35 UTC (rev 1544) +++ trunk/Toss/GGP/GameSimplTest.ml 2011-08-27 09:44:45 UTC (rev 1545) @@ -13,7 +13,8 @@ "connect5" >:: (fun () -> let connect5 = state_of_file "./GGP/tests/connect5-raw.toss" in - let res = GameSimpl.simplify connect5 in + let _, res = + GameSimpl.simplify ~more_formulas:Aux.StrMap.empty connect5 in let goal = state_of_file "./GGP/tests/connect5-simpl.toss" in let resf = open_out "./GGP/tests/connect5-temp.toss" in let res_str = Arena.state_str res in @@ -30,7 +31,8 @@ "breakthrough" >:: (fun () -> let breakthrough = state_of_file "./GGP/tests/breakthrough-raw.toss" in - let res = GameSimpl.simplify breakthrough in + let _, res = + GameSimpl.simplify ~more_formulas:Aux.StrMap.empty breakthrough in let goal = state_of_file "./GGP/tests/breakthrough-simpl.toss" in let resf = open_out "./GGP/tests/breakthrough-temp.toss" in let res_str = Arena.state_str res in @@ -67,7 +69,8 @@ let game = state_of_file ("./GGP/tests/"^game_name^"-raw.toss") in Printf.printf "\nINPUT:\n%s\n%!" (Arena.state_str game); (* GameSimpl.debug_level := 5; *) - let res = GameSimpl.simplify game in + let _, res = + GameSimpl.simplify ~more_formulas:Aux.StrMap.empty game in let resf = open_out ("./GGP/tests/"^game_name^"-simpl.toss") in let res_str = Arena.state_str res in output_string resf res_str; @@ -78,7 +81,8 @@ let a () = GameSimpl.debug_level := 5; let connect5 = state_of_file "./GGP/tests/connect5-raw.toss" in - let res = GameSimpl.simplify connect5 in + let _, res = + GameSimpl.simplify ~more_formulas:Aux.StrMap.empty connect5 in let goal = state_of_file "./GGP/tests/connect5-simpl.toss" in let resf = open_out "./GGP/tests/connect5-temp.toss" in let res_str = Arena.state_str res in Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-08-26 14:33:35 UTC (rev 1544) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-27 09:44:45 UTC (rev 1545) @@ -1655,8 +1655,22 @@ ); (* }}} *) let tossrule_data = Aux.strmap_of_assoc tossrule_data in + let tossrule_preconds = + Aux.StrMap.map (fun rdata->rdata.precond) tossrule_data in let playing_as = Aux.array_argfind (fun x -> x = playing_as) players in + (match !generate_test_case with + | None -> () + | Some game_name -> + let file = open_out ("./GGP/tests/"^game_name^"-raw.toss") in + output_string file (Arena.state_str result); + flush file; close_out file); + let tossrule_preconds, result = + GameSimpl.simplify ~more_formulas:tossrule_preconds result in + let tossrule_data = Aux.StrMap.mapi + (fun rname rdata-> + {rdata with precond = Aux.StrMap.find rname tossrule_preconds}) + tossrule_data in let gdl_translation = { (* map between structure elements and their term representations; the reverse direction is by using element names *) @@ -1674,13 +1688,6 @@ (match !generate_test_case with | None -> () | Some game_name -> - let file = open_out ("./GGP/tests/"^game_name^"-raw.toss") in - output_string file (Arena.state_str result); - flush file; close_out file); - let result = GameSimpl.simplify result in - (match !generate_test_case with - | None -> () - | Some game_name -> let file = open_out ("./GGP/tests/"^game_name^"-simpl.toss") in output_string file (Arena.state_str result); flush file; close_out file); Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-08-26 14:33:35 UTC (rev 1544) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-27 09:44:45 UTC (rev 1545) @@ -193,23 +193,18 @@ "connect4" >:: (fun () -> - (* Although the translation works, its quality is not good - enough to warrant testing. *) - todo "implement handling defined relations first"; - (* TODO: finish adapting the test after game is - cleanly translated. *) game_test_case ~game_name:"connect4" ~player:"white" ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"drop_???_0" + ~loc0_rule_name:"drop_c11_noop" ~loc0_emb:[ - "cell_x_y__blank_", "cell_2_1_MV1"; - "control__blank_", "control_MV1"] + "cell_c11_h4__BLANK_", "cell_2_1__BLANK_"; + "control__BLANK_", "control__BLANK_"] ~loc0_move:"(drop 2)" ~loc0_noop:"noop" - ~loc1:1 ~loc1_rule_name:"drop_???_1" + ~loc1:1 ~loc1_rule_name:"noop_drop_c12" ~loc1_emb:[ - "cell_x_y__blank_", "cell_f_g_MV1"; - "control__blank_", "control_MV1"] - ~loc1_noop:"noop" ~loc1_move:"(mark f g)" + "cell_c12_h6__BLANK_", "cell_2_1__BLANK_"; + "control__BLANK_", "control__BLANK_"] + ~loc1_noop:"noop" ~loc1_move:"(drop 2)" ); ] @@ -224,20 +219,18 @@ let a () = - game_test_case ~game_name:"breakthrough" ~player:"white" + game_test_case ~game_name:"connect4" ~player:"white" ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"move_x2_y3_x3_y4_noop" + ~loc0_rule_name:"drop_c11_noop" ~loc0_emb:[ - "cellholds_x2_y3__BLANK_", "cellholds_2_2__BLANK_"; - "cellholds_x3_y4__BLANK_", "cellholds_1_3__BLANK_"; + "cell_c11_h4__BLANK_", "cell_2_1__BLANK_"; "control__BLANK_", "control__BLANK_"] - ~loc0_move:"(move 2 2 1 3)" ~loc0_noop:"noop" ~loc1:1 - ~loc1_rule_name:"noop_move_x7_y9_x8_y10" + ~loc0_move:"(drop 2)" ~loc0_noop:"noop" + ~loc1:1 ~loc1_rule_name:"noop_drop_c12" ~loc1_emb:[ - "cellholds_x7_y9__blank_", "cellholds_7_7__BLANK_"; - "cellholds_x8_y10__blank_", "cellholds_6_6__BLANK_"; + "cell_c12_h6__BLANK_", "cell_2_1__BLANK_"; "control__BLANK_", "control__BLANK_"] - ~loc1_noop:"noop" ~loc1_move:"(move 7 7 6 6)" + ~loc1_noop:"noop" ~loc1_move:"(drop 2)" let a () = @@ -275,9 +268,9 @@ let a () = (* regenerate ~debug:false ~game_name:"tictactoe" ~player:"xplayer"; *) (* regenerate ~debug:false ~game_name:"connect5" ~player:"x"; *) - regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; + (* regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; *) (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *) - (* regen_with_debug ~game_name:"connect4" ~player:"white"; *) + regenerate ~debug:false ~game_name:"connect4" ~player:"white"; (* failwith "generated"; *) () Added: trunk/Toss/GGP/tests/connect4-raw.toss =================================================================== --- trunk/Toss/GGP/tests/connect4-raw.toss (rev 0) +++ trunk/Toss/GGP/tests/connect4-raw.toss 2011-08-27 09:44:45 UTC (rev 1545) @@ -0,0 +1,3116 @@ +REL row__w() = + ex cell_x0_y4__BLANK_, cell_x1_y4__BLANK_, cell_x2_y4__BLANK_, + cell_x3_y4__BLANK_ + (succ__cell_0__cell_0(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + succ__cell_0__cell_0(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + succ__cell_0__cell_0(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x2_y4__BLANK_) and + cell_2w(cell_x0_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x0_y4__BLANK_) and + cell_2w(cell_x1_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1_y4__BLANK_) and + cell_2w(cell_x2_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x2_y4__BLANK_) and + cell_2w(cell_x3_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x3_y4__BLANK_)) +REL row__r() = + ex cell_x0_y4__BLANK_, cell_x1_y4__BLANK_, cell_x2_y4__BLANK_, + cell_x3_y4__BLANK_ + (succ__cell_0__cell_0(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + succ__cell_0__cell_0(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + succ__cell_0__cell_0(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x2_y4__BLANK_) and + cell_2r(cell_x0_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x0_y4__BLANK_) and + cell_2r(cell_x1_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1_y4__BLANK_) and + cell_2r(cell_x2_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x2_y4__BLANK_) and + cell_2r(cell_x3_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x3_y4__BLANK_)) +REL row__dirt() = + ex cell_x0_y4__BLANK_, cell_x1_y4__BLANK_, cell_x2_y4__BLANK_, + cell_x3_y4__BLANK_ + (succ__cell_0__cell_0(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + succ__cell_0__cell_0(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + succ__cell_0__cell_0(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x2_y4__BLANK_) and + cell_2dirt(cell_x0_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x0_y4__BLANK_) and + cell_2dirt(cell_x1_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1_y4__BLANK_) and + cell_2dirt(cell_x2_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x2_y4__BLANK_) and + cell_2dirt(cell_x3_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x3_y4__BLANK_)) +REL row__b() = + ex cell_x0_y4__BLANK_, cell_x1_y4__BLANK_, cell_x2_y4__BLANK_, + cell_x3_y4__BLANK_ + (succ__cell_0__cell_0(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + succ__cell_0__cell_0(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + succ__cell_0__cell_0(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x0_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x2_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x1_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x2_y4__BLANK_, cell_x3_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x0_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x1_y4__BLANK_) and + EQ___cell_1__cell_1(cell_x3_y4__BLANK_, cell_x2_y4__BLANK_) and + cell_2b(cell_x0_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x0_y4__BLANK_) and + cell_2b(cell_x1_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x1_y4__BLANK_) and + cell_2b(cell_x2_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x2_y4__BLANK_) and + cell_2b(cell_x3_y4__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x3_y4__BLANK_)) +REL filled(v0) = + ex cell_c0_h0__BLANK_ + (v0 = cell_c0_h0__BLANK_ and + true and + cell_2dirt(cell_c0_h0__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c0_h0__BLANK_)) or + ex cell_c1_h1__BLANK_ + (v0 = cell_c1_h1__BLANK_ and + true and + cell_2w(cell_c1_h1__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c1_h1__BLANK_)) or + ex cell_c2_h2__BLANK_ + (v0 = cell_c2_h2__BLANK_ and + true and + cell_2r(cell_c2_h2__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c2_h2__BLANK_)) +REL empty(v0) = + ex cell_c_h__BLANK_ + (v0 = cell_c_h__BLANK_ and + true and + cell_2b(cell_c_h__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c_h__BLANK_)) +REL diag__w() = + ex cell_x5_y9__BLANK_, cell_x6_y10__BLANK_, cell_x7_y11__BLANK_, + cell_x8_y12__BLANK_ + (succ__cell_0__cell_0(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_1__cell_1(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_0__cell_0(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_1__cell_1(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_0__cell_0(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + succ__cell_1__cell_1(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + cell_2w(cell_x5_y9__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x5_y9__BLANK_) and + cell_2w(cell_x6_y10__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x6_y10__BLANK_) and + cell_2w(cell_x7_y11__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x7_y11__BLANK_) and + cell_2w(cell_x8_y12__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x8_y12__BLANK_)) or + ex cell_x9_y13__BLANK_, cell_x10_y14__BLANK_, cell_x11_y15__BLANK_, + cell_x12_y16__BLANK_ + (succ__cell_0__cell_0(cell_x9_y13__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_1__cell_1(cell_x10_y14__BLANK_, cell_x9_y13__BLANK_) and + succ__cell_0__cell_0(cell_x10_y14__BLANK_, cell_x11_y15__BLANK_) and + succ__cell_1__cell_1(cell_x11_y15__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_0__cell_0(cell_x11_y15__BLANK_, cell_x12_y16__BLANK_) and + succ__cell_1__cell_1(cell_x12_y16__BLANK_, cell_x11_y15__BLANK_) and + cell_2w(cell_x9_y13__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x9_y13__BLANK_) and + cell_2w(cell_x10_y14__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x10_y14__BLANK_) and + cell_2w(cell_x11_y15__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x11_y15__BLANK_) and + cell_2w(cell_x12_y16__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x12_y16__BLANK_)) +REL diag__r() = + ex cell_x5_y9__BLANK_, cell_x6_y10__BLANK_, cell_x7_y11__BLANK_, + cell_x8_y12__BLANK_ + (succ__cell_0__cell_0(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_1__cell_1(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_0__cell_0(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_1__cell_1(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_0__cell_0(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + succ__cell_1__cell_1(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + cell_2r(cell_x5_y9__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x5_y9__BLANK_) and + cell_2r(cell_x6_y10__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x6_y10__BLANK_) and + cell_2r(cell_x7_y11__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x7_y11__BLANK_) and + cell_2r(cell_x8_y12__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x8_y12__BLANK_)) or + ex cell_x9_y13__BLANK_, cell_x10_y14__BLANK_, cell_x11_y15__BLANK_, + cell_x12_y16__BLANK_ + (succ__cell_0__cell_0(cell_x9_y13__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_1__cell_1(cell_x10_y14__BLANK_, cell_x9_y13__BLANK_) and + succ__cell_0__cell_0(cell_x10_y14__BLANK_, cell_x11_y15__BLANK_) and + succ__cell_1__cell_1(cell_x11_y15__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_0__cell_0(cell_x11_y15__BLANK_, cell_x12_y16__BLANK_) and + succ__cell_1__cell_1(cell_x12_y16__BLANK_, cell_x11_y15__BLANK_) and + cell_2r(cell_x9_y13__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x9_y13__BLANK_) and + cell_2r(cell_x10_y14__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x10_y14__BLANK_) and + cell_2r(cell_x11_y15__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x11_y15__BLANK_) and + cell_2r(cell_x12_y16__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x12_y16__BLANK_)) +REL diag__dirt() = + ex cell_x5_y9__BLANK_, cell_x6_y10__BLANK_, cell_x7_y11__BLANK_, + cell_x8_y12__BLANK_ + (succ__cell_0__cell_0(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_1__cell_1(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_0__cell_0(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_1__cell_1(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_0__cell_0(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + succ__cell_1__cell_1(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + cell_2dirt(cell_x5_y9__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x5_y9__BLANK_) and + cell_2dirt(cell_x6_y10__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x6_y10__BLANK_) and + cell_2dirt(cell_x7_y11__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x7_y11__BLANK_) and + cell_2dirt(cell_x8_y12__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x8_y12__BLANK_)) or + ex cell_x9_y13__BLANK_, cell_x10_y14__BLANK_, cell_x11_y15__BLANK_, + cell_x12_y16__BLANK_ + (succ__cell_0__cell_0(cell_x9_y13__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_1__cell_1(cell_x10_y14__BLANK_, cell_x9_y13__BLANK_) and + succ__cell_0__cell_0(cell_x10_y14__BLANK_, cell_x11_y15__BLANK_) and + succ__cell_1__cell_1(cell_x11_y15__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_0__cell_0(cell_x11_y15__BLANK_, cell_x12_y16__BLANK_) and + succ__cell_1__cell_1(cell_x12_y16__BLANK_, cell_x11_y15__BLANK_) and + cell_2dirt(cell_x9_y13__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x9_y13__BLANK_) and + cell_2dirt(cell_x10_y14__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x10_y14__BLANK_) and + cell_2dirt(cell_x11_y15__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x11_y15__BLANK_) and + cell_2dirt(cell_x12_y16__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x12_y16__BLANK_)) +REL diag__b() = + ex cell_x5_y9__BLANK_, cell_x6_y10__BLANK_, cell_x7_y11__BLANK_, + cell_x8_y12__BLANK_ + (succ__cell_0__cell_0(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_1__cell_1(cell_x5_y9__BLANK_, cell_x6_y10__BLANK_) and + succ__cell_0__cell_0(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_1__cell_1(cell_x6_y10__BLANK_, cell_x7_y11__BLANK_) and + succ__cell_0__cell_0(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + succ__cell_1__cell_1(cell_x7_y11__BLANK_, cell_x8_y12__BLANK_) and + cell_2b(cell_x5_y9__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x5_y9__BLANK_) and + cell_2b(cell_x6_y10__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x6_y10__BLANK_) and + cell_2b(cell_x7_y11__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x7_y11__BLANK_) and + cell_2b(cell_x8_y12__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x8_y12__BLANK_)) or + ex cell_x9_y13__BLANK_, cell_x10_y14__BLANK_, cell_x11_y15__BLANK_, + cell_x12_y16__BLANK_ + (succ__cell_0__cell_0(cell_x9_y13__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_1__cell_1(cell_x10_y14__BLANK_, cell_x9_y13__BLANK_) and + succ__cell_0__cell_0(cell_x10_y14__BLANK_, cell_x11_y15__BLANK_) and + succ__cell_1__cell_1(cell_x11_y15__BLANK_, cell_x10_y14__BLANK_) and + succ__cell_0__cell_0(cell_x11_y15__BLANK_, cell_x12_y16__BLANK_) and + succ__cell_1__cell_1(cell_x12_y16__BLANK_, cell_x11_y15__BLANK_) and + cell_2b(cell_x9_y13__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x9_y13__BLANK_) and + cell_2b(cell_x10_y14__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x10_y14__BLANK_) and + cell_2b(cell_x11_y15__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x11_y15__BLANK_) and + cell_2b(cell_x12_y16__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x12_y16__BLANK_)) +REL column__w() = + ex cell_x4_y5__BLANK_, cell_x4_y6__BLANK_, cell_x4_y7__BLANK_, + cell_x4_y8__BLANK_ + (succ__cell_1__cell_1(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + succ__cell_1__cell_1(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + succ__cell_1__cell_1(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y7__BLANK_) and + cell_2w(cell_x4_y5__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y5__BLANK_) and + cell_2w(cell_x4_y6__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y6__BLANK_) and + cell_2w(cell_x4_y7__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y7__BLANK_) and + cell_2w(cell_x4_y8__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y8__BLANK_)) +REL column__r() = + ex cell_x4_y5__BLANK_, cell_x4_y6__BLANK_, cell_x4_y7__BLANK_, + cell_x4_y8__BLANK_ + (succ__cell_1__cell_1(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + succ__cell_1__cell_1(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + succ__cell_1__cell_1(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y7__BLANK_) and + cell_2r(cell_x4_y5__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y5__BLANK_) and + cell_2r(cell_x4_y6__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y6__BLANK_) and + cell_2r(cell_x4_y7__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y7__BLANK_) and + cell_2r(cell_x4_y8__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y8__BLANK_)) +REL column__dirt() = + ex cell_x4_y5__BLANK_, cell_x4_y6__BLANK_, cell_x4_y7__BLANK_, + cell_x4_y8__BLANK_ + (succ__cell_1__cell_1(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + succ__cell_1__cell_1(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + succ__cell_1__cell_1(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y7__BLANK_) and + cell_2dirt(cell_x4_y5__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y5__BLANK_) and + cell_2dirt(cell_x4_y6__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y6__BLANK_) and + cell_2dirt(cell_x4_y7__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y7__BLANK_) and + cell_2dirt(cell_x4_y8__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y8__BLANK_)) +REL column__b() = + ex cell_x4_y5__BLANK_, cell_x4_y6__BLANK_, cell_x4_y7__BLANK_, + cell_x4_y8__BLANK_ + (succ__cell_1__cell_1(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + succ__cell_1__cell_1(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + succ__cell_1__cell_1(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y5__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y7__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y6__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y7__BLANK_, cell_x4_y8__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y5__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y6__BLANK_) and + EQ___cell_0__cell_0(cell_x4_y8__BLANK_, cell_x4_y7__BLANK_) and + cell_2b(cell_x4_y5__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y5__BLANK_) and + cell_2b(cell_x4_y6__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y6__BLANK_) and + cell_2b(cell_x4_y7__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y7__BLANK_) and + cell_2b(cell_x4_y8__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x4_y8__BLANK_)) +REL open() = + ex cell_c10_h7__BLANK_ + (empty(cell_c10_h7__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c10_h7__BLANK_)) +REL line__w() = + (row__w() and true) or (column__w() and true) or (diag__w() and true) +REL line__r() = + (row__r() and true) or (column__r() and true) or (diag__r() and true) +REL line__dirt() = + (row__dirt() and true) or (column__dirt() and true) or + (diag__dirt() and true) +REL line__b() = + (row__b() and true) or (column__b() and true) or (diag__b() and true) +REL terminal() = + (line__r() and true) or (line__w() and true) or (not open() and true) +REL lte(v0, v1) = + ex cell_0__BLANK___BLANK_, cell_x16__BLANK___BLANK_ + (v0 = cell_0__BLANK___BLANK_ and v1 = cell_x16__BLANK___BLANK_ and + number__cell_0(cell_x16__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x16__BLANK___BLANK_) and + cell_00(cell_0__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_0__BLANK___BLANK_)) or + ex cell_x17__BLANK___BLANK_, cell_x17__BLANK___BLANK_ + (v0 = cell_x17__BLANK___BLANK_ and v1 = cell_x17__BLANK___BLANK_ and + number__cell_0(cell_x17__BLANK___BLANK_) and + number__cell_0(cell_x17__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x17__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x17__BLANK___BLANK_)) or + ex cell_x18__BLANK___BLANK_, cell_z4__BLANK___BLANK_ + (v0 = cell_x18__BLANK___BLANK_ and v1 = cell_z4__BLANK___BLANK_ and + ex cell_y21__BLANK___BLANK_ + (succ__cell_0__cell_0(cell_y21__BLANK___BLANK_, + cell_z4__BLANK___BLANK_) and lte(cell_x18__BLANK___BLANK_, + cell_y21__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y21__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x18__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_z4__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x18__BLANK___BLANK_))) or + ex cell_x19__BLANK___BLANK_, cell_y22__BLANK___BLANK_ + (v0 = cell_x19__BLANK___BLANK_ and v1 = cell_y22__BLANK___BLANK_ and + succ__cell_0__cell_0(cell_x19__BLANK___BLANK_, + cell_y22__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_y22__BLANK___BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_x19__BLANK___BLANK_)) +PLAYERS white, red +RULE drop_c11_noop: + [cell_c11_h4__BLANK_, control__BLANK_ | + _opt_cell_2b (control__BLANK_); + _opt_cell_2dirt {cell_c11_h4__BLANK_; control__BLANK_}; + _opt_cell_2r {cell_c11_h4__BLANK_; control__BLANK_}; + _opt_cell_2w {cell_c11_h4__BLANK_; control__BLANK_}; + _opt_control_0red {cell_c11_h4__BLANK_; control__BLANK_}; + _opt_control_0white (cell_c11_h4__BLANK_); cell_2b (cell_c11_h4__BLANK_); + cell__BLANK___BLANK___BLANK_ (cell_c11_h4__BLANK_); + control_0white (control__BLANK_); control__BLANK_ (control__BLANK_) + | + ] -> + [cell_c11_h4__BLANK_, control__BLANK_ | + cell_2w (cell_c11_h4__BLANK_); control_0red (control__BLANK_) | + ] emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white + pre + (not terminal() and + ex cell_c11_y17__BLANK_, cell_c11_h3__BLANK_, cell_c11_y18__BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_c11_h3__BLANK_) and + filled(cell_c11_h3__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c11_y17__BLANK_) and + filled(cell_c11_y17__BLANK_) and cell_2b(cell_c11_y18__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_h4__BLANK_) and + succ__cell_1__cell_1(cell_c11_h3__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_y17__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_y17__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_y18__BLANK_) and + succ__cell_1__cell_1(cell_c11_y17__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_y17__BLANK_))) +RULE noop_drop_c12: + [cell_c12_h6__BLANK_, control__BLANK_ | + _opt_cell_2b (control__BLANK_); + _opt_cell_2dirt {cell_c12_h6__BLANK_; control__BLANK_}; + _opt_cell_2r {cell_c12_h6__BLANK_; control__BLANK_}; + _opt_cell_2w {cell_c12_h6__BLANK_; control__BLANK_}; + _opt_control_0red (cell_c12_h6__BLANK_); + _opt_control_0white {cell_c12_h6__BLANK_; control__BLANK_}; + cell_2b (cell_c12_h6__BLANK_); + cell__BLANK___BLANK___BLANK_ (cell_c12_h6__BLANK_); + control_0red (control__BLANK_); control__BLANK_ (control__BLANK_) + | + ] -> + [cell_c12_h6__BLANK_, control__BLANK_ | + cell_2r (cell_c12_h6__BLANK_); control_0white (control__BLANK_) | + ] + emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white + pre + (not terminal() and + ex cell_c12_y19__BLANK_, cell_c12_h5__BLANK_, cell_c12_y20__BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_c12_h5__BLANK_) and + filled(cell_c12_h5__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c12_y19__BLANK_) and + filled(cell_c12_y19__BLANK_) and cell_2b(cell_c12_y20__BLANK_) and + cell__BLANK___BLANK___BLANK_(cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_h6__BLANK_) and + succ__cell_1__cell_1(cell_c12_h5__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_y19__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_y19__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_y20__BLANK_) and + succ__cell_1__cell_1(cell_c12_y19__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_y19__BLANK_))) +LOC 0 { + + PLAYER white { + PAYOFF + 100. * :((line__w() and true)) + + 50. * :((not line__r() and not line__w() and not open() and true)) + + 70. * :((not line__r() and not line__w() and open() and true)) + MOVES [drop_c11_noop -> 1] } + PLAYER red { + PAYOFF + 100. * :((line__r() and true)) + + 50. * :((not line__r() and not line__w() and not open() and true)) + + 70. * :((not line__r() and not line__w() and open() and true)) + } +} +LOC 1 { + + PLAYER white { + PAYOFF + 100. * :((line__w() and true)) + + 50. * :((not line__r() and not line__w() and not open() and true)) + + 70. * :((not line__r() and not line__w() and open() and true)) + } + PLAYER red { + PAYOFF + 100. * :((line__r() and true)) + + 50. * :((not line__r() and not line__w() and not open() and true)) + + 70. * :((not line__r() and not line__w() and open() and true)) + MOVES [noop_drop_c12 -> 0] } +} +MODEL + [cell_1_0__BLANK_, cell_1_1__BLANK_, cell_1_2__BLANK_, cell_1_3__BLANK_, + cell_1_4__BLANK_, cell_1_5__BLANK_, cell_1_6__BLANK_, cell_2_0__BLANK_, + cell_2_1__BLANK_, cell_2_2__BLANK_, cell_2_3__BLANK_, cell_2_4__BLANK_, + cell_2_5__BLANK_, cell_2_6__BLANK_, cell_3_0__BLANK_, cell_3_1__BLANK_, + cell_3_2__BLANK_, cell_3_3__BLANK_, cell_3_4__BLANK_, cell_3_5__BLANK_, + cell_3_6__BLANK_, cell_4_0__BLANK_, cell_4_1__BLANK_, cell_4_2__BLANK_, + cell_4_3__BLANK_, cell_4_4__BLANK_, cell_4_5__BLANK_, cell_4_6__BLANK_, + cell_5_0__BLANK_, cell_5_1__BLANK_, cell_5_2__BLANK_, cell_5_3__BLANK_, + cell_5_4__BLANK_, cell_5_5__BLANK_, cell_5_6__BLANK_, cell_6_0__BLANK_, + cell_6_1__BLANK_, cell_6_2__BLANK_, cell_6_3__BLANK_, cell_6_4__BLANK_, + cell_6_5__BLANK_, cell_6_6__BLANK_, cell_7_0__BLANK_, cell_7_1__BLANK_, + cell_7_2__BLANK_, cell_7_3__BLANK_, cell_7_4__BLANK_, cell_7_5__BLANK_, + cell_7_6__BLANK_, control__BLANK_ | + EQ___cell_0__cell_0 { + (cell_1_0__BLANK_, cell_1_0__BLANK_); + (cell_1_0__BLANK_, cell_1_1__BLANK_); + (cell_1_0__BLANK_, cell_1_2__BLANK_); + (cell_1_0__BLANK_, cell_1_3__BLANK_); + (cell_1_0__BLANK_, cell_1_4__BLANK_); + (cell_1_0__BLANK_, cell_1_5__BLANK_); + (cell_1_0__BLANK_, cell_1_6__BLANK_); + (cell_1_1__BLANK_, cell_1_0__BLANK_); + (cell_1_1__BLANK_, cell_1_1__BLANK_); + (cell_1_1__BLANK_, cell_1_2__BLANK_); + (cell_1_1__BLANK_, cell_1_3__BLANK_); + (cell_1_1__BLANK_, cell_1_4__BLANK_); + (cell_1_1__BLANK_, cell_1_5__BLANK_); + (cell_1_1__BLANK_, cell_1_6__BLANK_); + (cell_1_2__BLANK_, cell_1_0__BLANK_); + (cell_1_2__BLANK_, cell_1_1__BLANK_); + (cell_1_2__BLANK_, cell_1_2__BLANK_); + (cell_1_2__BLANK_, cell_1_3__BLANK_); + (cell_1_2__BLANK_, cell_1_4__BLANK_); + (cell_1_2__BLANK_, cell_1_5__BLANK_); + (cell_1_2__BLANK_, cell_1_6__BLANK_); + (cell_1_3__BLANK_, cell_1_0__BLANK_); + (cell_1_3__BLANK_, cell_1_1__BLANK_); + (cell_1_3__BLANK_, cell_1_2__BLANK_); + (cell_1_3__BLANK_, cell_1_3__BLANK_); + (cell_1_3__BLANK_, cell_1_4__BLANK_); + (cell_1_3__BLANK_, cell_1_5__BLANK_); + (cell_1_3__BLANK_, cell_1_6__BLANK_); + (cell_1_4__BLANK_, cell_1_0__BLANK_); + (cell_1_4__BLANK_, cell_1_1__BLANK_); + (cell_1_4__BLANK_, cell_1_2__BLANK_); + (cell_1_4__BLANK_, cell_1_3__BLANK_); + (cell_1_4__BLANK_, cell_1_4__BLANK_); + (cell_1_4__BLANK_, cell_1_5__BLANK_); + (cell_1_4__BLANK_, cell_1_6__BLANK_); + (cell_1_5__BLANK_, cell_1_0__BLANK_); + (cell_1_5__BLANK_, cell_1_1__BLANK_); + (cell_1_5__BLANK_, cell_1_2__BLANK_); + (cell_1_5__BLANK_, cell_1_3__BLANK_); + (cell_1_5__BLANK_, cell_1_4__BLANK_); + (cell_1_5__BLANK_, cell_1_5__BLANK_); + (cell_1_5__BLANK_, cell_1_6__BLANK_); + (cell_1_6__BLANK_, cell_1_0__BLANK_); + (cell_1_6__BLANK_, cell_1_1__BLANK_); + (cell_1_6__BLANK_, cell_1_2__BLANK_); + (cell_1_6__BLANK_, cell_1_3__BLANK_); + (cell_1_6__BLANK_, cell_1_4__BLANK_); + (cell_1_6__BLANK_, cell_1_5__BLANK_); + (cell_1_6__BLANK_, cell_1_6__BLANK_); + (cell_2_0__BLANK_, cell_2_0__BLANK_); + (cell_2_0__BLANK_, cell_2_1__BLANK_); + (cell_2_0__BLANK_, cell_2_2__BLANK_); + (cell_2_0__BLANK_, cell_2_3__BLANK_); + (cell_2_0__BLANK_, cell_2_4__BLANK_); + (cell_2_0__BLANK_, cell_2_5__BLANK_); + (cell_2_0__BLANK_, cell_2_6__BLANK_); + (cell_2_1__BLANK_, cell_2_0__BLANK_); + (cell_2_1__BLANK_, cell_2_1__BLANK_); + (cell_2_1__BLANK_, cell_2_2__BLANK_); + (cell_2_1__BLANK_, cell_2_3__BLANK_); + (cell_2_1__BLANK_, cell_2_4__BLANK_); + (cell_2_1__BLANK_, cell_2_5__BLANK_); + (cell_2_1__BLANK_, cell_2_6__BLANK_); + (cell_2_2__BLANK_, cell_2_0__BLANK_); + (cell_2_2__BLANK_, cell_2_1__BLANK_); + (cell_2_2__BLANK_, cell_2_2__BLANK_); + (cell_2_2__BLANK_, cell_2_3__BLANK_); + (cell_2_2__BLANK_, cell_2_4__BLANK_); + (cell_2_2__BLANK_, cell_2_5__BLANK_); + (cell_2_2__BLANK_, cell_2_6__BLANK_); + (cell_2_3__BLANK_, cell_2_0__BLANK_); + (cell_2_3__BLANK_, cell_2_1__BLANK_); + (cell_2_3__BLANK_, cell_2_2__BLANK_); + (cell_2_3__BLANK_, cell_2_3__BLANK_); + (cell_2_3__BLANK_, cell_2_4__BLANK_); + (cell_2_3__BLANK_, cell_2_5__BLANK_); + (cell_2_3__BLANK_, cell_2_6__BLANK_); + (cell_2_4__BLANK_, cell_2_0__BLANK_); + (cell_2_4__BLANK_, cell_2_1__BLANK_); + (cell_2_4__BLANK_, cell_2_2__BLANK_); + (cell_2_4__BLANK_, cell_2_3__BLANK_); + (cell_2_4__BLANK_, cell_2_4__BLANK_); + (cell_2_4__BLANK_, cell_2_5__BLANK_); + (cell_2_4__BLANK_, cell_2_6__BLANK_); + (cell_2_5__BLANK_, cell_2_0__BLANK_); + (cell_2_5__BLANK_, cell_2_1__BLANK_); + (cell_2_5__BLANK_, cell_2_2__BLANK_); + (cell_2_5__BLANK_, cell_2_3__BLANK_); + (cell_2_5__BLANK_, cell_2_4__BLANK_); + (cell_2_5__BLANK_, cell_2_5__BLANK_); + (cell_2_5__BLANK_, cell_2_6__BLANK_); + (cell_2_6__BLANK_, cell_2_0__BLANK_); + (cell_2_6__BLANK_, cell_2_1__BLANK_); + (cell_2_6__BLANK_, cell_2_2__BLANK_); + (cell_2_6__BLANK_, cell_2_3__BLANK_); + (cell_2_6__BLANK_, cell_2_4__BLANK_); + (cell_2_6__BLANK_, cell_2_5__BLANK_); + (cell_2_6__BLANK_, cell_2_6__BLANK_); + (cell_3_0__BLANK_, cell_3_0__BLANK_); + (cell_3_0__BLANK_, cell_3_1__BLANK_); + (cell_3_0__BLANK_, cell_3_2__BLANK_); + (cell_3_0__BLANK_, cell_3_3__BLANK_); + (cell_3_0__BLANK_, cell_3_4__BLANK_); + (cell_3_0__BLANK_, cell_3_5__BLANK_); + (cell_3_0__BLANK_, cell_3_6__BLANK_); + (cell_3_1__BLANK_, cell_3_0__BLANK_); + (cell_3_1__BLANK_, cell_3_1__BLANK_); + (cell_3_1__BLANK_, cell_3_2__BLANK_); + (cell_3_1__BLANK_, cell_3_3__BLANK_); + (cell_3_1__BLANK_, cell_3_4__BLANK_); + (cell_3_1__BLANK_, cell_3_5__BLANK_); + (cell_3_1__BLANK_, cell_3_6__BLANK_); + (cell_3_2__BLANK_, cell_3_0__BLANK_); + (cell_3_2__BLANK_, cell_3_1__BLANK_); + (cell_3_2__BLANK_, cell_3_2__BLANK_); + (cell_3_2__BLANK_, cell_3_3__BLANK_); + (cell_3_2__BLANK_, cell_3_4__BLANK_); + (cell_3_2__BLANK_, cell_3_5__BLANK_); + (cell_3_2__BLANK_, cell_3_6__BLANK_); + (cell_3_3__BLANK_, cell_3_0__BLANK_); + (cell_3_3__BLANK_, cell_3_1__BLANK_); + (cell_3_3__BLANK_, cell_3_2__BLANK_); + (cell_3_3__BLANK_, cell_3_3__BLANK_); + (cell_3_3__BLANK_, cell_3_4__BLANK_); + (cell_3_3__BLANK_, cell_3_5__BLANK_); + (cell_3_3__BLANK_, cell_3_6__BLANK_); + (cell_3_4__BLANK_, cell_3_0__BLANK_); + (cell_3_4__BLANK_, cell_3_1__BLANK_); + (cell_3_4__BLANK_, cell_3_2__BLANK_); + (cell_3_4__BLANK_, cell_3_3__BLANK_); + (cell_3_4__BLANK_, cell_3_4__BLANK_); + (cell_3_4__BLANK_, cell_3_5__BLANK_); + (cell_3_4__BLANK_, cell_3_6__BLANK_); + (cell_3_5__BLANK_, cell_3_0__BLANK_); + (cell_3_5__BLANK_, cell_3_1__BLANK_); + (cell_3_5__BLANK_, cell_3_2__BLANK_); + (cell_3_5__BLANK_, cell_3_3__BLANK_); + (cell_3_5__BLANK_, cell_3_4__BLANK_); + (cell_3_5__BLANK_, cell_3_5__BLANK_); + (cell_3_5__BLANK_, cell_3_6__BLANK_); + (cell_3_6__BLANK_, cell_3_0__BLANK_); + (cell_3_6__BLANK_, cell_3_1__BLANK_); + (cell_3_6__BLANK_, cell_3_2__BLANK_); + (cell_3_6__BLANK_, cell_3_3__BLANK_); + (cell_3_6__BLANK_, cell_3_4__BLANK_); + (cell_3_6__BLANK_, cell_3_5__BLANK_); + (cell_3_6__BLANK_, cell_3_6__BLANK_); + (cell_4_0__BLANK_, cell_4_0__BLANK_); + (cell_4_0__BLANK_, cell_4_1__BLANK_); + (cell_4_0__BLANK_, cell_4_2__BLANK_); + (cell_4_0__BLANK_, cell_4_3__BLANK_); + (cell_4_0__BLANK_, cell_4_4__BLANK_); + (cell_4_0__BLANK_, cell_4_5__BLANK_); + (cell_4_0__BLANK_, cell_4_6__BLANK_); + (cell_4_1__BLANK_, cell_4_0__BLANK_); + (cell_4_1__BLANK_, cell_4_1__BLANK_); + (cell_4_1__BLANK_, cell_4_2__BLANK_); + (cell_4_1__BLANK_, cell_4_3__BLANK_); + (cell_4_1__BLANK_, cell_4_4__BLANK_); + (cell_4_1__BLANK_, cell_4_5__BLANK_); + (cell_4_1__BLANK_, cell_4_6__BLANK_); + (cell_4_2__BLANK_, cell_4_0__BLANK_); + (cell_4_2__BLANK_, cell_4_1__BLANK_); + (cell_4_2__BLANK_, cell_4_2__BLANK_); + (cell_4_2__BLANK_, cell_4_3__BLANK_); + (cell_4_2__BLANK_, cell_4_4__BLANK_); + (cell_4_2__BLANK_, cell_4_5__BLANK_); + (cell_4_2__BLANK_, cell_4_6__BLANK_); + (cell_4_3__BLANK_, cell_4_0__BLANK_); + (cell_4_3__BLANK_, cell_4_1__BLANK_); + (cell_4_3__BLANK_, cell_4_2__BLANK_); + (cell_4_3__BLANK_, cell_4_3__BLANK_); + (cell_4_3__BLANK_, cell_4_4__BLANK_); + (cell_4_3__BLANK_, cell_4_5__BLANK_); + (cell_4_3__BLANK_, cell_4_6__BLANK_); + (cell_4_4__BLANK_, cell_4_0__BLANK_); + (cell_4_4__BLANK_, cell_4_1__BLANK_); + (cell_4_4__BLANK_, cell_4_2__BLANK_); + (cell_4_4__BLANK_, cell_4_3__BLANK_); + (cell_4_4__BLANK_, cell_4_4__BLANK_); + (cell_4_4__BLANK_, cell_4_5__BLANK_); + (cell_4_4__BLANK_, cell_4_6__BLANK_); + (cell_4_5__BLANK_, cell_4_0__BLANK_); + (cell_4_5__BLANK_, cell_4_1__BLANK_); + (cell_4_5__BLANK_, cell_4_2__BLANK_); + (cell_4_5__BLANK_, cell_4_3__BLANK_); + (cell_4_5__BLANK_, cell_4_4__BLANK_); + (cell_4_5__BLANK_, cell_4_5__BLANK_); + (cell_4_5__BLANK_, cell_4_6__BLANK_); + (cell_4_6__BLANK_, cell_4_0__BLANK_); + (cell_4_6__BLANK_, cell_4_1__BLANK_); + (cell_4_6__BLANK_, cell_4_2__BLANK_); + (cell_4_6__BLANK_, cell_4_3__BLANK_); + (cell_4_6__BLANK_, cell_4_4__BLANK_); + (cell_4_6__BLANK_, cell_4_5__BLANK_); + (cell_4_6__BLANK_, cell_4_6__BLANK_); + (cell_5_0__BLANK_, cell_5_0__BLANK_); + (cell_5_0__BLANK_, cell_5_1__BLANK_); + (cell_5_0__BLANK_, cell_5_2__BLANK_); + (cell_5_0__BLANK_, cell_5_3__BLANK_); + (cell_5_0__BLANK_, cell_5_4__BLANK_); + (cell_5_0__BLANK_, cell_5_5__BLANK_); + (cell_5_0__BLANK_, cell_5_6__BLANK_); + (cell_5_1__BLANK_, cell_5_0__BLANK_); + (cell_5_1__BLANK_, cell_5_1__BLANK_); + (cell_5_1__BLANK_, cell_5_2__BLANK_); + (cell_5_1__BLANK_, cell_5_3__BLANK_); + (cell_5_1__BLANK_, cell_5_4__BLANK_); + (cell_5_1__BLANK_, cell_5_5__BLANK_); + (cell_5_1__BLANK_, cell_5_6__BLANK_); + (cell_5_2__BLANK_, cell_5_0__BLANK_); + (cell_5_2__BLANK_, cell_5_1__BLANK_); + (cell_5_2__BLANK_, cell_5_2__BLANK_); + (cell_5_2__BLANK_, cell_5_3__BLANK_); + (cell_5_2__BLANK_, cell_5_4__BLANK_); + (cell_5_2__BLANK_, cell_5_5__BLANK_); + (cell_5_2__BLANK_, cell_5_6__BLANK_); + (cell_5_3__BLANK_, cell_5_0__BLANK_); + (cell_5_3__BLANK_, cell_5_1__BLANK_); + (cell_5_3__BLANK_, cell_5_2__BLANK_); + (cell_5_3__BLANK_, cell_5_3__BLANK_); + (cell_5_3__BLANK_, cell_5_4__BLANK_); + (cell_5_3__BLANK_, cell_5_5__BLANK_); + (cell_5_3__BLANK_, cell_5_6__BLANK_); + (cell_5_4__BLANK_, cell_5_0__BLANK_); + (cell_5_4__BLANK_, cell_5_1__BLANK_); + (cell_5_4__BLANK_, cell_5_2__BLANK_); + (cell_5_4__BLANK_, cell_5_3__BLANK_); + (cell_5_4__BLANK_, cell_5_4__BLANK_); + (cell_5_4__BLANK_, cell_5_5__BLANK_); + (cell_5_4__BLANK_, cell_5_6__BLANK_); + (cell_5_5__BLANK_, cell_5_0__BLANK_); + (cell_5_5__BLANK_, cell_5_1__BLANK_); + (cell_5_5__BLANK_, cell_5_2__BLANK_); + (cell_5_5__BLANK_, cell_5_3__BLANK_); + (cell_5_5__BLANK_, cell_5_4__BLANK_); + (cell_5_5__BLANK_, cell_5_5__BLANK_); + (cell_5_5__BLANK_, cell_5_6__BLANK_); + (cell_5_6__BLANK_, cell_5_0__BLANK_); + (cell_5_6__BLANK_, cell_5_1__BLANK_); + (cell_5_6__BLANK_, cell_5_2__BLANK_); + (cell_5_6__BLANK_, cell_5_3__BLANK_); + (cell_5_6__BLANK_, cell_5_4__BLANK_); + (cell_5_6__BLANK_, cell_5_5__BLANK_); + (cell_5_6__BLANK_, cell_5_6__BLANK_); + (cell_6_0__BLANK_, cell_6_0__BLANK_); + (cell_6_0__BLANK_, cell_6_1__BLANK_); + (cell_6_0__BLANK_, cell_6_2__BLANK_); + (cell_6_0__BLANK_, cell_6_3__BLANK_); + (cell_6_0__BLANK_, cell_6_4__BLANK_); + (cell_6_0__BLANK_, cell_6_5__BLANK_); + (cell_6_0__BLANK_, cell_6_6__BLANK_); + (cell_6_1__BLANK_, cell_6_0__BLANK_); + (cell_6_1__BLANK_, cell_6_1__BLANK_); + (cell_6_1__BLANK_, cell_6_2__BLANK_); + (cell_6_1__BLANK_, cell_6_3__BLANK_); + (cell_6_1__BLANK_, cell_6_4__BLANK_); + (cell_6_1__BLANK_, cell_6_5__BLANK_); + (cell_6_1__BLANK_, cell_6_6__BLANK_); + (cell_6_2__BLANK_, cell_6_0__BLANK_); + (cell_6_2__BLANK_, cell_6_1__BLANK_); + (cell_6_2__BLANK_, cell_6_2__BLANK_); + (cell_6_2__BLANK_, cell_6_3__BLANK_); + (cell_6_2__BLANK_, cell_6_4__BLANK_); + (cell_6_2__BLANK_, cell_6_5__BLANK_); + (cell_6_2__BLANK_, cell_6_6__BLANK_); + (cell_6_3__BLANK_, cell_6_0__BLANK_); + (cell_6_3__BLANK_, cell_6_1__BLANK_); + (cell_6_3__BLANK_, cell_6_2__BLANK_); + (cell_6_3__BLANK_, cell_6_3__BLANK_); + (cell_6_3__BLANK_, cell_6_4__BLANK_); + (cell_6_3__BLANK_, cell_6_5__BLANK_); + (cell_6_3__BLANK_, cell_6_6__BLANK_); + (cell_6_4__BLANK_, cell_6_0__BLANK_); + (cell_6_4__BLANK_, cell_6_1__BLANK_); + (cell_6_4__BLANK_, cell_6_2__BLANK_); + (cell_6_4__BLANK_, cell_6_3__BLANK_); + (cell_6_4__BLANK_, cell_6_4__BLANK_); + (cell_6_4__BLANK_, cell_6_5__BLANK_); + (cell_6_4__BLANK_, cell_6_6__BLANK_); + (cell_6_5__BLANK_, cell_6_0__BLANK_); + (cell_6_5__BLANK_, cell_6_1__BLANK_); + (cell_6_5__BLANK_, cell_6_2__BLANK_); + (cell_6_5__BLANK_, cell_6_3__BLANK_); + (cell_6_5__BLANK_, cell_6_4__BLANK_); + (cell_6_5__BLANK_, cell_6_5__BLANK_); + (cell_6_5__BLANK_, cell_6_6__BLANK_); + (cell_6_6__BLANK_, cell_6_0__BLANK_); + (cell_6_6__BLANK_, cell_6_1__BLANK_); + (cell_6_6__BLANK_, cell_6_2__BLANK_); + (cell_6_6__BLANK_, cell_6_3__BLANK_); + (cell_6_6__BLANK_, cell_6_4__BLANK_); + (cell_6_6__BLANK_, cell_6_5__BLANK_); + (cell_6_6__BLANK_, cell_6_6__BLANK_); + (cell_7_0__BLANK_, cell_7_0__BLANK_); + (cell_7_0__BLANK_, cell_7_1__BLANK_); + (cell_7_0__BLANK_, cell_7_2__BLANK_); + (cell_7_0__BLANK_, cell_7_3__BLANK_); + (cell_7_0__BLANK_, cell_7_4__BLANK_); + (cell_7_0__BLANK_, cell_7_5__BLANK_); + (cell_7_0__BLANK_, cell_7_6__BLANK_); + (cell_7_1__BLANK_, cell_7_0__BLANK_); + (cell_7_1__BLANK_, cell_7_1__BLANK_); + (cell_7_1__BLANK_, cell_7_2__BLANK_); + (cell_7_1__BLANK_, cell_7_3__BLANK_); + (cell_7_1__BLANK_, cell_7_4__BLANK_); + (cell_7_1__BLANK_, cell_7_5__BLANK_); + (cell_7_1__BLANK_, cell_7_6__BLANK_); + (cell_7_2__BLANK_, cell_7_0__BLANK_); + (cell_7_2__BLANK_, cell_7_1__BLANK_); + (cell_7_2__BLANK_, cell_7_2__BLANK_); + (cell_7_2__BLANK_, cell_7_3__BLANK_); + (cell_7_2__BLANK_, cell_7_4__BLANK_); + (cell_7_2__BLANK_, cell_7_5__BLANK_); + (cell_7_2__BLANK_, cell_7_6__BLANK_); + (cell_7_3__BLANK_, cell_7_0__BLANK_); + (cell_7_3__BLANK_, cell_7_1__BLANK_); + (cell_7_3__BLANK_, cell_7_2__BLANK_); + (cell_7_3__BLANK_, cell_7_3__BLANK_); + (cell_7_3__BLANK_, cell_7_4__BLANK_); + (cell_7_3__BLANK_, cell_7_5__BLANK_); + (cell_7_3__BLANK_, cell_7_6__BLANK_); + (cell_7_4__BLANK_, cell_7_0__BLANK_); + (cell_7_4__BLANK_, cell_7_1__BLANK_); + (cell_7_4__BLANK_, cell_7_2__BLANK_); + (cell_7_4__BLANK_, cell_7_3__BLANK_); + (cell_7_4__BLANK_, cell_7_4__BLANK_); + (cell_7_4__BLANK_, cell_7_5__BLANK_); + (cell_7_4__BLANK_, cell_7_6__BLANK_); + (cell_7_5__BLANK_, cell_7_0__BLANK_); + (cell_7_5__BLANK_, cell_7_1__BLANK_); + (cell_7_5__BLANK_, cell_7_2__BLANK_); + (cell_7_5__BLANK_, cell_7_3__BLANK_); + (cell_7_5__BLANK_, cell_7_4__BLANK_); + (cell_7_5__BLANK_, cell_7_5__BLANK_); + (cell_7_5__BLANK_, cell_7_6__BLANK_); + (cell_7_6__BLANK_, cell_7_0__BLANK_); + (cell_7_6__BLANK_, cell_7_1__BLANK_); + (cell_7_6__BLANK_, cell_7_2__BLANK_); + (cell_7_6__BLANK_, cell_7_3__BLANK_); + (cell_7_6__BLANK_, cell_7_4__BLANK_); + (cell_7_6__BLANK_, cell_7_5__BLANK_); + (cell_7_6__BLANK_, cell_7_6__BLANK_) + }; + EQ___cell_0__cell_1 { + (cell_1_0__BLANK_, cell_1_1__BLANK_); + (cell_1_0__BLANK_, cell_2_1__BLANK_); + (cell_1_0__BLANK_, cell_3_1__BLANK_); + (cell_1_0__BLANK_, cell_4_1__BLANK_); + (cell_1_0__BLANK_, cell_5_1__BLANK_); + (cell_1_0__BLANK_, cell_6_1__BLANK_); + (cell_1_0__BLANK_, cell_7_1__BLANK_); + (cell_1_1__BLANK_, cell_1_1__BLANK_); + (cell_1_1__BLANK_, cell_2_1__BLANK_); + (cell_1_1__BLANK_, cell_3_1__BLANK_); + (cell_1_1__BLANK_, cell_4_1__BLANK_); + (cell_1_1__BLANK_, cell_5_1__BLANK_); + (cell_1_1__BLANK_, cell_6_1__BLANK_); + (cell_1_1__BLANK_, cell_7_1__BLANK_); + (cell_1_2__BLANK_, cell_1_1__BLANK_); + (cell_1_2__BLANK_, cell_2_1__BLANK_); + (cell_1_2__BLANK_, cell_3_1__BLANK_); + (cell_1_2__BLANK_, cell_4_1__BLANK_); + (cell_1_2__BLANK_, cell_5_1__BLANK_); + (cell_1_2__BLANK_, cell_6_1__BLANK_); + (cell_1_2__BLANK_, cell_7_1__BLANK_); + (cell_1_3__BLANK_, cell_1_1__BLANK_); + (cell_1_3__BLANK_, cell_2_1__BLANK_); + (cell_1_3__BLANK_, cell_3_1__BLANK_); + (cell_1_3__BLANK_, cell_4_1__BLANK_); + (cell_1_3__BLANK_, cell_5_1__BLANK_); + (cell_1_3__BLANK_, cell_6_1__BLANK_); + (cell_1_3__BLANK_, cell_7_1__BLANK_); + (cell_1_4__BLANK_, cell_1_1__BLANK_); + (cell_1_4__BLANK_, cell_2_1__BLANK_); + (cell_1_4__BLANK_, cell_3_1__BLANK_); + (cell_1_4__BLANK_, cell_4_1__BLANK_); + (cell_1_4__BLANK_, cell_5_1__BLANK_); + (cell_1_4__BLANK_, cell_6_1__BLANK_); + (cell_1_4__BLANK_, cell_7_1__BLANK_); + (cell_1_5__BLANK_, cell_1_1__BLANK_); + (cell_1_5__BLANK_, cell_2_1__BLANK_); + (cell_1_5__BLANK_, cell_3_1__BLANK_); + (cell_1_5__BLANK_, cell_4_1__BLANK_); + (cell_1_5__BLANK_, cell_5_1__BLANK_); + (cell_1_5__BLANK_, cell_6_1__BLANK_); + (cell_1_5__BLANK_, cell_7_1__BLANK_); + (cell_1_6__BLANK_, cell_1_1__BLANK_); + (cell_1_6__BLANK_, cell_2_1__BLANK_); + (cell_1_6__BLANK_, cell_3_1__BLANK_); + (cell_1_6__BLANK_, cell_4_1__BLANK_); + (cell_1_6__BLANK_, cell_5_1__BLANK_); + (cell_1_6__BLANK_, cell_6_1__BLANK_); + (cell_1_6__BLANK_, cell_7_1__BLANK_); + (cell_2_0__BLANK_, cell_1_2__BLANK_); + (cell_2_0__BLANK_, cell_2_2__BLANK_); + (cell_2_0__BLANK_, cell_3_2__BLANK_); + (cell_2_0__BLANK_, cell_4_2__BLANK_); + (cell_2_0__BLANK_, cell_5_2__BLANK_); + (cell_2_0__BLANK_, cell_6_2__BLANK_); + (cell_2_0__BLANK_, cell_7_2__BLANK_); + (cell_2_1__BLANK_, cell_1_2__BLANK_); + (cell_2_1__BLANK_, cell_2_2__BLANK_); + (cell_2_1__BLANK_, cell_3_2__BLANK_); + (cell_2_1__BLANK_, cell_4_2__BLANK_); + (cell_2_1__BLANK_, cell_5_2__BLANK_); + (cell_2_1__BLANK_, cell_6_2__BLANK_); + (cell_2_1__BLANK_, cell_7_2__BLANK_); + (cell_2_2__BLANK_, cell_1_2__BLANK_); + (cell_2_2__BLANK_, cell_2_2__BLANK_); + (cell_2_2__BLANK_, cell_3_2__BLANK_); + (cell_2_2__BLANK_, cell_4_2__BLANK_); + (cell_2_2__BLANK_, cell_5_2__BLANK_); + (cell_2_2__BLANK_, cell_6_2__BLANK_); + (cell_2_2__BLANK_, cell_7_2__BLANK_); + (cell_2_3__BLANK_, cell_1_2__BLANK_); + (cell_2_3__BLANK_, cell_2_2__BLANK_); + (cell_2_3__BLANK_, cell_3_2__BLANK_); + (cell_2_3__BLANK_, cell_4_2__BLANK_); + (cell_2_3__BLANK_, cell_5_2__BLANK_); + (cell_2_3__BLANK_, cell_6_2__BLANK_); + (cell_2_3__BLANK_, cell_7_2__BLANK_); + (cell_2_4__BLANK_, cell_1_2__BLANK_); + (cell_2_4__BLANK_, cell_2_2__BLANK_); + (cell_2_4__BLANK_, cell_3_2__BLANK_); + (cell_2_4__BLANK_, cell_4_2__BLANK_); + (cell_2_4__BLANK_, cell_5_2__BLANK_); + (cell_2_4__BLANK_, cell_6_2__BLANK_); + (cell_2_4__BLANK_, cell_7_2__BLANK_); + (cell_2_5__BLANK_, cell_1_2__BLANK_); + (cell_2_5__BLANK_, cell_2_2__BLANK_); + (cell_2_5__BLANK_, cell_3_2__BLANK_); + (cell_2_5__BLANK_, cell_4_2__BLANK_); + (cell_2_5__BLANK_, cell_5_2__BLANK_); + (cell_2_5__BLANK_, cell_6_2__BLANK_); + (cell_2_5__BLANK_, cell_7_2__BLANK_); + (cell_2_6__BLANK_, cell_1_2__BLANK_); + (cell_2_6__BLANK_, cell_2_2__BLANK_); + (cell_2_6__BLANK_, cell_3_2__BLANK_); + (cell_2_6__BLANK_, cell_4_2__BLANK_); + (cell_2_6__BLANK_... [truncated message content] |
From: <luk...@us...> - 2011-08-28 22:05:58
|
Revision: 1547 http://toss.svn.sourceforge.net/toss/?rev=1547&view=rev Author: lukaszkaiser Date: 2011-08-28 22:05:49 +0000 (Sun, 28 Aug 2011) Log Message: ----------- Translate testing in Makefile, first batch of GGP examples (starting with digits). Modified Paths: -------------- trunk/Toss/GGP/Makefile Added Paths: ----------- trunk/Toss/GGP/examples/2player_normal_form_2010.gdl trunk/Toss/GGP/examples/3pffa.gdl trunk/Toss/GGP/examples/3pttc.gdl trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.SAT.gdl trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.viz.SAT.gdl trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.SAT.gdl trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.2.qdimacs.satlike.gdl trunk/Toss/GGP/examples/4pttc.gdl trunk/Toss/GGP/examples/8puzzle.gdl Modified: trunk/Toss/GGP/Makefile =================================================================== --- trunk/Toss/GGP/Makefile 2011-08-28 21:08:34 UTC (rev 1546) +++ trunk/Toss/GGP/Makefile 2011-08-28 22:05:49 UTC (rev 1547) @@ -7,6 +7,8 @@ TranslateTest: GameSimplTest: +GDL_GAMES = $(basename $(notdir $(shell ls examples/*.gdl))) + %.black: examples/%.gdl make -C .. OCAMLRUNPARAM=b; export OCAMLRUNPARAM; ../TossServer -nocache -d 1 & @@ -19,7 +21,6 @@ java -jar gamecontroller-cli.jar play $< 600 10 1 -random 2 -remote 1 toss localhost 8110 1 | grep results killall -v TossServer - tests_all: make -C .. GGPTestsVerbose make tictactoe.white @@ -33,6 +34,16 @@ make connect5.white make connect5.black + +%.translate: examples/%.gdl + @make -C .. GGP/TranslateGameTest.native > /dev/null + @echo Translating $< + @-../TranslateGameTest.native -v -f $< + @echo '' + +translate_all: $(addsuffix .translate, $(GDL_GAMES)) + + .PHONY: clean clean: Added: trunk/Toss/GGP/examples/2player_normal_form_2010.gdl =================================================================== --- trunk/Toss/GGP/examples/2player_normal_form_2010.gdl (rev 0) +++ trunk/Toss/GGP/examples/2player_normal_form_2010.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,36 @@ +(role row) +(role column) + +(init (reward r1 c1 90 90)) +(init (reward r1 c2 40 30)) +(init (reward r1 c3 20 80)) +(init (reward r2 c1 30 40)) +(init (reward r2 c2 0 0)) +(init (reward r2 c3 50 100)) +(init (reward r3 c1 80 20)) +(init (reward r3 c2 100 50)) +(init (reward r3 c3 10 10)) + +(<= (legal row ?m1) + (true (reward ?m1 ?m2 ?r1 ?r2))) +(<= (legal column ?m2) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (next (did ?p ?m)) + (does ?p ?m)) + +(<= (next (reward ?m1 ?m2 ?r1 ?r2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (goal row ?r1) + (true (did row ?m1)) + (true (did column ?m2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (goal column ?r2) + (true (did row ?m1)) + (true (did column ?m2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= terminal + (true (did ?p ?m))) Added: trunk/Toss/GGP/examples/3pffa.gdl =================================================================== --- trunk/Toss/GGP/examples/3pffa.gdl (rev 0) +++ trunk/Toss/GGP/examples/3pffa.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,203 @@ +(role red) +(role yellow) +(role blue) +(init (control red)) +(init (cell 1 4 red)) +(init (cell 4 1 yellow)) +(init (cell 7 4 blue)) +(init (step 1)) +(init (capture red 0)) +(init (capture yellow 0)) +(init (capture blue 0)) +(<= (legal ?player noop) + (role ?player)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (orthogonal ?x1 ?y1 ?x2 ?y2) + (onboard ?x2 ?y2) + (true (cell ?x2 ?y2 ?player2)) + (distinct ?player ?player2)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (diagonal ?x1 ?y1 ?x2 ?y2) + (onboard ?x2 ?y2) + (true (cell ?x2 ?y2 ?player2)) + (distinct ?player ?player2)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (ell ?x1 ?y1 ?x2 ?y2) + (opencell ?x2 ?y2)) +(<= (next (control ?p2)) + (true (control ?p1)) + (rotation ?p1 ?p2)) +(<= (next (cell ?x2 ?y2 ?player)) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (next (cell ?x ?y ?piece)) + (true (cell ?x ?y ?piece)) + (not (camefrom ?x ?y)) + (not (wentto ?x ?y))) +(<= (next (cell ?x ?y ?player)) + (spawns ?x ?y ?player)) +(<= (next (capture ?player ?count)) + (true (capture ?player ?count)) + (not (captured ?player))) +(<= (next (capture ?player ?count2)) + (true (capture ?player ?count1)) + (captured ?player) + (captureplus ?count1 ?count2)) +(<= (next (step ?t2)) + (true (step ?t1)) + (stepcount ?t1 ?t2)) +(<= terminal + (true (step 31))) +(<= (goal ?player ?goal) + (true (capture ?player ?count)) + (scoremap ?count ?goal)) +(<= (orthogonal ?x1 ?y ?x2 ?y) + (plus 1 ?x1 ?x2) + (index ?y)) +(<= (orthogonal ?x1 ?y ?x2 ?y) + (plus 1 ?x2 ?x1) + (index ?y)) +(<= (orthogonal ?x ?y1 ?x ?y2) + (index ?x) + (plus 1 ?y1 ?y2)) +(<= (orthogonal ?x ?y1 ?x ?y2) + (index ?x) + (plus 1 ?y2 ?y1)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 1 ?y1 ?y2)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 1 ?y2 ?y1)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 1 ?y1 ?y2)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x1 ?x2) + (plus 1 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x1 ?x2) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x2 ?x1) + (plus 1 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x2 ?x1) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 2 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 2 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 2 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 2 ?y2 ?y1)) +(<= (opencell ?x ?y) + (onboard ?x ?y) + (not (true (cell ?x ?y red))) + (not (true (cell ?x ?y yellow))) + (not (true (cell ?x ?y blue)))) +(<= (onboard ?x ?y) + (index ?x) + (index ?y) + (distinct ?x 1) + (distinct ?x 7) + (distinct ?y 1) + (distinct ?y 7)) +(<= (camefrom ?x1 ?y1) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (wentto ?x2 ?y2) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (captured ?player) + (true (control ?player)) + (wentto ?x ?y) + (true (cell ?x ?y ?any))) +(index 1) +(index 2) +(index 3) +(index 4) +(index 5) +(index 6) +(index 7) +(plus 1 1 2) +(plus 1 2 3) +(plus 1 3 4) +(plus 1 4 5) +(plus 1 5 6) +(plus 1 6 7) +(plus 2 1 3) +(plus 2 2 4) +(plus 2 3 5) +(plus 2 4 6) +(plus 2 5 7) +(rotation red yellow) +(rotation yellow blue) +(rotation blue red) +(spawns 1 4 red) +(spawns 4 1 yellow) +(spawns 7 4 blue) +(stepcount 1 2) +(stepcount 2 3) +(stepcount 3 4) +(stepcount 4 5) +(stepcount 5 6) +(stepcount 6 7) +(stepcount 7 8) +(stepcount 8 9) +(stepcount 9 10) +(stepcount 10 11) +(stepcount 11 12) +(stepcount 12 13) +(stepcount 13 14) +(stepcount 14 15) +(stepcount 15 16) +(stepcount 16 17) +(stepcount 17 18) +(stepcount 18 19) +(stepcount 19 20) +(stepcount 20 21) +(stepcount 21 22) +(stepcount 22 23) +(stepcount 23 24) +(stepcount 24 25) +(stepcount 25 26) +(stepcount 26 27) +(stepcount 27 28) +(stepcount 28 29) +(stepcount 29 30) +(stepcount 30 31) +(captureplus 0 1) +(captureplus 1 2) +(captureplus 2 3) +(captureplus 3 4) +(captureplus 4 5) +(captureplus 5 6) +(captureplus 6 7) +(captureplus 7 8) +(captureplus 8 9) +(captureplus 9 10) +(scoremap 0 0) +(scoremap 1 10) +(scoremap 2 20) +(scoremap 3 30) +(scoremap 4 40) +(scoremap 5 50) +(scoremap 6 60) +(scoremap 7 70) +(scoremap 8 80) +(scoremap 9 90) +(scoremap 10 100) + + Added: trunk/Toss/GGP/examples/3pttc.gdl =================================================================== --- trunk/Toss/GGP/examples/3pttc.gdl (rev 0) +++ trunk/Toss/GGP/examples/3pttc.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,213 @@ +(role red) +(role yellow) +(role blue) +(init (control red)) +(init (cell 1 4 red)) +(init (cell 4 1 yellow)) +(init (cell 7 4 blue)) +(init (step 1)) +(<= (legal ?player noop) + (role ?player)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (orthogonal ?x1 ?y1 ?x2 ?y2) + (onboard ?x2 ?y2) + (true (cell ?x2 ?y2 ?player2)) + (distinct ?player ?player2)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (diagonal ?x1 ?y1 ?x2 ?y2) + (onboard ?x2 ?y2) + (true (cell ?x2 ?y2 ?player2)) + (distinct ?player ?player2)) +(<= (legal ?player (move ?x1 ?y1 ?x2 ?y2)) + (true (control ?player)) + (true (cell ?x1 ?y1 ?player)) + (ell ?x1 ?y1 ?x2 ?y2) + (opencell ?x2 ?y2)) +(<= (next (control ?p2)) + (true (control ?p1)) + (rotation ?p1 ?p2)) +(<= (next (cell ?x2 ?y2 ?player)) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (next (cell ?x ?y ?piece)) + (true (cell ?x ?y ?piece)) + (not (camefrom ?x ?y)) + (not (wentto ?x ?y))) +(<= (next (cell ?x ?y ?player)) + (spawns ?x ?y ?player)) +(<= (next (step ?t2)) + (true (step ?t1)) + (stepcount ?t1 ?t2)) +(<= terminal + (role ?player) + (line ?player)) +(<= terminal + (true (step 31))) +(<= (goal ?player 0) + (role ?player) + (not (line ?player))) +(<= (goal ?player 100) + (role ?player) + (line ?player)) +(<= (orthogonal ?x1 ?y ?x2 ?y) + (plus 1 ?x1 ?x2) + (index ?y)) +(<= (orthogonal ?x1 ?y ?x2 ?y) + (plus 1 ?x2 ?x1) + (index ?y)) +(<= (orthogonal ?x ?y1 ?x ?y2) + (index ?x) + (plus 1 ?y1 ?y2)) +(<= (orthogonal ?x ?y1 ?x ?y2) + (index ?x) + (plus 1 ?y2 ?y1)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 1 ?y1 ?y2)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 1 ?y2 ?y1)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 1 ?y1 ?y2)) +(<= (diagonal ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x1 ?x2) + (plus 1 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x1 ?x2) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x2 ?x1) + (plus 1 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 2 ?x2 ?x1) + (plus 1 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 2 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x1 ?x2) + (plus 2 ?y2 ?y1)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 2 ?y1 ?y2)) +(<= (ell ?x1 ?y1 ?x2 ?y2) + (plus 1 ?x2 ?x1) + (plus 2 ?y2 ?y1)) +(<= (opencell ?x ?y) + (onboard ?x ?y) + (not (true (cell ?x ?y red))) + (not (true (cell ?x ?y yellow))) + (not (true (cell ?x ?y blue)))) +(<= (onboard ?x ?y) + (index ?x) + (index ?y) + (distinct ?x 1) + (distinct ?x 7) + (distinct ?y 1) + (distinct ?y 7)) +(<= (camefrom ?x1 ?y1) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (wentto ?x2 ?y2) + (does ?player (move ?x1 ?y1 ?x2 ?y2))) +(<= (line ?player) + (row ?player)) +(<= (line ?player) + (column ?player)) +(<= (line ?player) + (diag ?player)) +(<= (row ?player) + (true (cell 3 3 ?player)) + (true (cell 4 3 ?player)) + (true (cell 5 3 ?player))) +(<= (row ?player) + (true (cell 3 4 ?player)) + (true (cell 4 4 ?player)) + (true (cell 5 4 ?player))) +(<= (row ?player) + (true (cell 3 5 ?player)) + (true (cell 4 5 ?player)) + (true (cell 5 5 ?player))) +(<= (column ?player) + (true (cell 3 3 ?player)) + (true (cell 3 4 ?player)) + (true (cell 3 5 ?player))) +(<= (column ?player) + (true (cell 4 3 ?player)) + (true (cell 4 4 ?player)) + (true (cell 4 5 ?player))) +(<= (column ?player) + (true (cell 5 3 ?player)) + (true (cell 5 4 ?player)) + (true (cell 5 5 ?player))) +(<= (diag ?player) + (true (cell 3 3 ?player)) + (true (cell 4 4 ?player)) + (true (cell 5 5 ?player))) +(<= (diag ?player) + (true (cell 3 5 ?player)) + (true (cell 4 4 ?player)) + (true (cell 5 3 ?player))) +(index 1) +(index 2) +(index 3) +(index 4) +(index 5) +(index 6) +(index 7) +(plus 1 1 2) +(plus 1 2 3) +(plus 1 3 4) +(plus 1 4 5) +(plus 1 5 6) +(plus 1 6 7) +(plus 2 1 3) +(plus 2 2 4) +(plus 2 3 5) +(plus 2 4 6) +(plus 2 5 7) +(rotation red yellow) +(rotation yellow blue) +(rotation blue red) +(spawns 1 4 red) +(spawns 4 1 yellow) +(spawns 7 4 blue) +(stepcount 1 2) +(stepcount 2 3) +(stepcount 3 4) +(stepcount 4 5) +(stepcount 5 6) +(stepcount 6 7) +(stepcount 7 8) +(stepcount 8 9) +(stepcount 9 10) +(stepcount 10 11) +(stepcount 11 12) +(stepcount 12 13) +(stepcount 13 14) +(stepcount 14 15) +(stepcount 15 16) +(stepcount 16 17) +(stepcount 17 18) +(stepcount 18 19) +(stepcount 19 20) +(stepcount 20 21) +(stepcount 21 22) +(stepcount 22 23) +(stepcount 23 24) +(stepcount 24 25) +(stepcount 25 26) +(stepcount 26 27) +(stepcount 27 28) +(stepcount 28 29) +(stepcount 29 30) +(stepcount 30 31) + + + Added: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl =================================================================== --- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl (rev 0) +++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.0.qdimacs.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,378 @@ +(prop_var 1) +(prop_var 2) +(prop_var 3) +(prop_var 4) +(prop_var 5) +(prop_var 6) +(prop_var 7) +(prop_var 8) +(prop_var 9) +(prop_var 10) +(prop_var 11) +(prop_var 12) +(prop_var 13) +(prop_var 14) +(prop_var 15) +(prop_var 16) +(prop_var 17) +(prop_var 18) +(prop_var 19) +(prop_var 20) +(prop_var 21) +(prop_var 22) +(prop_var 23) +(prop_var 24) +(prop_var 25) +(prop_var 26) +(prop_var 27) +(prop_var 28) +(prop_var 29) +(prop_var 30) +(prop_var 31) +(prop_var 32) +(prop_var 33) +(prop_var 34) +(prop_var 35) +(prop_var 36) +(prop_var 37) +(prop_var 38) +(prop_var 39) +(prop_var 40) +(prop_var 41) +(prop_var 42) +(prop_var 43) +(prop_var 44) +(prop_var 45) +(prop_var 46) +(prop_var 47) +(prop_var 48) +(prop_var 49) +(prop_var 50) +(prop_var 51) +(prop_var 52) +(prop_var 53) +(prop_var 54) +(prop_var 55) +(prop_var 56) +(prop_var 57) +(prop_var 58) +(prop_var 59) +(prop_var 60) +(clause 1) +(clause 2) +(clause 3) +(clause 4) +(clause 5) +(clause 6) +(clause 7) +(clause 8) +(clause 9) +(clause 10) +(clause 11) +(clause 12) +(clause 13) +(clause 14) +(clause 15) +(clause 16) +(clause 17) +(clause 18) +(clause 19) +(clause 20) +(clause 21) +(clause 22) +(clause 23) +(clause 24) +(clause 25) +(clause 26) +(clause 27) +(clause 28) +(clause 29) +(clause 30) +(clause 31) +(clause 32) +(clause 33) +(clause 34) +(clause 35) +(clause 36) +(clause 37) +(clause 38) +(clause 39) +(clause 40) +(role exists) +(role forall) +(truth_value t) +(truth_value f) +(init (control exists 1)) +(<= (legal ?v488920 (assign ?v488930 ?v488931)) (true (control ?v488920 ?v488930)) (role ?v488920) (prop_var ?v488930) (truth_value ?v488931)) +(<= (legal exists noop) (true (control forall ?v488966)) (prop_var ?v488966)) +(<= (legal forall noop) (true (control exists ?v488966)) (prop_var ?v488966)) +(<= (next (sat ?v488990)) (true (sat ?v488990)) (clause ?v488990)) +(<= (next (control exists 2)) (true (control exists 1))) +(<= (next (control exists 3)) (true (control exists 2))) +(<= (next (control exists 4)) (true (control exists 3))) +(<= (next (control exists 5)) (true (control exists 4))) +(<= (next (control exists 6)) (true (control exists 5))) +(<= (next (control exists 7)) (true (control exists 6))) +(<= (next (control exists 8)) (true (control exists 7))) +(<= (next (control exists 9)) (true (control exists 8))) +(<= (next (control exists 10)) (true (control exists 9))) +(<= (next (control exists 11)) (true (control exists 10))) +(<= (next (control exists 12)) (true (control exists 11))) +(<= (next (control exists 13)) (true (control exists 12))) +(<= (next (control exists 14)) (true (control exists 13))) +(<= (next (control exists 15)) (true (control exists 14))) +(<= (next (control exists 16)) (true (control exists 15))) +(<= (next (control exists 17)) (true (control exists 16))) +(<= (next (control exists 18)) (true (control exists 17))) +(<= (next (control exists 19)) (true (control exists 18))) +(<= (next (control exists 20)) (true (control exists 19))) +(<= (next (control forall 21)) (true (control exists 20))) +(<= (next (control forall 22)) (true (control forall 21))) +(<= (next (control forall 23)) (true (control forall 22))) +(<= (next (control forall 24)) (true (control forall 23))) +(<= (next (control forall 25)) (true (control forall 24))) +(<= (next (control forall 26)) (true (control forall 25))) +(<= (next (control forall 27)) (true (control forall 26))) +(<= (next (control forall 28)) (true (control forall 27))) +(<= (next (control forall 29)) (true (control forall 28))) +(<= (next (control forall 30)) (true (control forall 29))) +(<= (next (control forall 31)) (true (control forall 30))) +(<= (next (control forall 32)) (true (control forall 31))) +(<= (next (control forall 33)) (true (control forall 32))) +(<= (next (control forall 34)) (true (control forall 33))) +(<= (next (control forall 35)) (true (control forall 34))) +(<= (next (control forall 36)) (true (control forall 35))) +(<= (next (control forall 37)) (true (control forall 36))) +(<= (next (control forall 38)) (true (control forall 37))) +(<= (next (control forall 39)) (true (control forall 38))) +(<= (next (control forall 40)) (true (control forall 39))) +(<= (next (control exists 41)) (true (control forall 40))) +(<= (next (control exists 42)) (true (control exists 41))) +(<= (next (control exists 43)) (true (control exists 42))) +(<= (next (control exists 44)) (true (control exists 43))) +(<= (next (control exists 45)) (true (control exists 44))) +(<= (next (control exists 46)) (true (control exists 45))) +(<= (next (control exists 47)) (true (control exists 46))) +(<= (next (control exists 48)) (true (control exists 47))) +(<= (next (control exists 49)) (true (control exists 48))) +(<= (next (control exists 50)) (true (control exists 49))) +(<= (next (control exists 51)) (true (control exists 50))) +(<= (next (control exists 52)) (true (control exists 51))) +(<= (next (control exists 53)) (true (control exists 52))) +(<= (next (control exists 54)) (true (control exists 53))) +(<= (next (control exists 55)) (true (control exists 54))) +(<= (next (control exists 56)) (true (control exists 55))) +(<= (next (control exists 57)) (true (control exists 56))) +(<= (next (control exists 58)) (true (control exists 57))) +(<= (next (control exists 59)) (true (control exists 58))) +(<= (next (control exists 60)) (true (control exists 59))) +(<= (next (control the end)) (true (control exists 60))) +(<= (next (sat 1)) (does ?v493768 (assign 56 f)) (role ?v493768)) +(<= (next (sat 1)) (does ?v493789 (assign 52 f)) (role ?v493789)) +(<= (next (sat 1)) (does ?v493810 (assign 55 f)) (role ?v493810)) +(<= (next (sat 1)) (does ?v493831 (assign 27 f)) (role ?v493831)) +(<= (next (sat 1)) (does ?v493852 (assign 18 t)) (role ?v493852)) +(<= (next (sat 2)) (does ?v493875 (assign 4 f)) (role ?v493875)) +(<= (next (sat 2)) (does ?v493896 (assign 29 t)) (role ?v493896)) +(<= (next (sat 2)) (does ?v493917 (assign 23 f)) (role ?v493917)) +(<= (next (sat 2)) (does ?v493938 (assign 58 f)) (role ?v493938)) +(<= (next (sat 2)) (does ?v493959 (assign 5 t)) (role ?v493959)) +(<= (next (sat 3)) (does ?v493982 (assign 29 t)) (role ?v493982)) +(<= (next (sat 3)) (does ?v494003 (assign 8 t)) (role ?v494003)) +(<= (next (sat 3)) (does ?v494024 (assign 7 f)) (role ?v494024)) +(<= (next (sat 3)) (does ?v494045 (assign 25 t)) (role ?v494045)) +(<= (next (sat 3)) (does ?v494066 (assign 24 t)) (role ?v494066)) +(<= (next (sat 4)) (does ?v494089 (assign 15 f)) (role ?v494089)) +(<= (next (sat 4)) (does ?v494110 (assign 11 t)) (role ?v494110)) +(<= (next (sat 4)) (does ?v494131 (assign 58 t)) (role ?v494131)) +(<= (next (sat 4)) (does ?v494152 (assign 19 t)) (role ?v494152)) +(<= (next (sat 4)) (does ?v494173 (assign 9 t)) (role ?v494173)) +(<= (next (sat 5)) (does ?v494196 (assign 1 f)) (role ?v494196)) +(<= (next (sat 5)) (does ?v494217 (assign 42 f)) (role ?v494217)) +(<= (next (sat 5)) (does ?v494238 (assign 30 f)) (role ?v494238)) +(<= (next (sat 5)) (does ?v494259 (assign 58 t)) (role ?v494259)) +(<= (next (sat 5)) (does ?v494280 (assign 21 t)) (role ?v494280)) +(<= (next (sat 6)) (does ?v494303 (assign 33 f)) (role ?v494303)) +(<= (next (sat 6)) (does ?v494324 (assign 39 t)) (role ?v494324)) +(<= (next (sat 6)) (does ?v494345 (assign 59 t)) (role ?v494345)) +(<= (next (sat 6)) (does ?v494366 (assign 60 t)) (role ?v494366)) +(<= (next (sat 6)) (does ?v494387 (assign 29 f)) (role ?v494387)) +(<= (next (sat 7)) (does ?v494410 (assign 9 f)) (role ?v494410)) +(<= (next (sat 7)) (does ?v494431 (assign 20 t)) (role ?v494431)) +(<= (next (sat 7)) (does ?v494452 (assign 34 f)) (role ?v494452)) +(<= (next (sat 7)) (does ?v494473 (assign 29 t)) (role ?v494473)) +(<= (next (sat 7)) (does ?v494494 (assign 3 t)) (role ?v494494)) +(<= (next (sat 8)) (does ?v494517 (assign 56 f)) (role ?v494517)) +(<= (next (sat 8)) (does ?v494538 (assign 28 f)) (role ?v494538)) +(<= (next (sat 8)) (does ?v494559 (assign 17 t)) (role ?v494559)) +(<= (next (sat 8)) (does ?v494580 (assign 1 t)) (role ?v494580)) +(<= (next (sat 8)) (does ?v494601 (assign 51 f)) (role ?v494601)) +(<= (next (sat 9)) (does ?v494624 (assign 17 t)) (role ?v494624)) +(<= (next (sat 9)) (does ?v494645 (assign 49 f)) (role ?v494645)) +(<= (next (sat 9)) (does ?v494666 (assign 27 t)) (role ?v494666)) +(<= (next (sat 9)) (does ?v494687 (assign 24 f)) (role ?v494687)) +(<= (next (sat 9)) (does ?v494708 (assign 56 t)) (role ?v494708)) +(<= (next (sat 10)) (does ?v494731 (assign 47 f)) (role ?v494731)) +(<= (next (sat 10)) (does ?v494752 (assign 34 f)) (role ?v494752)) +(<= (next (sat 10)) (does ?v494773 (assign 26 f)) (role ?v494773)) +(<= (next (sat 10)) (does ?v494794 (assign 20 f)) (role ?v494794)) +(<= (next (sat 10)) (does ?v494815 (assign 39 t)) (role ?v494815)) +(<= (next (sat 11)) (does ?v494838 (assign 17 f)) (role ?v494838)) +(<= (next (sat 11)) (does ?v494859 (assign 20 f)) (role ?v494859)) +(<= (next (sat 11)) (does ?v494880 (assign 48 t)) (role ?v494880)) +(<= (next (sat 11)) (does ?v494901 (assign 10 f)) (role ?v494901)) +(<= (next (sat 11)) (does ?v494922 (assign 8 t)) (role ?v494922)) +(<= (next (sat 12)) (does ?v494945 (assign 24 f)) (role ?v494945)) +(<= (next (sat 12)) (does ?v494966 (assign 52 f)) (role ?v494966)) +(<= (next (sat 12)) (does ?v494987 (assign 13 t)) (role ?v494987)) +(<= (next (sat 12)) (does ?v495008 (assign 20 t)) (role ?v495008)) +(<= (next (sat 12)) (does ?v495029 (assign 26 f)) (role ?v495029)) +(<= (next (sat 13)) (does ?v495052 (assign 57 f)) (role ?v495052)) +(<= (next (sat 13)) (does ?v495073 (assign 30 t)) (role ?v495073)) +(<= (next (sat 13)) (does ?v495094 (assign 36 t)) (role ?v495094)) +(<= (next (sat 13)) (does ?v495115 (assign 46 f)) (role ?v495115)) +(<= (next (sat 13)) (does ?v495136 (assign 43 t)) (role ?v495136)) +(<= (next (sat 14)) (does ?v495159 (assign 1 t)) (role ?v495159)) +(<= (next (sat 14)) (does ?v495180 (assign 28 t)) (role ?v495180)) +(<= (next (sat 14)) (does ?v495201 (assign 21 f)) (role ?v495201)) +(<= (next (sat 14)) (does ?v495222 (assign 2 t)) (role ?v495222)) +(<= (next (sat 14)) (does ?v495243 (assign 23 f)) (role ?v495243)) +(<= (next (sat 15)) (does ?v495266 (assign 33 f)) (role ?v495266)) +(<= (next (sat 15)) (does ?v495287 (assign 30 f)) (role ?v495287)) +(<= (next (sat 15)) (does ?v495308 (assign 3 f)) (role ?v495308)) +(<= (next (sat 15)) (does ?v495329 (assign 41 t)) (role ?v495329)) +(<= (next (sat 15)) (does ?v495350 (assign 32 f)) (role ?v495350)) +(<= (next (sat 16)) (does ?v495373 (assign 52 t)) (role ?v495373)) +(<= (next (sat 16)) (does ?v495394 (assign 41 f)) (role ?v495394)) +(<= (next (sat 16)) (does ?v495415 (assign 49 t)) (role ?v495415)) +(<= (next (sat 16)) (does ?v495436 (assign 60 t)) (role ?v495436)) +(<= (next (sat 16)) (does ?v495457 (assign 34 t)) (role ?v495457)) +(<= (next (sat 17)) (does ?v495480 (assign 57 f)) (role ?v495480)) +(<= (next (sat 17)) (does ?v495501 (assign 28 t)) (role ?v495501)) +(<= (next (sat 17)) (does ?v495522 (assign 23 t)) (role ?v495522)) +(<= (next (sat 17)) (does ?v495543 (assign 50 f)) (role ?v495543)) +(<= (next (sat 17)) (does ?v495564 (assign 59 t)) (role ?v495564)) +(<= (next (sat 18)) (does ?v495587 (assign 41 t)) (role ?v495587)) +(<= (next (sat 18)) (does ?v495608 (assign 38 f)) (role ?v495608)) +(<= (next (sat 18)) (does ?v495629 (assign 5 t)) (role ?v495629)) +(<= (next (sat 18)) (does ?v495650 (assign 35 f)) (role ?v495650)) +(<= (next (sat 18)) (does ?v495671 (assign 11 t)) (role ?v495671)) +(<= (next (sat 19)) (does ?v495694 (assign 45 f)) (role ?v495694)) +(<= (next (sat 19)) (does ?v495715 (assign 53 t)) (role ?v495715)) +(<= (next (sat 19)) (does ?v495736 (assign 33 t)) (role ?v495736)) +(<= (next (sat 19)) (does ?v495757 (assign 52 t)) (role ?v495757)) +(<= (next (sat 19)) (does ?v495778 (assign 8 t)) (role ?v495778)) +(<= (next (sat 20)) (does ?v495801 (assign 19 f)) (role ?v495801)) +(<= (next (sat 20)) (does ?v495822 (assign 3 f)) (role ?v495822)) +(<= (next (sat 20)) (does ?v495843 (assign 49 f)) (role ?v495843)) +(<= (next (sat 20)) (does ?v495864 (assign 23 f)) (role ?v495864)) +(<= (next (sat 20)) (does ?v495885 (assign 40 t)) (role ?v495885)) +(<= (next (sat 21)) (does ?v495908 (assign 29 t)) (role ?v495908)) +(<= (next (sat 21)) (does ?v495929 (assign 9 f)) (role ?v495929)) +(<= (next (sat 21)) (does ?v495950 (assign 25 t)) (role ?v495950)) +(<= (next (sat 21)) (does ?v495971 (assign 45 t)) (role ?v495971)) +(<= (next (sat 21)) (does ?v495992 (assign 24 f)) (role ?v495992)) +(<= (next (sat 22)) (does ?v496015 (assign 33 f)) (role ?v496015)) +(<= (next (sat 22)) (does ?v496036 (assign 36 t)) (role ?v496036)) +(<= (next (sat 22)) (does ?v496057 (assign 51 f)) (role ?v496057)) +(<= (next (sat 22)) (does ?v496078 (assign 34 t)) (role ?v496078)) +(<= (next (sat 22)) (does ?v496099 (assign 46 t)) (role ?v496099)) +(<= (next (sat 23)) (does ?v496122 (assign 22 t)) (role ?v496122)) +(<= (next (sat 23)) (does ?v496143 (assign 55 t)) (role ?v496143)) +(<= (next (sat 23)) (does ?v496164 (assign 51 t)) (role ?v496164)) +(<= (next (sat 23)) (does ?v496185 (assign 20 f)) (role ?v496185)) +(<= (next (sat 23)) (does ?v496206 (assign 47 f)) (role ?v496206)) +(<= (next (sat 24)) (does ?v496229 (assign 6 f)) (role ?v496229)) +(<= (next (sat 24)) (does ?v496250 (assign 58 f)) (role ?v496250)) +(<= (next (sat 24)) (does ?v496271 (assign 26 f)) (role ?v496271)) +(<= (next (sat 24)) (does ?v496292 (assign 38 f)) (role ?v496292)) +(<= (next (sat 24)) (does ?v496313 (assign 31 f)) (role ?v496313)) +(<= (next (sat 25)) (does ?v496336 (assign 5 f)) (role ?v496336)) +(<= (next (sat 25)) (does ?v496357 (assign 29 t)) (role ?v496357)) +(<= (next (sat 25)) (does ?v496378 (assign 59 f)) (role ?v496378)) +(<= (next (sat 25)) (does ?v496399 (assign 53 t)) (role ?v496399)) +(<= (next (sat 25)) (does ?v496420 (assign 25 t)) (role ?v496420)) +(<= (next (sat 26)) (does ?v496443 (assign 19 f)) (role ?v496443)) +(<= (next (sat 26)) (does ?v496464 (assign 2 f)) (role ?v496464)) +(<= (next (sat 26)) (does ?v496485 (assign 42 t)) (role ?v496485)) +(<= (next (sat 26)) (does ?v496506 (assign 23 f)) (role ?v496506)) +(<= (next (sat 26)) (does ?v496527 (assign 22 f)) (role ?v496527)) +(<= (next (sat 27)) (does ?v496550 (assign 41 t)) (role ?v496550)) +(<= (next (sat 27)) (does ?v496571 (assign 29 f)) (role ?v496571)) +(<= (next (sat 27)) (does ?v496592 (assign 56 f)) (role ?v496592)) +(<= (next (sat 27)) (does ?v496613 (assign 11 t)) (role ?v496613)) +(<= (next (sat 27)) (does ?v496634 (assign 52 f)) (role ?v496634)) +(<= (next (sat 28)) (does ?v496657 (assign 41 f)) (role ?v496657)) +(<= (next (sat 28)) (does ?v496678 (assign 13 t)) (role ?v496678)) +(<= (next (sat 28)) (does ?v496699 (assign 51 f)) (role ?v496699)) +(<= (next (sat 28)) (does ?v496720 (assign 47 f)) (role ?v496720)) +(<= (next (sat 28)) (does ?v496741 (assign 14 f)) (role ?v496741)) +(<= (next (sat 29)) (does ?v496764 (assign 51 f)) (role ?v496764)) +(<= (next (sat 29)) (does ?v496785 (assign 24 f)) (role ?v496785)) +(<= (next (sat 29)) (does ?v496806 (assign 60 f)) (role ?v496806)) +(<= (next (sat 29)) (does ?v496827 (assign 53 f)) (role ?v496827)) +(<= (next (sat 29)) (does ?v496848 (assign 25 t)) (role ?v496848)) +(<= (next (sat 30)) (does ?v496871 (assign 16 f)) (role ?v496871)) +(<= (next (sat 30)) (does ?v496892 (assign 39 f)) (role ?v496892)) +(<= (next (sat 30)) (does ?v496913 (assign 49 f)) (role ?v496913)) +(<= (next (sat 30)) (does ?v496934 (assign 51 t)) (role ?v496934)) +(<= (next (sat 30)) (does ?v496955 (assign 40 f)) (role ?v496955)) +(<= (next (sat 31)) (does ?v496978 (assign 33 f)) (role ?v496978)) +(<= (next (sat 31)) (does ?v496999 (assign 15 t)) (role ?v496999)) +(<= (next (sat 31)) (does ?v497020 (assign 36 t)) (role ?v497020)) +(<= (next (sat 31)) (does ?v497041 (assign 44 t)) (role ?v497041)) +(<= (next (sat 31)) (does ?v497062 (assign 60 t)) (role ?v497062)) +(<= (next (sat 32)) (does ?v497085 (assign 60 f)) (role ?v497085)) +(<= (next (sat 32)) (does ?v497106 (assign 25 f)) (role ?v497106)) +(<= (next (sat 32)) (does ?v497127 (assign 57 t)) (role ?v497127)) +(<= (next (sat 32)) (does ?v497148 (assign 24 t)) (role ?v497148)) +(<= (next (sat 32)) (does ?v497169 (assign 14 t)) (role ?v497169)) +(<= (next (sat 33)) (does ?v497192 (assign 26 t)) (role ?v497192)) +(<= (next (sat 33)) (does ?v497213 (assign 49 f)) (role ?v497213)) +(<= (next (sat 33)) (does ?v497234 (assign 55 t)) (role ?v497234)) +(<= (next (sat 33)) (does ?v497255 (assign 52 t)) (role ?v497255)) +(<= (next (sat 33)) (does ?v497276 (assign 42 t)) (role ?v497276)) +(<= (next (sat 34)) (does ?v497299 (assign 36 t)) (role ?v497299)) +(<= (next (sat 34)) (does ?v497320 (assign 6 f)) (role ?v497320)) +(<= (next (sat 34)) (does ?v497341 (assign 51 t)) (role ?v497341)) +(<= (next (sat 34)) (does ?v497362 (assign 56 t)) (role ?v497362)) +(<= (next (sat 34)) (does ?v497383 (assign 24 t)) (role ?v497383)) +(<= (next (sat 35)) (does ?v497406 (assign 6 f)) (role ?v497406)) +(<= (next (sat 35)) (does ?v497427 (assign 31 t)) (role ?v497427)) +(<= (next (sat 35)) (does ?v497448 (assign 18 t)) (role ?v497448)) +(<= (next (sat 35)) (does ?v497469 (assign 36 f)) (role ?v497469)) +(<= (next (sat 35)) (does ?v497490 (assign 37 t)) (role ?v497490)) +(<= (next (sat 36)) (does ?v497513 (assign 33 t)) (role ?v497513)) +(<= (next (sat 36)) (does ?v497534 (assign 46 f)) (role ?v497534)) +(<= (next (sat 36)) (does ?v497555 (assign 5 t)) (role ?v497555)) +(<= (next (sat 36)) (does ?v497576 (assign 20 f)) (role ?v497576)) +(<= (next (sat 36)) (does ?v497597 (assign 22 f)) (role ?v497597)) +(<= (next (sat 37)) (does ?v497620 (assign 47 f)) (role ?v497620)) +(<= (next (sat 37)) (does ?v497641 (assign 27 t)) (role ?v497641)) +(<= (next (sat 37)) (does ?v497662 (assign 32 t)) (role ?v497662)) +(<= (next (sat 37)) (does ?v497683 (assign 14 f)) (role ?v497683)) +(<= (next (sat 37)) (does ?v497704 (assign 52 t)) (role ?v497704)) +(<= (next (sat 38)) (does ?v497727 (assign 53 t)) (role ?v497727)) +(<= (next (sat 38)) (does ?v497748 (assign 43 t)) (role ?v497748)) +(<= (next (sat 38)) (does ?v497769 (assign 58 f)) (role ?v497769)) +(<= (next (sat 38)) (does ?v497790 (assign 50 t)) (role ?v497790)) +(<= (next (sat 38)) (does ?v497811 (assign 42 f)) (role ?v497811)) +(<= (next (sat 39)) (does ?v497834 (assign 6 f)) (role ?v497834)) +(<= (next (sat 39)) (does ?v497855 (assign 13 t)) (role ?v497855)) +(<= (next (sat 39)) (does ?v497876 (assign 43 t)) (role ?v497876)) +(<= (next (sat 39)) (does ?v497897 (assign 31 t)) (role ?v497897)) +(<= (next (sat 39)) (does ?v497918 (assign 22 f)) (role ?v497918)) +(<= (next (sat 40)) (does ?v497941 (assign 38 t)) (role ?v497941)) +(<= (next (sat 40)) (does ?v497962 (assign 2 t)) (role ?v497962)) +(<= (next (sat 40)) (does ?v497983 (assign 16 t)) (role ?v497983)) +(<= (next (sat 40)) (does ?v498004 (assign 51 t)) (role ?v498004)) +(<= (next (sat 40)) (does ?v498025 (assign 26 f)) (role ?v498025)) +(<= all_sat (true (sat 1)) (true (sat 2)) (true (sat 3)) (true (sat 4)) (true (sat 5)) (true (sat 6)) (true (sat 7)) (true (sat 8)) (true (sat 9)) (true (sat 10)) (true (sat 11)) (true (sat 12)) (true (sat 13)) (true (sat 14)) (true (sat 15)) (true (sat 16)) (true (sat 17)) (true (sat 18)) (true (sat 19)) (true (sat 20)) (true (sat 21)) (true (sat 22)) (true (sat 23)) (true (sat 24)) (true (sat 25)) (true (sat 26)) (true (sat 27)) (true (sat 28)) (true (sat 29)) (true (sat 30)) (true (sat 31)) (true (sat 32)) (true (sat 33)) (true (sat 34)) (true (sat 35)) (true (sat 36)) (true (sat 37)) (true (sat 38)) (true (sat 39)) (true (sat 40))) +(<= terminal all_sat) +(<= terminal (true (control the end))) +(<= (goal exists 100) all_sat) +(<= (goal exists 0) (not all_sat)) +(<= (goal forall 100) (not all_sat)) +(<= (goal forall 0) all_sat) + + Added: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.SAT.gdl =================================================================== --- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.SAT.gdl (rev 0) +++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.SAT.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,578 @@ +(contains 1 (not 1)) +(contains 1 52) +(contains 1 16) +(contains 1 4) +(contains 1 (not 27)) +(contains 2 (not 27)) +(contains 2 (not 51)) +(contains 2 19) +(contains 2 1) +(contains 2 30) +(contains 3 35) +(contains 3 52) +(contains 3 (not 41)) +(contains 3 (not 18)) +(contains 3 (not 59)) +(contains 4 24) +(contains 4 30) +(contains 4 20) +(contains 4 (not 7)) +(contains 4 (not 23)) +(contains 5 (not 34)) +(contains 5 (not 4)) +(contains 5 13) +(contains 5 (not 49)) +(contains 5 (not 17)) +(contains 6 51) +(contains 6 (not 37)) +(contains 6 1) +(contains 6 5) +(contains 6 (not 29)) +(contains 7 (not 2)) +(contains 7 (not 7)) +(contains 7 (not 53)) +(contains 7 (not 12)) +(contains 7 (not 35)) +(contains 8 (not 39)) +(contains 8 (not 44)) +(contains 8 28) +(contains 8 (not 2)) +(contains 8 51) +(contains 9 (not 21)) +(contains 9 (not 11)) +(contains 9 8) +(contains 9 (not 20)) +(contains 9 2) +(contains 10 (not 37)) +(contains 10 (not 21)) +(contains 10 58) +(contains 10 (not 59)) +(contains 10 7) +(contains 11 33) +(contains 11 59) +(contains 11 (not 41)) +(contains 11 52) +(contains 11 21) +(contains 12 43) +(contains 12 35) +(contains 12 (not 7)) +(contains 12 33) +(contains 12 50) +(contains 13 29) +(contains 13 45) +(contains 13 (not 14)) +(contains 13 25) +(contains 13 24) +(contains 14 (not 21)) +(contains 14 54) +(contains 14 49) +(contains 14 2) +(contains 14 42) +(contains 15 (not 25)) +(contains 15 7) +(contains 15 (not 43)) +(contains 15 (not 39)) +(contains 15 59) +(contains 16 32) +(contains 16 (not 30)) +(contains 16 14) +(contains 16 17) +(contains 16 51) +(contains 17 (not 9)) +(contains 17 44) +(contains 17 (not 3)) +(contains 17 4) +(contains 17 (not 54)) +(contains 18 (not 46)) +(contains 18 48) +(contains 18 55) +(contains 18 (not 6)) +(contains 18 59) +(contains 19 51) +(contains 19 (not 12)) +(contains 19 1) +(contains 19 52) +(contains 19 58) +(contains 20 (not 8)) +(contains 20 47) +(contains 20 19) +(contains 20 (not 42)) +(contains 20 (not 12)) +(contains 21 (not 39)) +(contains 21 11) +(contains 21 1) +(contains 21 (not 41)) +(contains 21 (not 31)) +(contains 22 (not 26)) +(contains 22 34) +(contains 22 9) +(contains 22 (not 35)) +(contains 22 41) +(contains 23 54) +(contains 23 26) +(contains 23 (not 47)) +(contains 23 31) +(contains 23 (not 36)) +(contains 24 (not 15)) +(contains 24 (not 60)) +(contains 24 (not 13)) +(contains 24 6) +(contains 24 47) +(contains 25 (not 21)) +(contains 25 (not 10)) +(contains 25 26) +(contains 25 33) +(contains 25 15) +(contains 26 (not 20)) +(contains 26 11) +(contains 26 49) +(contains 26 12) +(contains 26 (not 41)) +(contains 27 (not 3)) +(contains 27 53) +(contains 27 15) +(contains 27 (not 23)) +(contains 27 58) +(contains 28 (not 3)) +(contains 28 (not 48)) +(contains 28 (not 21)) +(contains 28 59) +(contains 28 46) +(contains 29 28) +(contains 29 25) +(contains 29 (not 10)) +(contains 29 18) +(contains 29 4) +(contains 30 (not 55)) +(contains 30 7) +(contains 30 (not 44)) +(contains 30 22) +(contains 30 (not 32)) +(contains 31 (not 12)) +(contains 31 (not 35)) +(contains 31 (not 48)) +(contains 31 (not 14)) +(contains 31 (not 39)) +(contains 32 13) +(contains 32 (not 45)) +(contains 32 49) +(contains 32 (not 35)) +(contains 32 60) +(contains 33 (not 60)) +(contains 33 27) +(contains 33 (not 19)) +(contains 33 (not 25)) +(contains 33 29) +(contains 34 (not 12)) +(contains 34 43) +(contains 34 3) +(contains 34 (not 5)) +(contains 34 30) +(contains 35 (not 9)) +(contains 35 50) +(contains 35 (not 19)) +(contains 35 (not 59)) +(contains 35 (not 2)) +(contains 36 (not 20)) +(contains 36 14) +(contains 36 (not 58)) +(contains 36 (not 12)) +(contains 36 (not 34)) +(contains 37 22) +(contains 37 (not 16)) +(contains 37 (not 4)) +(contains 37 (not 14)) +(contains 37 52) +(contains 38 (not 45)) +(contains 38 (not 13)) +(contains 38 47) +(contains 38 (not 12)) +(contains 38 15) +(contains 39 (not 50)) +(contains 39 60) +(contains 39 9) +(contains 39 (not 4)) +(contains 39 18) +(contains 40 (not 10)) +(contains 40 (not 54)) +(contains 40 (not 15)) +(contains 40 47) +(contains 40 (not 22)) +(prop_var 1) +(prop_var 2) +(prop_var 3) +(prop_var 4) +(prop_var 5) +(prop_var 6) +(prop_var 7) +(prop_var 8) +(prop_var 9) +(prop_var 10) +(prop_var 11) +(prop_var 12) +(prop_var 13) +(prop_var 14) +(prop_var 15) +(prop_var 16) +(prop_var 17) +(prop_var 18) +(prop_var 19) +(prop_var 20) +(prop_var 21) +(prop_var 22) +(prop_var 23) +(prop_var 24) +(prop_var 25) +(prop_var 26) +(prop_var 27) +(prop_var 28) +(prop_var 29) +(prop_var 30) +(prop_var 31) +(prop_var 32) +(prop_var 33) +(prop_var 34) +(prop_var 35) +(prop_var 36) +(prop_var 37) +(prop_var 38) +(prop_var 39) +(prop_var 40) +(prop_var 41) +(prop_var 42) +(prop_var 43) +(prop_var 44) +(prop_var 45) +(prop_var 46) +(prop_var 47) +(prop_var 48) +(prop_var 49) +(prop_var 50) +(prop_var 51) +(prop_var 52) +(prop_var 53) +(prop_var 54) +(prop_var 55) +(prop_var 56) +(prop_var 57) +(prop_var 58) +(prop_var 59) +(prop_var 60) +(clause 1) +(clause 2) +(clause 3) +(clause 4) +(clause 5) +(clause 6) +(clause 7) +(clause 8) +(clause 9) +(clause 10) +(clause 11) +(clause 12) +(clause 13) +(clause 14) +(clause 15) +(clause 16) +(clause 17) +(clause 18) +(clause 19) +(clause 20) +(clause 21) +(clause 22) +(clause 23) +(clause 24) +(clause 25) +(clause 26) +(clause 27) +(clause 28) +(clause 29) +(clause 30) +(clause 31) +(clause 32) +(clause 33) +(clause 34) +(clause 35) +(clause 36) +(clause 37) +(clause 38) +(clause 39) +(clause 40) +(role exists) +(role forall) +(truth_value t) +(truth_value f) +(init (control exists 1)) +(<= (legal ?v5689 (assign ?v5699 ?v5700)) (true (control ?v5689 ?v5699)) (role ?v5689) (prop_var ?v5699) (truth_value ?v5700)) +(<= (legal exists noop) (true (control forall ?v5735)) (prop_var ?v5735)) +(<= (legal forall noop) (true (control exists ?v5735)) (prop_var ?v5735)) +(<= (next (sat ?v5759)) (true (sat ?v5759)) (clause ?v5759)) +(<= (next (control exists 2)) (true (control exists 1))) +(<= (next (control exists 3)) (true (control exists 2))) +(<= (next (control exists 4)) (true (control exists 3))) +(<= (next (control exists 5)) (true (control exists 4))) +(<= (next (control exists 6)) (true (control exists 5))) +(<= (next (control exists 7)) (true (control exists 6))) +(<= (next (control exists 8)) (true (control exists 7))) +(<= (next (control exists 9)) (true (control exists 8))) +(<= (next (control exists 10)) (true (control exists 9))) +(<= (next (control exists 11)) (true (control exists 10))) +(<= (next (control exists 12)) (true (control exists 11))) +(<= (next (control exists 13)) (true (control exists 12))) +(<= (next (control exists 14)) (true (control exists 13))) +(<= (next (control exists 15)) (true (control exists 14))) +(<= (next (control exists 16)) (true (control exists 15))) +(<= (next (control exists 17)) (true (control exists 16))) +(<= (next (control exists 18)) (true (control exists 17))) +(<= (next (control exists 19)) (true (control exists 18))) +(<= (next (control exists 20)) (true (control exists 19))) +(<= (next (control forall 21)) (true (control exists 20))) +(<= (next (control forall 22)) (true (control forall 21))) +(<= (next (control forall 23)) (true (control forall 22))) +(<= (next (control forall 24)) (true (control forall 23))) +(<= (next (control forall 25)) (true (control forall 24))) +(<= (next (control forall 26)) (true (control forall 25))) +(<= (next (control forall 27)) (true (control forall 26))) +(<= (next (control forall 28)) (true (control forall 27))) +(<= (next (control forall 29)) (true (control forall 28))) +(<= (next (control forall 30)) (true (control forall 29))) +(<= (next (control forall 31)) (true (control forall 30))) +(<= (next (control forall 32)) (true (control forall 31))) +(<= (next (control forall 33)) (true (control forall 32))) +(<= (next (control forall 34)) (true (control forall 33))) +(<= (next (control forall 35)) (true (control forall 34))) +(<= (next (control forall 36)) (true (control forall 35))) +(<= (next (control forall 37)) (true (control forall 36))) +(<= (next (control forall 38)) (true (control forall 37))) +(<= (next (control forall 39)) (true (control forall 38))) +(<= (next (control forall 40)) (true (control forall 39))) +(<= (next (control exists 41)) (true (control forall 40))) +(<= (next (control exists 42)) (true (control exists 41))) +(<= (next (control exists 43)) (true (control exists 42))) +(<= (next (control exists 44)) (true (control exists 43))) +(<= (next (control exists 45)) (true (control exists 44))) +(<= (next (control exists 46)) (true (control exists 45))) +(<= (next (control exists 47)) (true (control exists 46))) +(<= (next (control exists 48)) (true (control exists 47))) +(<= (next (control exists 49)) (true (control exists 48))) +(<= (next (control exists 50)) (true (control exists 49))) +(<= (next (control exists 51)) (true (control exists 50))) +(<= (next (control exists 52)) (true (control exists 51))) +(<= (next (control exists 53)) (true (control exists 52))) +(<= (next (control exists 54)) (true (control exists 53))) +(<= (next (control exists 55)) (true (control exists 54))) +(<= (next (control exists 56)) (true (control exists 55))) +(<= (next (control exists 57)) (true (control exists 56))) +(<= (next (control exists 58)) (true (control exists 57))) +(<= (next (control exists 59)) (true (control exists 58))) +(<= (next (control exists 60)) (true (control exists 59))) +(<= (next (control the end)) (true (control exists 60))) +(<= (next (sat 1)) (does ?v9608 (assign 1 f)) (role ?v9608)) +(<= (next (sat 1)) (does ?v9629 (assign 52 t)) (role ?v9629)) +(<= (next (sat 1)) (does ?v9650 (assign 16 t)) (role ?v9650)) +(<= (next (sat 1)) (does ?v9671 (assign 4 t)) (role ?v9671)) +(<= (next (sat 1)) (does ?v9692 (assign 27 f)) (role ?v9692)) +(<= (next (sat 2)) (does ?v9715 (assign 27 f)) (role ?v9715)) +(<= (next (sat 2)) (does ?v9736 (assign 51 f)) (role ?v9736)) +(<= (next (sat 2)) (does ?v9757 (assign 19 t)) (role ?v9757)) +(<= (next (sat 2)) (does ?v9778 (assign 1 t)) (role ?v9778)) +(<= (next (sat 2)) (does ?v9799 (assign 30 t)) (role ?v9799)) +(<= (next (sat 3)) (does ?v9822 (assign 35 t)) (role ?v9822)) +(<= (next (sat 3)) (does ?v9843 (assign 52 t)) (role ?v9843)) +(<= (next (sat 3)) (does ?v9864 (assign 41 f)) (role ?v9864)) +(<= (next (sat 3)) (does ?v9885 (assign 18 f)) (role ?v9885)) +(<= (next (sat 3)) (does ?v9906 (assign 59 f)) (role ?v9906)) +(<= (next (sat 4)) (does ?v9929 (assign 24 t)) (role ?v9929)) +(<= (next (sat 4)) (does ?v9950 (assign 30 t)) (role ?v9950)) +(<= (next (sat 4)) (does ?v9971 (assign 20 t)) (role ?v9971)) +(<= (next (sat 4)) (does ?v9992 (assign 7 f)) (role ?v9992)) +(<= (next (sat 4)) (does ?v10013 (assign 23 f)) (role ?v10013)) +(<= (next (sat 5)) (does ?v10036 (assign 34 f)) (role ?v10036)) +(<= (next (sat 5)) (does ?v10057 (assign 4 f)) (role ?v10057)) +(<= (next (sat 5)) (does ?v10078 (assign 13 t)) (role ?v10078)) +(<= (next (sat 5)) (does ?v10099 (assign 49 f)) (role ?v10099)) +(<= (next (sat 5)) (does ?v10120 (assign 17 f)) (role ?v10120)) +(<= (next (sat 6)) (does ?v10143 (assign 51 t)) (role ?v10143)) +(<= (next (sat 6)) (does ?v10164 (assign 37 f)) (role ?v10164)) +(<= (next (sat 6)) (does ?v10185 (assign 1 t)) (role ?v10185)) +(<= (next (sat 6)) (does ?v10206 (assign 5 t)) (role ?v10206)) +(<= (next (sat 6)) (does ?v10227 (assign 29 f)) (role ?v10227)) +(<= (next (sat 7)) (does ?v10250 (assign 2 f)) (role ?v10250)) +(<= (next (sat 7)) (does ?v10271 (assign 7 f)) (role ?v10271)) +(<= (next (sat 7)) (does ?v10292 (assign 53 f)) (role ?v10292)) +(<= (next (sat 7)) (does ?v10313 (assign 12 f)) (role ?v10313)) +(<= (next (sat 7)) (does ?v10334 (assign 35 f)) (role ?v10334)) +(<= (next (sat 8)) (does ?v10357 (assign 39 f)) (role ?v10357)) +(<= (next (sat 8)) (does ?v10378 (assign 44 f)) (role ?v10378)) +(<= (next (sat 8)) (does ?v10399 (assign 28 t)) (role ?v10399)) +(<= (next (sat 8)) (does ?v10420 (assign 2 f)) (role ?v10420)) +(<= (next (sat 8)) (does ?v10441 (assign 51 t)) (role ?v10441)) +(<= (next (sat 9)) (does ?v10464 (assign 21 f)) (role ?v10464)) +(<= (next (sat 9)) (does ?v10485 (assign 11 f)) (role ?v10485)) +(<= (next (sat 9)) (does ?v10506 (assign 8 t)) (role ?v10506)) +(<= (next (sat 9)) (does ?v10527 (assign 20 f)) (role ?v10527)) +(<= (next (sat 9)) (does ?v10548 (assign 2 t)) (role ?v10548)) +(<= (next (sat 10)) (does ?v10571 (assign 37 f)) (role ?v10571)) +(<= (next (sat 10)) (does ?v10592 (assign 21 f)) (role ?v10592)) +(<= (next (sat 10)) (does ?v10613 (assign 58 t)) (role ?v10613)) +(<= (next (sat 10)) (does ?v10634 (assign 59 f)) (role ?v10634)) +(<= (next (sat 10)) (does ?v10655 (assign 7 t)) (role ?v10655)) +(<= (next (sat 11)) (does ?v10678 (assign 33 t)) (role ?v10678)) +(<= (next (sat 11)) (does ?v10699 (assign 59 t)) (role ?v10699)) +(<= (next (sat 11)) (does ?v10720 (assign 41 f)) (role ?v10720)) +(<= (next (sat 11)) (does ?v10741 (assign 52 t)) (role ?v10741)) +(<= (next (sat 11)) (does ?v10762 (assign 21 t)) (role ?v10762)) +(<= (next (sat 12)) (does ?v10785 (assign 43 t)) (role ?v10785)) +(<= (next (sat 12)) (does ?v10806 (assign 35 t)) (role ?v10806)) +(<= (next (sat 12)) (does ?v10827 (assign 7 f)) (role ?v10827)) +(<= (next (sat 12)) (does ?v10848 (assign 33 t)) (role ?v10848)) +(<= (next (sat 12)) (does ?v10869 (assign 50 t)) (role ?v10869)) +(<= (next (sat 13)) (does ?v10892 (assign 29 t)) (role ?v10892)) +(<= (next (sat 13)) (does ?v10913 (assign 45 t)) (role ?v10913)) +(<= (next (sat 13)) (does ?v10934 (assign 14 f)) (role ?v10934)) +(<= (next (sat 13)) (does ?v10955 (assign 25 t)) (role ?v10955)) +(<= (next (sat 13)) (does ?v10976 (assign 24 t)) (role ?v10976)) +(<= (next (sat 14)) (does ?v10999 (assign 21 f)) (role ?v10999)) +(<= (next (sat 14)) (does ?v11020 (assign 54 t)) (role ?v11020)) +(<= (next (sat 14)) (does ?v11041 (assign 49 t)) (role ?v11041)) +(<= (next (sat 14)) (does ?v11062 (assign 2 t)) (role ?v11062)) +(<= (next (sat 14)) (does ?v11083 (assign 42 t)) (role ?v11083)) +(<= (next (sat 15)) (does ?v11106 (assign 25 f)) (role ?v11106)) +(<= (next (sat 15)) (does ?v11127 (assign 7 t)) (role ?v11127)) +(<= (next (sat 15)) (does ?v11148 (assign 43 f)) (role ?v11148)) +(<= (next (sat 15)) (does ?v11169 (assign 39 f)) (role ?v11169)) +(<= (next (sat 15)) (does ?v11190 (assign 59 t)) (role ?v11190)) +(<= (next (sat 16)) (does ?v11213 (assign 32 t)) (role ?v11213)) +(<= (next (sat 16)) (does ?v11234 (assign 30 f)) (role ?v11234)) +(<= (next (sat 16)) (does ?v11255 (assign 14 t)) (role ?v11255)) +(<= (next (sat 16)) (does ?v11276 (assign 17 t)) (role ?v11276)) +(<= (next (sat 16)) (does ?v11297 (assign 51 t)) (role ?v11297)) +(<= (next (sat 17)) (does ?v11320 (assign 9 f)) (role ?v11320)) +(<= (next (sat 17)) (does ?v11341 (assign 44 t)) (role ?v11341)) +(<= (next (sat 17)) (does ?v11362 (assign 3 f)) (role ?v11362)) +(<= (next (sat 17)) (does ?v11383 (assign 4 t)) (role ?v11383)) +(<= (next (sat 17)) (does ?v11404 (assign 54 f)) (role ?v11404)) +(<= (next (sat 18)) (does ?v11427 (assign 46 f)) (role ?v11427)) +(<= (next (sat 18)) (does ?v11448 (assign 48 t)) (role ?v11448)) +(<= (next (sat 18)) (does ?v11469 (assign 55 t)) (role ?v11469)) +(<= (next (sat 18)) (does ?v11490 (assign 6 f)) (role ?v11490)) +(<= (next (sat 18)) (does ?v11511 (assign 59 t)) (role ?v11511)) +(<= (next (sat 19)) (does ?v11534 (assign 51 t)) (role ?v11534)) +(<= (next (sat 19)) (does ?v11555 (assign 12 f)) (role ?v11555)) +(<= (next (sat 19)) (does ?v11576 (assign 1 t)) (role ?v11576)) +(<= (next (sat 19)) (does ?v11597 (assign 52 t)) (role ?v11597)) +(<= (next (sat 19)) (does ?v11618 (assign 58 t)) (role ?v11618)) +(<= (next (sat 20)) (does ?v11641 (assign 8 f)) (role ?v11641)) +(<= (next (sat 20)) (does ?v11662 (assign 47 t)) (role ?v11662)) +(<= (next (sat 20)) (does ?v11683 (assign 19 t)) (role ?v11683)) +(<= (next (sat 20)) (does ?v11704 (assign 42 f)) (role ?v11704)) +(<= (next (sat 20)) (does ?v11725 (assign 12 f)) (role ?v11725)) +(<= (next (sat 21)) (does ?v11748 (assign 39 f)) (role ?v11748)) +(<= (next (sat 21)) (does ?v11769 (assign 11 t)) (role ?v11769)) +(<= (next (sat 21)) (does ?v11790 (assign 1 t)) (role ?v11790)) +(<= (next (sat 21)) (does ?v11811 (assign 41 f)) (role ?v11811)) +(<= (next (sat 21)) (does ?v11832 (assign 31 f)) (role ?v11832)) +(<= (next (sat 22)) (does ?v11855 (assign 26 f)) (role ?v11855)) +(<= (next (sat 22)) (does ?v11876 (assign 34 t)) (role ?v11876)) +(<= (next (sat 22)) (does ?v11897 (assign 9 t)) (role ?v11897)) +(<= (next (sat 22)) (does ?v11918 (assign 35 f)) (role ?v11918)) +(<= (next (sat 22)) (does ?v11939 (assign 41 t)) (role ?v11939)) +(<= (next (sat 23)) (does ?v11962 (assign 54 t)) (role ?v11962)) +(<= (next (sat 23)) (does ?v11983 (assign 26 t)) (role ?v11983)) +(<= (next (sat 23)) (does ?v12004 (assign 47 f)) (role ?v12004)) +(<= (next (sat 23)) (does ?v12025 (assign 31 t)) (role ?v12025)) +(<= (next (sat 23)) (does ?v12046 (assign 36 f)) (role ?v12046)) +(<= (next (sat 24)) (does ?v12069 (assign 15 f)) (role ?v12069)) +(<= (next (sat 24)) (does ?v12090 (assign 60 f)) (role ?v12090)) +(<= (next (sat 24)) (does ?v12111 (assign 13 f)) (role ?v12111)) +(<= (next (sat 24)) (does ?v12132 (assign 6 t)) (role ?v12132)) +(<= (next (sat 24)) (does ?v12153 (assign 47 t)) (role ?v12153)) +(<= (next (sat 25)) (does ?v12176 (assign 21 f)) (role ?v12176)) +(<= (next (sat 25)) (does ?v12197 (assign 10 f)) (role ?v12197)) +(<= (next (sat 25)) (does ?v12218 (assign 26 t)) (role ?v12218)) +(<= (next (sat 25)) (does ?v12239 (assign 33 t)) (role ?v12239)) +(<= (next (sat 25)) (does ?v12260 (assign 15 t)) (role ?v12260)) +(<= (next (sat 26)) (does ?v12283 (assign 20 f)) (role ?v12283)) +(<= (next (sat 26)) (does ?v12304 (assign 11 t)) (role ?v12304)) +(<= (next (sat 26)) (does ?v12325 (assign 49 t)) (role ?v12325)) +(<= (next (sat 26)) (does ?v12346 (assign 12 t)) (role ?v12346)) +(<= (next (sat 26)) (does ?v12367 (assign 41 f)) (role ?v12367)) +(<= (next (sat 27)) (does ?v12390 (assign 3 f)) (role ?v12390)) +(<= (next (sat 27)) (does ?v12411 (assign 53 t)) (role ?v12411)) +(<= (next (sat 27)) (does ?v12432 (assign 15 t)) (role ?v12432)) +(<= (next (sat 27)) (does ?v12453 (assign 23 f)) (role ?v12453)) +(<= (next (sat 27)) (does ?v12474 (assign 58 t)) (role ?v12474)) +(<= (next (sat 28)) (does ?v12497 (assign 3 f)) (role ?v12497)) +(<= (next (sat 28)) (does ?v12518 (assign 48 f)) (role ?v12518)) +(<= (next (sat 28)) (does ?v12539 (assign 21 f)) (role ?v12539)) +(<= (next (sat 28)) (does ?v12560 (assign 59 t)) (role ?v12560)) +(<= (next (sat 28)) (does ?v12581 (assign 46 t)) (role ?v12581)) +(<= (next (sat 29)) (does ?v12604 (assign 28 t)) (role ?v12604)) +(<= (next (sat 29)) (does ?v12625 (assign 25 t)) (role ?v12625)) +(<= (next (sat 29)) (does ?v12646 (assign 10 f)) (role ?v12646)) +(<= (next (sat 29)) (does ?v12667 (assign 18 t)) (role ?v12667)) +(<= (next (sat 29)) (does ?v12688 (assign 4 t)) (role ?v12688)) +(<= (next (sat 30)) (does ?v12711 (assign 55 f)) (role ?v12711)) +(<= (next (sat 30)) (does ?v12732 (assign 7 t)) (role ?v12732)) +(<= (next (sat 30)) (does ?v12753 (assign 44 f)) (role ?v12753)) +(<= (next (sat 30)) (does ?v12774 (assign 22 t)) (role ?v12774)) +(<= (next (sat 30)) (does ?v12795 (assign 32 f)) (role ?v12795)) +(<= (next (sat 31)) (does ?v12818 (assign 12 f)) (role ?v12818)) +(<= (next (sat 31)) (does ?v12839 (assign 35 f)) (role ?v12839)) +(<= (next (sat 31)) (does ?v12860 (assign 48 f)) (role ?v12860)) +(<= (next (sat 31)) (does ?v12881 (assign 14 f)) (role ?v12881)) +(<= (next (sat 31)) (does ?v12902 (assign 39 f)) (role ?v12902)) +(<= (next (sat 32)) (does ?v12925 (assign 13 t)) (role ?v12925)) +(<= (next (sat 32)) (does ?v12946 (assign 45 f)) (role ?v12946)) +(<= (next (sat 32)) (does ?v12967 (assign 49 t)) (role ?v12967)) +(<= (next (sat 32)) (does ?v12988 (assign 35 f)) (role ?v12988)) +(<= (next (sat 32)) (does ?v13009 (assign 60 t)) (role ?v13009)) +(<= (next (sat 33)) (does ?v13032 (assign 60 f)) (role ?v13032)) +(<= (next (sat 33)) (does ?v13053 (assign 27 t)) (role ?v13053)) +(<= (next (sat 33)) (does ?v13074 (assign 19 f)) (role ?v13074)) +(<= (next (sat 33)) (does ?v13095 (assign 25 f)) (role ?v13095)) +(<= (next (sat 33)) (does ?v13116 (assign 29 t)) (role ?v13116)) +(<= (next (sat 34)) (does ?v13139 (assign 12 f)) (role ?v13139)) +(<= (next (sat 34)) (does ?v13160 (assign 43 t)) (role ?v13160)) +(<= (next (sat 34)) (does ?v13181 (assign 3 t)) (role ?v13181)) +(<= (next (sat 34)) (does ?v13202 (assign 5 f)) (role ?v13202)) +(<= (next (sat 34)) (does ?v13223 (assign 30 t)) (role ?v13223)) +(<= (next (sat 35)) (does ?v13246 (assign 9 f)) (role ?v13246)) +(<= (next (sat 35)) (does ?v13267 (assign 50 t)) (role ?v13267)) +(<= (next (sat 35)) (does ?v13288 (assign 19 f)) (role ?v13288)) +(<= (next (sat 35)) (does ?v13309 (assign 59 f)) (role ?v13309)) +(<= (next (sat 35)) (does ?v13330 (assign 2 f)) (role ?v13330)) +(<= (next (sat 36)) (does ?v13353 (assign 20 f)) (role ?v13353)) +(<= (next (sat 36)) (does ?v13374 (assign 14 t)) (role ?v13374)) +(<= (next (sat 36)) (does ?v13395 (assign 58 f)) (role ?v13395)) +(<= (next (sat 36)) (does ?v13416 (assign 12 f)) (role ?v13416)) +(<= (next (sat 36)) (does ?v13437 (assign 34 f)) (role ?v13437)) +(<= (next (sat 37)) (does ?v13460 (assign 22 t)) (role ?v13460)) +(<= (next (sat 37)) (does ?v13481 (assign 16 f)) (role ?v13481)) +(<= (next (sat 37)) (does ?v13502 (assign 4 f)) (role ?v13502)) +(<= (next (sat 37)) (does ?v13523 (assign 14 f)) (role ?v13523)) +(<= (next (sat 37)) (does ?v13544 (assign 52 t)) (role ?v13544)) +(<= (next (sat 38)) (does ?v13567 (assign 45 f)) (role ?v13567)) +(<= (next (sat 38)) (does ?v13588 (assign 13 f)) (role ?v13588)) +(<= (next (sat 38)) (does ?v13609 (assign 47 t)) (role ?v13609)) +(<= (next (sat 38)) (does ?v13630 (assign 12 f)) (role ?v13630)) +(<= (next (sat 38)) (does ?v13651 (assign 15 t)) (role ?v13651)) +(<= (next (sat 39)) (does ?v13674 (assign 50 f)) (role ?v13674)) +(<= (next (sat 39)) (does ?v13695 (assign 60 t)) (role ?v13695)) +(<= (next (sat 39)) (does ?v13716 (assign 9 t)) (role ?v13716)) +(<= (next (sat 39)) (does ?v13737 (assign 4 f)) (role ?v13737)) +(<= (next (sat 39)) (does ?v13758 (assign 18 t)) (role ?v13758)) +(<= (next (sat 40)) (does ?v13781 (assign 10 f)) (role ?v13781)) +(<= (next (sat 40)) (does ?v13802 (assign 54 f)) (role ?v13802)) +(<= (next (sat 40)) (does ?v13823 (assign 15 f)) (role ?v13823)) +(<= (next (sat 40)) (does ?v13844 (assign 47 t)) (role ?v13844)) +(<= (next (sat 40)) (does ?v13865 (assign 22 f)) (role ?v13865)) +(<= all_sat (true (sat 1)) (true (sat 2)) (true (sat 3)) (true (sat 4)) (true (sat 5)) (true (sat 6)) (true (sat 7)) (true (sat 8)) (true (sat 9)) (true (sat 10)) (true (sat 11)) (true (sat 12)) (true (sat 13)) (true (sat 14)) (true (sat 15)) (true (sat 16)) (true (sat 17)) (true (sat 18)) (true (sat 19)) (true (sat 20)) (true (sat 21)) (true (sat 22)) (true (sat 23)) (true (sat 24)) (true (sat 25)) (true (sat 26)) (true (sat 27)) (true (sat 28)) (true (sat 29)) (true (sat 30)) (true (sat 31)) (true (sat 32)) (true (sat 33)) (true (sat 34)) (true (sat 35)) (true (sat 36)) (true (sat 37)) (true (sat 38)) (true (sat 39)) (true (sat 40))) +(<= terminal all_sat) +(<= terminal (true (control the end))) +(<= (goal exists 100) all_sat) +(<= (goal exists 0) (not all_sat)) +(<= (goal forall 100) (not all_sat)) +(<= (goal forall 0) all_sat) + + Added: trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.viz.SAT.gdl =================================================================== --- trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.viz.SAT.gdl (rev 0) +++ trunk/Toss/GGP/examples/3qbf-5cnf-20var-40cl.1.qdimacs.viz.SAT.gdl 2011-08-28 22:05:49 UTC (rev 1547) @@ -0,0 +1,578 @@ +(contains 1 (not 1)) +(contains 1 52) +(contains 1 16) +(contains 1 4) +(contains 1 (not 27)) +(contains 2 (not 27)) +(contains 2 (not 51)) +(contains 2 19) +(contains 2 1) +(contains 2 30) +(contains 3 35) +(contains 3 52) +(contains 3 (not 41)) +(contains 3 (not 18)) +(contains 3 (not 59)) +(contains 4 24) +(contains 4 30) +(contains 4 20) +(contains 4 (not 7)) +(contains 4 (not 23)) +(contains 5 (not 34)) +(contains 5 (not 4)) +(contains 5 13) +(contains 5 (not 49)) +(contains 5 (not 17)) +(contains 6 51) +(contains 6 (not 37)) +(contains 6 1) +(contains 6 5) +(contains 6 (not 29)) +(contains 7 (not 2)) +(contains 7 (not 7)) +(contains 7 (not 53)) +(contains 7 (not 12)) +(contains 7 (not 35)) +(contains 8 (not 39)) +(contains 8 (not 44)) +(contains 8 28) +(contains 8 (not 2)) +(contains 8 51) +(contains 9 (not 21)) +(contains 9 (not 11)) +(contains 9 8) +(contains 9 (not 20)) +(contains 9 2) +(contains 10 (not 37)) +(contains 10 (not 21)) +(contains 10 58) +(contains 10 (not 59)) +(contains 10 7) +(contains 11 33) +(contains 11 59) +(contains 11 (not 41)) +(contains 11 52) +(contains 11 21) +(contains 12 43) +(contains 12 35) +(contains 12 (not 7)) +(contains 12 33) +(contains 12 50) +(contains 13 29) +(contains 13 45) +(contains 13 (not 14)) +(contains 13 25) +(contains 13 24) +(contains 14 (not 21)) +(contains 14 54) +(contains 14 49) +(contains 14 2) +(contains 14 42) +(contains 15 (not 25)) +(contains 15 7) +(contains 15 (not 43)) +(contains 15 (not 39)) +(contains 15 59) +(contains 16 32) +(contains 16 (not 30)) +(contains 16 14) +(contains 16 17) +(contains 16 51) +(contains 17 (not 9)) +(contains 17 44) +(contains 17 (not 3)) +(contains 17 4) +(contains 17 (not 54)) +(contains 18 (not 46)) +(contains 18 48) +(contains 18 55) +(contains 18 (not 6)) +(contains 18 59) +(contains 19 51) +(contains 19 (not 12)) +(contains 19 1) +(contains 19 52) +(contains 19 58) +(contains 20 (not 8)) +(contains 20 47) +(contains 20 19) +(contains 20 (not 42)) +(contains 20 (not 12)) +(contains 21 (not 39)) +(contains 21 11) +(contains 21 1) +(contains 21 (not 41)) +(contains 21 (not 31)) +(contains 22 (not 26)) +(contains 22 34) +(contains 22 9) +(contains 22 (not 35)) +(contains 22 41) +(contains 23 54) +(contains 23 26) +(contains 23 (not 47)) +(contains 23 31) +(contains 23 (not 36)) +(contains 24 (not 15)) +(contains 24 (not 60)) +(contains 24 (not 13)) +(contains 24 6) +(contains 24 47) +(contains 25 (not 21)) +(contains 25 (not 10)) +(contains 25 26) +(contains 25 33) +(contains 25 15) +(contains 26 (not 20)) +(contains 26 11) +(contains 26 49) +(contains 26 12) +(contains 26 (not 41)) +(contains 27 (not 3)) +(contains 27 53) +(contains 27 15) +(contains 27 (not 23)) +(contains 27 58) +(contains 28 (not 3)) +(contains 28 (not 48)) +(contains 28 (not 21)) +(contains 28 59) +(contains 28 46) +(contains 29 28) +(contains 29 25) +(contains 29 (not 10)) +(contains 29 18) +(contains 29 4) +(contains 30 (not 55)) +(contains 30 7) +(contains 30 (not 44)) +(contains 30 22) +(contains 30 (not 32)) +(contains 31 (not 12)) +(contains 31 (not 35)) +(contains 31 (not 48)) +(con... [truncated message content] |
From: <luk...@us...> - 2011-08-31 21:43:25
|
Revision: 1551 http://toss.svn.sourceforge.net/toss/?rev=1551&view=rev Author: lukstafi Date: 2011-08-31 21:43:17 +0000 (Wed, 31 Aug 2011) Log Message: ----------- GameSimpl: removing empty stable relations (replacing their atoms with <false> and simplifying formulas). GDL translation fixing: minor concurrent moves synchronization bug. Modified Paths: -------------- trunk/Toss/GGP/GameSimpl.ml trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml Added Paths: ----------- trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss trunk/Toss/GGP/tests/2player_normal_form_2010-simpl.toss Modified: trunk/Toss/GGP/GameSimpl.ml =================================================================== --- trunk/Toss/GGP/GameSimpl.ml 2011-08-31 13:56:07 UTC (rev 1550) +++ trunk/Toss/GGP/GameSimpl.ml 2011-08-31 21:43:17 UTC (rev 1551) @@ -14,7 +14,7 @@ instead of [DiscreteRule.special_rel_of rel <> None]? (To protect against GDL using identifiers starting with underscore.) - (0) Cleanup. + (0) Cleanup pre. (0a) Replace relations missing from the structure and defined relations list, with "false", i.e. [Or []]. @@ -99,12 +99,16 @@ discrete rules is possible: when the optimization replaces (in the embedding formula) a conjunction of relations considered embedded. - (4) Update rewrite rule signatures to contain all introduced - relations. Remove from the structures relations that are no longer + (4) + + (4a) Update rewrite rule signatures to contain all introduced + relations. + + (4b) Remove from the structures relations that are no longer used; if [keep_nonempty_predicates] is true, do not remove predicates. - Remove unused defined relations. Note that recursion loops are not + (4c) Remove unused defined relations. Note that recursion loops are not handled (i.e. mutually recursive relations are not removed). FIXME: why some unused (non-empty) predicates end up being empty? @@ -112,8 +116,16 @@ TODO: require an explicit set of relations to keep instead of [keep_nonempty_predicates]. ??? + (4e) Replace stable relations that are empty with "false", + i.e. [Or []], and remove them from the structure. + + (4f) Final pass of formula simplification + (for example with {!FormulaOps.simplify} or + {!FormulaOps.remove_redundant} without the [implies] argument). + (5) TODO: Glue redundant rules (equal and having the same roles in the game graph). + *) open Formula @@ -124,6 +136,8 @@ let introduce_complement = ref true (** If [true] include equivalences in "both directions" when glueing. *) let reflexivity_equiv = ref true +let final_simplify = + ref (FormulaOps.remove_redundant ?implies:None) (* Collect universally quantified subformulas and compute the size of @@ -852,6 +866,27 @@ glue_struc r.DiscreteRule.lhs_struc r.DiscreteRule.emb_rels}) game in + (* + (4a) Update rewrite rule signatures to contain all introduced + relations. + + (4b) Remove from the structures relations that are no longer + used; if [keep_nonempty_predicates] is true, do not remove + predicates. + + (4c) Remove unused defined relations. Note that recursion loops are not + handled (i.e. mutually recursive relations are not removed). + + FIXME: why some unused (non-empty) predicates end up being empty? + + TODO: require an explicit set of relations to keep instead of + [keep_nonempty_predicates]. ??? + + (4e) Replace stable relations that are empty with "false", + i.e. [Or []], and remove them from the structure. + + (4f) Simplify formulas (perhaps with FormulaOps.simplify?). + *) (* 4 *) (* since relations relevant for LHS structures occur in the "embedding formula", we can freely remove from all structures @@ -860,6 +895,7 @@ Arena.fold_over_formulas ~include_defined_rels:false (FormulaOps.fold_over_atoms (add_rels "")) game Aux.Strings.empty in + (* 4c *) let used_in_def = List.fold_right (fun (drel, (_, def)) -> add_rels drel def) game.Arena.defined_rels Aux.Strings.empty in @@ -878,6 +914,7 @@ aux (used_in_def, game.Arena.defined_rels) in let used_rels = Aux.Strings.union used_in_def used_rels in let game = {game with Arena.defined_rels = defined_rels} in + (* 4b, 4e *) let clear_rel rel = let rel = if DiscreteRule.special_rel_of rel = None then rel @@ -888,7 +925,8 @@ Structure.rel_size !struc rel = 0 ) && not (Aux.Strings.mem rel fluents) && - not (Aux.Strings.mem rel used_rels) in + (not (Aux.Strings.mem rel used_rels) || + Structure.rel_size !struc rel = 0) in (* {{{ log entry *) if !debug_level > 2 && res then ( Printf.printf "GameSimpl: removing relation %s\n%!" rel @@ -899,6 +937,13 @@ (fun r -> {r with DiscreteRule.emb_rels = List.filter (not -| clear_rel) r.DiscreteRule.emb_rels}) game in + let remove_empty = FormulaOps.map_formula + {FormulaOps.identity_map with FormulaOps.map_Rel = + fun rel args -> + if clear_rel rel then Formula.Or [] + else Formula.Rel (rel, args)} in + let more_formulas, game = + map_all_formulas (!final_simplify -| remove_empty) more_formulas game in let game, state = Arena.map_to_structures (fun struc -> Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-08-31 13:56:07 UTC (rev 1550) +++ trunk/Toss/GGP/TranslateGame.ml 2011-08-31 21:43:17 UTC (rev 1551) @@ -1478,6 +1478,8 @@ let all_players_precond = (List.map (fun (rel,tup) -> Formula.Rel (rel,tup))) (Aux.concat_map player_marker lplayers) in + let select_marker pl = + [Formula.Rel (control_pred, [|control_v|])] in let rules = ref [] in let tossr_data = ref [] in let players_with_env = Array.of_list @@ -1493,7 +1495,7 @@ all_players_precond [] rcand else build_rule struc fluents [control_vn] - [] (player_marker_rhs pl) rcand) + (select_marker pl) (player_marker_rhs pl) rcand) p_rules in (* we need to build first before adding [player_cond] because of how formula translation works *) Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-08-31 13:56:07 UTC (rev 1550) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-08-31 21:43:17 UTC (rev 1551) @@ -347,13 +347,14 @@ DiscreteRule.debug_level := discreterule_dl); TranslateGame.generate_test_case := None -let a () = +let a = (* regenerate ~debug:false ~game_name:"tictactoe" ~player:"xplayer"; *) (* regenerate ~debug:false ~game_name:"connect5" ~player:"x"; *) (* regenerate ~debug:false ~game_name:"breakthrough" ~player:"white"; *) (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *) - regenerate ~debug:false ~game_name:"connect4" ~player:"white"; - (* failwith "generated"; *) + (* regenerate ~debug:false ~game_name:"connect4" ~player:"white"; *) + regenerate ~debug:false ~game_name:"2player_normal_form_2010" ~player:"row"; + failwith "generated"; () let exec () = Added: trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss =================================================================== --- trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss (rev 0) +++ trunk/Toss/GGP/tests/2player_normal_form_2010-raw.toss 2011-08-31 21:43:17 UTC (rev 1551) @@ -0,0 +1,6767 @@ +REL terminal() = + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0column(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) or + ex did__BLANK___BLANK_ + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_)) +PLAYERS Environment, row, column +RULE r3: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + did_0row (did__BLANK___BLANK_); did_1r3 (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90); row__SYNC (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_r3_m0_r_r0 + (reward_0r3(reward_r3_m0_r_r0) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_m0_r_r0))) +RULE r2: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + did_0row (did__BLANK___BLANK_); did_1r2 (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90); row__SYNC (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_r2_m0_r_r0 + (reward_0r2(reward_r2_m0_r_r0) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_m0_r_r0))) +RULE r1: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + did_0row (did__BLANK___BLANK_); did_1r1 (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90); row__SYNC (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_r1_m0_r_r0 + (reward_0r1(reward_r1_m0_r_r0) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_m0_r_r0))) +RULE c3: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + column__SYNC (reward_r1_c1_90_90); did_0column (did__BLANK___BLANK_); + did_1c3 (did__BLANK___BLANK_); reward_390 (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_m1_c3_r1_r2 + (reward_1c3(reward_m1_c3_r1_r2) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_m1_c3_r1_r2))) +RULE c2: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + column__SYNC (reward_r1_c1_90_90); did_0column (did__BLANK___BLANK_); + did_1c2 (did__BLANK___BLANK_); reward_390 (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_m1_c2_r1_r2 + (reward_1c2(reward_m1_c2_r1_r2) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_m1_c2_r1_r2))) +RULE c1: + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + _opt_column__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0column {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_0row {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1c3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r1 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r2 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_did_1r3 {did__BLANK___BLANK_; reward_r1_c1_90_90}; + _opt_row__SYNC {did__BLANK___BLANK_; reward_r1_c1_90_90}; + did__BLANK___BLANK_ (did__BLANK___BLANK_); + reward_390 (reward_r1_c1_90_90) + | + ] -> + [did__BLANK___BLANK_, reward_r1_c1_90_90 | + column__SYNC (reward_r1_c1_90_90); did_0column (did__BLANK___BLANK_); + did_1c1 (did__BLANK___BLANK_); reward_390 (reward_r1_c1_90_90) + | + ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre + (not terminal() and + ex reward_m1_c1_r1_r2 + (reward_1c1(reward_m1_c1_r1_r2) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_m1_c1_r1_r2))) +RULE Environment: + [reward_r1_c1_90_90 | + _opt_did_0column (reward_r1_c1_90_90); + _opt_did_0row (reward_r1_c1_90_90); _opt_did_1c1 (reward_r1_c1_90_90); + _opt_did_1c2 (reward_r1_c1_90_90); _opt_did_1c3 (reward_r1_c1_90_90); + _opt_did_1r1 (reward_r1_c1_90_90); _opt_did_1r2 (reward_r1_c1_90_90); + _opt_did_1r3 (reward_r1_c1_90_90); column__SYNC (reward_r1_c1_90_90); + reward_390 (reward_r1_c1_90_90); row__SYNC (reward_r1_c1_90_90) + | + ] -> [reward_r1_c1_90_90 | | ] + emb row__SYNC, column__SYNC, did_0column, did_0row, did_1c1, did_1c2, + did_1c3, did_1r1, did_1r2, did_1r3 + pre not terminal() +LOC 0 { + PLAYER Environment { PAYOFF 0. MOVES [Environment -> 0] } + PLAYER row { + PAYOFF + 10. * + :( + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c1_10_r6) and reward_1c1(reward_c1_c1_10_r6) and + reward_210(reward_c1_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c2_10_r6) and + reward_1c2(reward_c1_c2_10_r6) and + reward_210(reward_c1_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c3_10_r6) and + reward_1c3(reward_c1_c3_10_r6) and + reward_210(reward_c1_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r1_10_r6) and + reward_1r1(reward_c1_r1_10_r6) and + reward_210(reward_c1_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r2_10_r6) and + reward_1r2(reward_c1_r2_10_r6) and + reward_210(reward_c1_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r3_10_r6) and + reward_1r3(reward_c1_r3_10_r6) and + reward_210(reward_c1_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c1_10_r6) and + reward_1c1(reward_c2_c1_10_r6) and + reward_210(reward_c2_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c2_10_r6) and + reward_1c2(reward_c2_c2_10_r6) and + reward_210(reward_c2_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c3_10_r6) and + reward_1c3(reward_c2_c3_10_r6) and + reward_210(reward_c2_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r1_10_r6) and + reward_1r1(reward_c2_r1_10_r6) and + reward_210(reward_c2_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r2_10_r6) and + reward_1r2(reward_c2_r2_10_r6) and + reward_210(reward_c2_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r3_10_r6) and + reward_1r3(reward_c2_r3_10_r6) and + reward_210(reward_c2_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c1_10_r6) and + reward_1c1(reward_c3_c1_10_r6) and + reward_210(reward_c3_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c2_10_r6) and + reward_1c2(reward_c3_c2_10_r6) and + reward_210(reward_c3_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c3_10_r6) and + reward_1c3(reward_c3_c3_10_r6) and + reward_210(reward_c3_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r1_10_r6) and + reward_1r1(reward_c3_r1_10_r6) and + reward_210(reward_c3_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r2_10_r6) and + reward_1r2(reward_c3_r2_10_r6) and + reward_210(reward_c3_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r3_10_r6) and + reward_1r3(reward_c3_r3_10_r6) and + reward_210(reward_c3_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c1_10_r6) and + reward_1c1(reward_r1_c1_10_r6) and + reward_210(reward_r1_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c2_10_r6) and + reward_1c2(reward_r1_c2_10_r6) and + reward_210(reward_r1_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c3_10_r6) and + reward_1c3(reward_r1_c3_10_r6) and + reward_210(reward_r1_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r1_10_r6) and + reward_1r1(reward_r1_r1_10_r6) and + reward_210(reward_r1_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r2_10_r6) and + reward_1r2(reward_r1_r2_10_r6) and + reward_210(reward_r1_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r3_10_r6) and + reward_1r3(reward_r1_r3_10_r6) and + reward_210(reward_r1_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c1_10_r6) and + reward_1c1(reward_r2_c1_10_r6) and + reward_210(reward_r2_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c2_10_r6) and + reward_1c2(reward_r2_c2_10_r6) and + reward_210(reward_r2_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c3_10_r6) and + reward_1c3(reward_r2_c3_10_r6) and + reward_210(reward_r2_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r1_10_r6) and + reward_1r1(reward_r2_r1_10_r6) and + reward_210(reward_r2_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r2_10_r6) and + reward_1r2(reward_r2_r2_10_r6) and + reward_210(reward_r2_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r3_10_r6) and + reward_1r3(reward_r2_r3_10_r6) and + reward_210(reward_r2_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c1_10_r6) and + reward_1c1(reward_r3_c1_10_r6) and + reward_210(reward_r3_c1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c2_10_r6) and + reward_1c2(reward_r3_c2_10_r6) and + reward_210(reward_r3_c2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c3_10_r6) and + reward_1c3(reward_r3_c3_10_r6) and + reward_210(reward_r3_c3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c3_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r1_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r1_10_r6) and + reward_1r1(reward_r3_r1_10_r6) and + reward_210(reward_r3_r1_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r1_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r2_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r2_10_r6) and + reward_1r2(reward_r3_r2_10_r6) and + reward_210(reward_r3_r2_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r2_10_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r3_10_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r3_10_r6) and + reward_1r3(reward_r3_r3_10_r6) and + reward_210(reward_r3_r3_10_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r3_10_r6)) + ) + + + 100. * + :( + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c1_100_r6) and + reward_1c1(reward_c1_c1_100_r6) and + reward_2100(reward_c1_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c2_100_r6) and + reward_1c2(reward_c1_c2_100_r6) and + reward_2100(reward_c1_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c3_100_r6) and + reward_1c3(reward_c1_c3_100_r6) and + reward_2100(reward_c1_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r1_100_r6) and + reward_1r1(reward_c1_r1_100_r6) and + reward_2100(reward_c1_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r2_100_r6) and + reward_1r2(reward_c1_r2_100_r6) and + reward_2100(reward_c1_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_r3_100_r6) and + reward_1r3(reward_c1_r3_100_r6) and + reward_2100(reward_c1_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c1_r3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c1_100_r6) and + reward_1c1(reward_c2_c1_100_r6) and + reward_2100(reward_c2_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c2_100_r6) and + reward_1c2(reward_c2_c2_100_r6) and + reward_2100(reward_c2_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_c3_100_r6) and + reward_1c3(reward_c2_c3_100_r6) and + reward_2100(reward_c2_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r1_100_r6) and + reward_1r1(reward_c2_r1_100_r6) and + reward_2100(reward_c2_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r2_100_r6) and + reward_1r2(reward_c2_r2_100_r6) and + reward_2100(reward_c2_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c2_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c2(reward_c2_r3_100_r6) and + reward_1r3(reward_c2_r3_100_r6) and + reward_2100(reward_c2_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c2_r3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c1_100_r6) and + reward_1c1(reward_c3_c1_100_r6) and + reward_2100(reward_c3_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c2_100_r6) and + reward_1c2(reward_c3_c2_100_r6) and + reward_2100(reward_c3_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_c3_100_r6) and + reward_1c3(reward_c3_c3_100_r6) and + reward_2100(reward_c3_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r1_100_r6) and + reward_1r1(reward_c3_r1_100_r6) and + reward_2100(reward_c3_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r2_100_r6) and + reward_1r2(reward_c3_r2_100_r6) and + reward_2100(reward_c3_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c3_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c3(reward_c3_r3_100_r6) and + reward_1r3(reward_c3_r3_100_r6) and + reward_2100(reward_c3_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_c3_r3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c1_100_r6) and + reward_1c1(reward_r1_c1_100_r6) and + reward_2100(reward_r1_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c2_100_r6) and + reward_1c2(reward_r1_c2_100_r6) and + reward_2100(reward_r1_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_c3_100_r6) and + reward_1c3(reward_r1_c3_100_r6) and + reward_2100(reward_r1_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r1_100_r6) and + reward_1r1(reward_r1_r1_100_r6) and + reward_2100(reward_r1_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r2_100_r6) and + reward_1r2(reward_r1_r2_100_r6) and + reward_2100(reward_r1_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r1_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r1(reward_r1_r3_100_r6) and + reward_1r3(reward_r1_r3_100_r6) and + reward_2100(reward_r1_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r1_r3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c1_100_r6) and + reward_1c1(reward_r2_c1_100_r6) and + reward_2100(reward_r2_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c2_100_r6) and + reward_1c2(reward_r2_c2_100_r6) and + reward_2100(reward_r2_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_c3_100_r6) and + reward_1c3(reward_r2_c3_100_r6) and + reward_2100(reward_r2_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r1_100_r6) and + reward_1r1(reward_r2_r1_100_r6) and + reward_2100(reward_r2_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r2_100_r6) and + reward_1r2(reward_r2_r2_100_r6) and + reward_2100(reward_r2_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r2_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r2(reward_r2_r3_100_r6) and + reward_1r3(reward_r2_r3_100_r6) and + reward_2100(reward_r2_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r2_r3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c1_100_r6) and + reward_1c1(reward_r3_c1_100_r6) and + reward_2100(reward_r3_c1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c2_100_r6) and + reward_1c2(reward_r3_c2_100_r6) and + reward_2100(reward_r3_c2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_c3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_c3_100_r6) and + reward_1c3(reward_r3_c3_100_r6) and + reward_2100(reward_r3_c3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_c3_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r1_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r1_100_r6) and + reward_1r1(reward_r3_r1_100_r6) and + reward_2100(reward_r3_r1_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r1_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r2_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r2(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r2_100_r6) and + reward_1r2(reward_r3_r2_100_r6) and + reward_2100(reward_r3_r2_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r2_100_r6)) or + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_r3_r3_100_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1r3(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0r3(reward_r3_r3_100_r6) and + reward_1r3(reward_r3_r3_100_r6) and + reward_2100(reward_r3_r3_100_r6) and + reward__BLANK___BLANK___BLANK___BLANK_(reward_r3_r3_100_r6)) + ) + + + 20. * + :( + ex did__BLANK___BLANK_, did__BLANK___BLANK_, reward_c1_c1_20_r6 + (true and + did_0row(did__BLANK___BLANK_) and did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + did_0column(did__BLANK___BLANK_) and + did_1c1(did__BLANK___BLANK_) and + did__BLANK___BLANK_(did__BLANK___BLANK_) and + reward_0c1(reward_c1_c1_20_r6) and + reward_1c1(r... [truncated message content] |
From: <luk...@us...> - 2011-09-10 13:02:07
|
Revision: 1562 http://toss.svn.sourceforge.net/toss/?rev=1562&view=rev Author: lukstafi Date: 2011-09-10 13:02:00 +0000 (Sat, 10 Sep 2011) Log Message: ----------- GDL: query (and program) optimization for the Prolog interpreter. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-09-09 11:12:21 UTC (rev 1561) +++ trunk/Toss/GGP/GDL.ml 2011-09-10 13:02:00 UTC (rev 1562) @@ -131,6 +131,9 @@ List.fold_left Aux.Strings.union Aux.Strings.empty (List.map (fun (_,args)->terms_vars args) body) +let literals_vars body = + rels_vars (List.map rel_of_atom (atoms_of_body body)) + let gdl_defs_vars defs = rels_vars (Aux.concat_map (fun (hd,body,neg_body) -> @@ -152,9 +155,6 @@ List.fold_left Aux.Strings.union Aux.Strings.empty (List.map clause_vars cls) -let literals_vars lits = - clause_vars (("",[| |]), lits) - let defs_of_rules rules = Aux.map_reduce (fun ((rel, args), body, neg_body) -> rel, (args, body, neg_body)) (fun y x->x::y) [] rules @@ -604,16 +604,25 @@ type prolog_program = clause list Aux.StrMap.t (** Push negative literals to the right. *) -let preprocess_cl_body body = +let preprocess_goal goal = + let ground, nonground = List.partition + (fun l -> Aux.Strings.is_empty (literals_vars [l])) goal in let posi, nega = List.partition - (function Neg _ | Pos (Distinct _) -> false | _ -> true) - body in - posi @ nega + (function Neg (Distinct _) -> true + | Neg _ | Pos (Distinct _) -> false + | Pos _ -> true + | Disj disj + when List.for_all (function Pos (Distinct _) -> false + | Neg (Distinct _) -> true | Pos _ -> true | _ -> false) disj + -> true + | Disj _ -> false) + nonground in + ground @ posi @ nega let preprocess_program clauses = let clauses = List.map (fun ((rel,args as head), body) -> - rel, (head, preprocess_cl_body body)) clauses in + rel, (head, preprocess_goal body)) clauses in let clauses = Aux.collect clauses in Aux.strmap_of_assoc clauses @@ -710,6 +719,19 @@ and run_lit lit p sc fc sb = match lit with | Pos a -> run_clauses a p sc fc sb + | Neg (Distinct ts) -> + let ts_l = Array.to_list (Array.map (subst sb) ts) in + (try + let sb = unify_all sb ts_l in + sc fc sb + with Not_found -> + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "run_clauses: not unifiable (neg distinct) %s\n%!" + (String.concat ", " (List.map term_str ts_l)) + ); + (* }}} *) + fc ()) | Neg a -> run_clauses a p (fun _ _ -> fc ()) (fun () -> sc fc sb) sb | Disj [] -> fc () @@ -718,9 +740,9 @@ run_lit lit p sc (fun () -> run_lit (Disj lits) p sc fc sb) sb let run_prolog_atom (rel, args as q : rel_atom) (p : prolog_program) = - used_vars := Aux.StrMap.fold (fun _ cls acc -> - Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty; - used_vars := Aux.Strings.union !used_vars (terms_vars args); + (*used_vars := Aux.StrMap.fold (fun _ cls acc -> + Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty;*) + used_vars := (* Aux.Strings.union !used_vars *) terms_vars args; let sc_init fc sb = fun m -> let ans = subst_rel sb q in (* {{{ log entry *) @@ -744,33 +766,69 @@ res let run_prolog_goal (g : literal list) (p : prolog_program) = - used_vars := Aux.StrMap.fold (fun _ cls acc -> - Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty; - used_vars := Aux.Strings.union !used_vars (clause_vars (("",[||]),g)); - let g = preprocess_cl_body g in + (*used_vars := Aux.StrMap.fold (fun _ cls acc -> + Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty;*) + used_vars := (* Aux.Strings.union !used_vars *) literals_vars g; + let g = preprocess_goal g in let sc_init fc sb = fun m -> fc () (sb::m) in let fc_init () = fun m -> m in let extract res = res [] in extract (run_goal g p sc_init fc_init []) let run_prolog_check_atom (rel, args) (p : prolog_program) = - used_vars := Aux.StrMap.fold (fun _ cls acc -> - Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty; - used_vars := Aux.Strings.union !used_vars (terms_vars args); + (*used_vars := Aux.StrMap.fold (fun _ cls acc -> + Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty;*) + used_vars := (* Aux.Strings.union !used_vars *) terms_vars args; let sc_init fc _ = true in let fc_init () = false in run_clauses (Rel (rel, args)) p sc_init fc_init [] let run_prolog_check_goal (g : literal list) (p : prolog_program) = - used_vars := Aux.StrMap.fold (fun _ cls acc -> - Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty; - used_vars := Aux.Strings.union !used_vars (clause_vars (("",[||]),g)); - let g = preprocess_cl_body g in + (*used_vars := Aux.StrMap.fold (fun _ cls acc -> + Aux.Strings.union (clauses_vars cls) acc) p Aux.Strings.empty;*) + used_vars := (* Aux.Strings.union !used_vars *) literals_vars g; + let g = preprocess_goal g in let sc_init fc _ = true in let fc_init () = false in run_goal g p sc_init fc_init [] +let optimize_goal ~testground goal = + used_vars := literals_vars goal; + let ground, nonground = List.partition + (fun l -> Aux.Strings.is_empty (literals_vars [l])) goal in + let posi, nega = List.partition + (function Neg (Distinct _) -> true + | Neg _ | Pos (Distinct _) -> false + | Pos _ -> true + | Disj disj + when List.for_all (function Pos (Distinct _) -> false + | Neg (Distinct _) -> true | Pos _ -> true | _ -> false) disj + -> true + | Disj _ -> false) + nonground in + let unif, posi = List.partition + (function Neg (Distinct _) -> true | _ -> false) posi in + let sc_init fc _ = fun m -> fc () (m + 1) in + let fc_init () = fun m -> m in + let rec branching_f = function + | Pos a as l -> + run_clauses a testground sc_init fc_init [] 0, l + | Neg (Distinct _) as l -> 0, l + | Disj disj as l -> + List.fold_left (+) 0 (List.map (fst -| branching_f) disj), l + | _ -> assert false in + let posi = List.map branching_f posi in + let posi = List.sort (fun (i,_) (j,_) -> i-j) posi in + ground @ unif @ List.map snd posi @ nega + +let optimize_program ~testground program = + Aux.StrMap.map + (fun cls -> List.map + (fun (h,b) -> h, optimize_goal testground b) + cls) + program + (* ************************************************************ *) (* ************************************************************ *) (** {3 Transformations of GDL clauses: inlining, negation.} *) Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-09-09 11:12:21 UTC (rev 1561) +++ trunk/Toss/GGP/GDL.mli 2011-09-10 13:02:00 UTC (rev 1562) @@ -110,7 +110,11 @@ val run_prolog_check_atom : rel_atom -> prolog_program -> bool val run_prolog_check_goal : literal list -> prolog_program -> bool +val optimize_goal : testground:prolog_program -> literal list -> literal list +val optimize_program : + testground:prolog_program -> prolog_program -> prolog_program + (** {3 Transformations of GDL clauses: inlining, negation.} *) (** Expand branches of a definition inlining the provided Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-09-09 11:12:21 UTC (rev 1561) +++ trunk/Toss/GGP/TranslateGame.ml 2011-09-10 13:02:00 UTC (rev 1562) @@ -16,6 +16,8 @@ defined relation: a Toss defined relation (i.e. does not normally occur in the structure) + + TODO: filter out legal tuples that are not statically satisfiable *) open GDL @@ -818,7 +820,7 @@ excluded. If this poses problems we might need to expand disjunctions containing potentially case-split atoms. *) -let rule_cases counters num_functors static_rels program +let rule_cases counters num_functors static_rels testground program playout_states rule_cls = let counter_upds, rule_cls = split_counter_rule_cls counters num_functors rule_cls in @@ -843,24 +845,34 @@ unrequired_cls in let unrequired_cls = List.filter (fun (_, unreq_body) -> + let static_goal = optimize_goal ~testground + (keep_rels static_rels (required_body @ unreq_body)) in (* {{{ log entry *) if !debug_level > 3 then ( - Printf.printf "\nrule_cases: checking urequired %s%!" + Printf.printf + "\nrule_cases: checking urequired %s\nstatic_goal=%s\n%!" (String.concat " "(List.map literal_str unreq_body)) + (String.concat " "(List.map literal_str static_goal)) ); (* }}} *) let res = - run_prolog_check_goal - (keep_rels static_rels (required_body @ unreq_body)) - program - && List.exists - (fun state -> - (* {{{ log entry *) - if !debug_level > 3 then Printf.printf ".%!"; - (* }}} *) - run_prolog_check_goal (required_body @ unreq_body) - (replace_rel_in_program "true" (state_cls state) program)) - playout_states in + run_prolog_check_goal static_goal program && + let goal = optimize_goal ~testground + (required_body @ unreq_body) in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf + "goal=%s\n%!" (String.concat " "(List.map literal_str goal)) + ); + (* }}} *) + List.exists + (fun state -> + (* {{{ log entry *) + if !debug_level > 3 then Printf.printf ".%!"; + (* }}} *) + run_prolog_check_goal goal + (replace_rel_in_program "true" (state_cls state) program)) + playout_states in (* {{{ log entry *) if !debug_level > 3 then Printf.printf " %B\n%!" res; (* }}} *) @@ -1006,20 +1018,21 @@ List.map (add_erasure_clauses f_paths) move_tups -let add_legal_cond counters num_functors static_rels program playout_states - (legal_tup, next_cls) = +let add_legal_cond counters num_functors static_rels testground + program playout_states (legal_tup, next_cls) = let legal_tup, legal_conds = List.split legal_tup in let legal_cls = List.map (* required clauses *) (fun body -> ignore_rhs, true, body) legal_conds in List.map (fun (case_rhs, updates, case_cond) -> legal_tup, case_rhs, updates, case_cond) - (rule_cases counters num_functors static_rels program playout_states - (legal_cls @ next_cls)) + (rule_cases counters num_functors static_rels testground program + playout_states (legal_cls @ next_cls)) -let turnbased_rule_cases counters num_functors static_rels loc_noops used_vars f_paths - program playout_states next_cls players legal_by_player = +let turnbased_rule_cases counters num_functors static_rels loc_noops + used_vars f_paths + testground program playout_states next_cls players legal_by_player = let legal_tuples = Aux.product legal_by_player in (* remove tuples with multiple players making moves TODO: could be enhanced by only excluding a noop of a player for @@ -1047,7 +1060,7 @@ used_vars f_paths next_cls `General players legal_tuples in let rules = Aux.concat_map (add_legal_cond counters num_functors static_rels - program playout_states) move_tups in + testground program playout_states) move_tups in (* we do not look for the players -- for turn-based case, it's done while building game graph *) Aux.Left rules @@ -1055,7 +1068,7 @@ (* If "Concurrent Moves" case, divide rule clauses among players. *) let concurrent_rule_cases counters num_functors static_rels used_vars f_paths - program playout_states next_cls players legal_by_player = + testground program playout_states next_cls players legal_by_player = let env_pl_tups = env_player, process_rule_cands used_vars f_paths next_cls `Environment [] [[]] in @@ -1072,12 +1085,12 @@ (fun (player, move_tups) -> player, Aux.concat_map (add_legal_cond counters num_functors static_rels - program playout_states) move_tups) + testground program playout_states) move_tups) (player_rules @ [env_pl_tups]) in Aux.Right player_rules let general_int_rule_cases counters num_functors static_rels used_vars f_paths - program playout_states next_cls players legal_by_player = + testground program playout_states next_cls players legal_by_player = failwith "General Interaction Games not implemented yet" @@ -1093,7 +1106,7 @@ player is the environment, [env_player] (this way, the numbering of players can be the same as in turn-based case). *) let create_rule_cands counters num_functors static_rels is_turn_based - used_vars f_paths program playout_states next_cls clauses = + used_vars f_paths testground program playout_states next_cls clauses = let players = (* Array.of_list *) Aux.map_some (function | ("role", [|player|]), _ -> Some player @@ -1124,17 +1137,20 @@ ) players in let result = if is_concurrent then - concurrent_rule_cases counters num_functors static_rels used_vars f_paths program + concurrent_rule_cases counters num_functors static_rels + used_vars f_paths testground program playout_states next_cls players legal_by_player else match is_turn_based with | Some (_, loc_noops) -> - turnbased_rule_cases counters num_functors static_rels loc_noops used_vars f_paths - program playout_states next_cls + turnbased_rule_cases counters num_functors static_rels + loc_noops used_vars f_paths + testground program playout_states next_cls players legal_by_player | None -> - general_int_rule_cases counters num_functors static_rels used_vars f_paths - program playout_states next_cls + general_int_rule_cases counters num_functors static_rels + used_vars f_paths + testground program playout_states next_cls players legal_by_player in (* {{{ log entry *) @@ -1867,6 +1883,11 @@ ) clauses in let players = Array.of_list players in let program = preprocess_program clauses in + let init_state = List.map (fun (_,args) -> args.(0)) + (run_prolog_atom ("init", [|Var "x"|]) program) in + let testground = + replace_rel_in_program "true" (state_cls init_state) program in + let program = optimize_program ~testground program in let playout_states = generate_playout_states program players in (* We also detect and remove the goal clauses that use counters to determine values, not to expand their goal value variables later. *) @@ -1917,10 +1938,19 @@ let turn_data = try Some (check_turn_based players program) with Not_turn_based -> None in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf + "traslate_game: all clauses in testground for building rules\n%s\n\n%!" + (String.concat "\n"(List.map clause_str clauses)); + ); + (* }}} *) let program = preprocess_program (List.map (fun ((rel,args),body as cl)-> if rel = "frame next" then ("next", args), body else cl) clauses) in + let testground = + replace_rel_in_program "true" (state_cls init_state) program in let static_rels, nonstatic_rels = static_rels (defs_of_rules (Aux.concat_map rules_of_clause clauses)) in let counters = List.map fst counter_inits @@ -1928,8 +1958,18 @@ let rule_cands, is_concurrent = create_rule_cands counters num_functors static_rels turn_data used_vars f_paths - program playout_states next_cls clauses in + testground program playout_states next_cls clauses in + (* optimize candidates for fast pruning *) let rule_cands = + let process cands = List.map + (fun (legal_tup, rhs_tup, updates, cond) -> + legal_tup, rhs_tup, updates, optimize_goal ~testground cond) + cands in + match rule_cands with + | Aux.Left cands -> Aux.Left (process cands) + | Aux.Right cands -> + Aux.Right (List.map (fun (p,cands) -> p, process cands) cands) in + let rule_cands = filter_rule_cands static_rels players f_paths program playout_states rule_cands in Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-09-09 11:12:21 UTC (rev 1561) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-09-10 13:02:00 UTC (rev 1562) @@ -307,16 +307,18 @@ let a () = set_debug_level 4; - simult_test_case ~game_name:"2player_normal_form_2010" ~player:"row" - ~own_plnum:1 ~opp_plnum:2 (* 0 is environment! *) - ~own_rule_name:"m" - ~own_emb:["did__BLANK__m", "did__BLANK__r1"; - "reward_r1_c1_90_90", "reward_r1_c1_90_90"] - ~own_move:"r1" - ~opp_rule_name:"m2" - ~opp_emb:["did__BLANK__m2", "did__BLANK__c1"; - "reward_r1_c1_90_90", "reward_r1_c1_90_90"] - ~opp_move:"c1" + game_test_case ~game_name:"tictactoe" ~player:"xplayer" + ~own_plnum:0 ~opponent_plnum:1 + ~loc0_rule_name:"mark_x6_y_noop" + ~loc0_emb:[ + "cell_x6_y__BLANK_", "cell_2_2__BLANK_"; + "control__BLANK_", "control__BLANK_"] + ~loc0_move:"(mark 2 2)" ~loc0_noop:"noop" + ~loc1:1 ~loc1_rule_name:"noop_mark_x7_y0" + ~loc1_emb:[ + "cell_x7_y0__BLANK_", "cell_1_1__BLANK_"; + "control__BLANK_", "control__BLANK_"] + ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)" let a () = @@ -359,7 +361,7 @@ (* regenerate ~debug:false ~game_name:"connect4" ~player:"white"; *) (* regenerate ~debug:false ~game_name:"2player_normal_form_2010" ~player:"row"; *) regenerate ~debug:true ~game_name:"pacman3p" ~player:"pacman"; - (* failwith "generated"; *) + failwith "generated"; () let exec () = This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-09-29 09:05:07
|
Revision: 1576 http://toss.svn.sourceforge.net/toss/?rev=1576&view=rev Author: lukstafi Date: 2011-09-29 09:04:55 +0000 (Thu, 29 Sep 2011) Log Message: ----------- GDL translation: remove redundant state terms introduced for passing arguments to relations. Modified Paths: -------------- trunk/Toss/GGP/GDL.ml trunk/Toss/GGP/GDL.mli trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/tests/connect4-raw.toss trunk/Toss/GGP/tests/connect4-simpl.toss Modified: trunk/Toss/GGP/GDL.ml =================================================================== --- trunk/Toss/GGP/GDL.ml 2011-09-27 23:53:22 UTC (rev 1575) +++ trunk/Toss/GGP/GDL.ml 2011-09-29 09:04:55 UTC (rev 1576) @@ -304,6 +304,20 @@ (List.map (subst_one sb1) terms2) | _ -> raise Not_found +(* Check for equality modulo ground terms on the right. *) +let rec mask_blank terms1 terms2 = + match terms1, terms2 with + | [], [] -> true + | (Const a::terms1, Const b::terms2 + | Var a::terms1, Var b::terms2) when a=b -> + mask_blank terms1 terms2 + | Func (f,args1)::terms1, Func (g,args2)::terms2 when f=g -> + mask_blank (Array.to_list args1 @ terms1) + (Array.to_list args2 @ terms2) + | _::terms1, Const "_BLANK_"::terms2 -> + mask_blank terms1 terms2 + | _ -> false + (* Yet another variant, for fast saturation. *) let rec match_nonvar sb terms1 terms2 = match terms1, terms2 with Modified: trunk/Toss/GGP/GDL.mli =================================================================== --- trunk/Toss/GGP/GDL.mli 2011-09-27 23:53:22 UTC (rev 1575) +++ trunk/Toss/GGP/GDL.mli 2011-09-29 09:04:55 UTC (rev 1576) @@ -71,6 +71,8 @@ (** Match terms on the left to ground terms on the right, ignoring [Const "_BLANK_"] on the right. *) val match_nonblank : substitution -> term list -> term list -> substitution +(** Check for equality modulo ground terms on the right. *) +val mask_blank : term list -> term list -> bool val unify_all : substitution -> term list -> substitution val rels_unify : rel_atom -> rel_atom -> bool val subst : substitution -> term -> term Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-09-27 23:53:22 UTC (rev 1575) +++ trunk/Toss/GGP/TranslateGame.ml 2011-09-29 09:04:55 UTC (rev 1576) @@ -644,7 +644,9 @@ | Disj d -> List.exists map d in List.exists map lits -(* Adding "true" atoms to clauses for missing argpath state terms *) +(* Add "true" atoms to clauses for missing argpath state + terms. Remove "true" atoms that are "subsumed" by more specific + atoms (that have subterms instead of blanks). *) let call_transform term_arities ground_at_c_paths rel partition ((h_rel,h_args as h),body as cl) = let r_atoms = if h_rel = rel then [h_args] else [] in @@ -702,13 +704,18 @@ | Aux.Right partition -> Aux.map_some (sterm_arg_for_atom_fact args) partition) r_atoms in + let subsumed, body = List.partition + (function + | Pos (True s) -> + List.exists (fun t -> mask_blank [t] [s]) add_sterms + | _ -> false) body in (* {{{ log entry *) if !debug_level > 2 && add_sterms <> [] then ( Printf.printf - "call_transform: rel=%s; add_sterms=%s; clause=\n%s\n\n%!" + "call_transform: rel=%s; add_sterms=%s; filtered sterms=%s\n\n%!" rel (String.concat ", " (List.map term_str add_sterms)) - (clause_str cl) + (literals_str subsumed) ); (* }}} *) h, Aux.map_rev_prepend body (fun s -> Pos (True s)) add_sterms Modified: trunk/Toss/GGP/tests/connect4-raw.toss =================================================================== --- trunk/Toss/GGP/tests/connect4-raw.toss 2011-09-27 23:53:22 UTC (rev 1575) +++ trunk/Toss/GGP/tests/connect4-raw.toss 2011-09-29 09:04:55 UTC (rev 1576) @@ -307,36 +307,26 @@ ] emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white pre (not terminal() and - ex cell_c11_y17__BLANK_, cell_c11_h3__BLANK_, cell__BLANK__y17__BLANK_, - cell__BLANK__h3__BLANK_, cell_c11_y18__BLANK_ - (cell__BLANK___BLANK___BLANK_(cell__BLANK__h3__BLANK_) and - cell__BLANK___BLANK___BLANK_(cell__BLANK__y17__BLANK_) and - cell__BLANK___BLANK___BLANK_(cell_c11_h3__BLANK_) and + ex cell_c11_y17__BLANK_, cell_c11_h3__BLANK_, cell_c11_y18__BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_c11_h3__BLANK_) and filled(cell_c11_h3__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_c11_y17__BLANK_) and filled(cell_c11_y17__BLANK_) and cell_2b(cell_c11_y18__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_c11_y18__BLANK_) and - EQ___cell_1__cell_1(cell__BLANK__h3__BLANK_, cell_c11_h3__BLANK_) and - succ__cell_1__cell_1(cell__BLANK__h3__BLANK_, cell_c11_h4__BLANK_) and - EQ___cell_1__cell_1(cell__BLANK__y17__BLANK_, cell_c11_y17__BLANK_) and - succ__cell_1__cell_1(cell__BLANK__y17__BLANK_, - cell_c11_y18__BLANK_) and EQ___cell_1__cell_1(cell_c11_h3__BLANK_, - cell__BLANK__h3__BLANK_) and EQ___cell_0__cell_0(cell_c11_h3__BLANK_, - cell_c11_h4__BLANK_) and succ__cell_1__cell_1(cell_c11_h3__BLANK_, - cell_c11_h4__BLANK_) and EQ___cell_0__cell_0(cell_c11_h3__BLANK_, - cell_c11_y17__BLANK_) and EQ___cell_0__cell_0(cell_c11_h3__BLANK_, - cell_c11_y18__BLANK_) and EQ___cell_0__cell_0(cell_c11_h4__BLANK_, - cell_c11_h3__BLANK_) and EQ___cell_0__cell_0(cell_c11_h4__BLANK_, - cell_c11_y17__BLANK_) and EQ___cell_0__cell_0(cell_c11_h4__BLANK_, - cell_c11_y18__BLANK_) and EQ___cell_1__cell_1(cell_c11_y17__BLANK_, - cell__BLANK__y17__BLANK_) and EQ___cell_0__cell_0(cell_c11_y17__BLANK_, - cell_c11_h3__BLANK_) and EQ___cell_0__cell_0(cell_c11_y17__BLANK_, - cell_c11_h4__BLANK_) and EQ___cell_0__cell_0(cell_c11_y17__BLANK_, - cell_c11_y18__BLANK_) and succ__cell_1__cell_1(cell_c11_y17__BLANK_, - cell_c11_y18__BLANK_) and EQ___cell_0__cell_0(cell_c11_y18__BLANK_, - cell_c11_h3__BLANK_) and EQ___cell_0__cell_0(cell_c11_y18__BLANK_, - cell_c11_h4__BLANK_) and EQ___cell_0__cell_0(cell_c11_y18__BLANK_, - cell_c11_y17__BLANK_))) + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_h4__BLANK_) and + succ__cell_1__cell_1(cell_c11_h3__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_y17__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h3__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_y17__BLANK_) and + EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y17__BLANK_, cell_c11_y18__BLANK_) and + succ__cell_1__cell_1(cell_c11_y17__BLANK_, cell_c11_y18__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_h3__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_h4__BLANK_) and + EQ___cell_0__cell_0(cell_c11_y18__BLANK_, cell_c11_y17__BLANK_))) RULE noop_drop_c12: [cell_c12_h6__BLANK_, control__BLANK_ | _opt_cell_2b (control__BLANK_); @@ -356,36 +346,26 @@ emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white pre (not terminal() and - ex cell_c12_y19__BLANK_, cell_c12_h5__BLANK_, cell__BLANK__y19__BLANK_, - cell__BLANK__h5__BLANK_, cell_c12_y20__BLANK_ - (cell__BLANK___BLANK___BLANK_(cell__BLANK__h5__BLANK_) and - cell__BLANK___BLANK___BLANK_(cell__BLANK__y19__BLANK_) and - cell__BLANK___BLANK___BLANK_(cell_c12_h5__BLANK_) and + ex cell_c12_y19__BLANK_, cell_c12_h5__BLANK_, cell_c12_y20__BLANK_ + (cell__BLANK___BLANK___BLANK_(cell_c12_h5__BLANK_) and filled(cell_c12_h5__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_c12_y19__BLANK_) and filled(cell_c12_y19__BLANK_) and cell_2b(cell_c12_y20__BLANK_) and cell__BLANK___BLANK___BLANK_(cell_c12_y20__BLANK_) and - EQ___cell_1__cell_1(cell__BLANK__h5__BLANK_, cell_c12_h5__BLANK_) and - succ__cell_1__cell_1(cell__BLANK__h5__BLANK_, cell_c12_h6__BLANK_) and - EQ___cell_1__cell_1(cell__BLANK__y19__BLANK_, cell_c12_y19__BLANK_) and - succ__cell_1__cell_1(cell__BLANK__y19__BLANK_, - cell_c12_y20__BLANK_) and EQ___cell_1__cell_1(cell_c12_h5__BLANK_, - cell__BLANK__h5__BLANK_) and EQ___cell_0__cell_0(cell_c12_h5__BLANK_, - cell_c12_h6__BLANK_) and succ__cell_1__cell_1(cell_c12_h5__BLANK_, - cell_c12_h6__BLANK_) and EQ___cell_0__cell_0(cell_c12_h5__BLANK_, - cell_c12_y19__BLANK_) and EQ___cell_0__cell_0(cell_c12_h5__BLANK_, - cell_c12_y20__BLANK_) and EQ___cell_0__cell_0(cell_c12_h6__BLANK_, - cell_c12_h5__BLANK_) and EQ___cell_0__cell_0(cell_c12_h6__BLANK_, - cell_c12_y19__BLANK_) and EQ___cell_0__cell_0(cell_c12_h6__BLANK_, - cell_c12_y20__BLANK_) and EQ___cell_1__cell_1(cell_c12_y19__BLANK_, - cell__BLANK__y19__BLANK_) and EQ___cell_0__cell_0(cell_c12_y19__BLANK_, - cell_c12_h5__BLANK_) and EQ___cell_0__cell_0(cell_c12_y19__BLANK_, - cell_c12_h6__BLANK_) and EQ___cell_0__cell_0(cell_c12_y19__BLANK_, - cell_c12_y20__BLANK_) and succ__cell_1__cell_1(cell_c12_y19__BLANK_, - cell_c12_y20__BLANK_) and EQ___cell_0__cell_0(cell_c12_y20__BLANK_, - cell_c12_h5__BLANK_) and EQ___cell_0__cell_0(cell_c12_y20__BLANK_, - cell_c12_h6__BLANK_) and EQ___cell_0__cell_0(cell_c12_y20__BLANK_, - cell_c12_y19__BLANK_))) + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_h6__BLANK_) and + succ__cell_1__cell_1(cell_c12_h5__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_y19__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h5__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_y19__BLANK_) and + EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y19__BLANK_, cell_c12_y20__BLANK_) and + succ__cell_1__cell_1(cell_c12_y19__BLANK_, cell_c12_y20__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_h5__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_h6__BLANK_) and + EQ___cell_0__cell_0(cell_c12_y20__BLANK_, cell_c12_y19__BLANK_))) LOC 0 { PLAYER white { Modified: trunk/Toss/GGP/tests/connect4-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/connect4-simpl.toss 2011-09-27 23:53:22 UTC (rev 1575) +++ trunk/Toss/GGP/tests/connect4-simpl.toss 2011-09-29 09:04:55 UTC (rev 1576) @@ -170,18 +170,12 @@ ] emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white pre (not terminal() and - ex cell_c11_y17__BLANK_, cell_c11_h3__BLANK_, cell__BLANK__y17__BLANK_, - cell__BLANK__h3__BLANK_, cell_c11_y18__BLANK_ + ex cell_c11_y17__BLANK_, cell_c11_h3__BLANK_, cell_c11_y18__BLANK_ (R(cell_c11_h3__BLANK_, cell_c11_h4__BLANK_) and R(cell_c11_y17__BLANK_, cell_c11_y18__BLANK_) and EQ___cell_0__cell_0(cell_c11_h4__BLANK_, cell_c11_y17__BLANK_) and EQ___cell_0__cell_0(cell_c11_h3__BLANK_, - cell_c11_y17__BLANK_) and EQ___cell_1__cell_1(cell__BLANK__y17__BLANK_, - cell_c11_y17__BLANK_) and EQ___cell_1__cell_1(cell__BLANK__h3__BLANK_, - cell_c11_h3__BLANK_) and succ__cell_1__cell_1(cell__BLANK__h3__BLANK_, - cell_c11_h4__BLANK_) and succ__cell_1__cell_1(cell__BLANK__y17__BLANK_, - cell_c11_y18__BLANK_) and filled(cell_c11_h3__BLANK_) and + cell_c11_y17__BLANK_) and filled(cell_c11_h3__BLANK_) and filled(cell_c11_y17__BLANK_) and cell_2b(cell_c11_y18__BLANK_) and - not C(cell__BLANK__h3__BLANK_) and not C(cell__BLANK__y17__BLANK_) and not C(cell_c11_h3__BLANK_) and not C(cell_c11_y17__BLANK_) and not C(cell_c11_y18__BLANK_))) RULE noop_drop_c12: @@ -202,18 +196,12 @@ emb cell_2b, cell_2dirt, cell_2r, cell_2w, control_0red, control_0white pre (not terminal() and - ex cell_c12_y19__BLANK_, cell_c12_h5__BLANK_, cell__BLANK__y19__BLANK_, - cell__BLANK__h5__BLANK_, cell_c12_y20__BLANK_ + ex cell_c12_y19__BLANK_, cell_c12_h5__BLANK_, cell_c12_y20__BLANK_ (R(cell_c12_h5__BLANK_, cell_c12_h6__BLANK_) and R(cell_c12_y19__BLANK_, cell_c12_y20__BLANK_) and EQ___cell_0__cell_0(cell_c12_h6__BLANK_, cell_c12_y19__BLANK_) and EQ___cell_0__cell_0(cell_c12_h5__BLANK_, - cell_c12_y19__BLANK_) and EQ___cell_1__cell_1(cell__BLANK__y19__BLANK_, - cell_c12_y19__BLANK_) and EQ___cell_1__cell_1(cell__BLANK__h5__BLANK_, - cell_c12_h5__BLANK_) and succ__cell_1__cell_1(cell__BLANK__h5__BLANK_, - cell_c12_h6__BLANK_) and succ__cell_1__cell_1(cell__BLANK__y19__BLANK_, - cell_c12_y20__BLANK_) and filled(cell_c12_h5__BLANK_) and + cell_c12_y19__BLANK_) and filled(cell_c12_h5__BLANK_) and filled(cell_c12_y19__BLANK_) and cell_2b(cell_c12_y20__BLANK_) and - not C(cell__BLANK__h5__BLANK_) and not C(cell__BLANK__y19__BLANK_) and not C(cell_c12_h5__BLANK_) and not C(cell_c12_y19__BLANK_) and not C(cell_c12_y20__BLANK_))) LOC 0 { @@ -659,351 +647,6 @@ (cell_7_6__BLANK_, cell_7_5__BLANK_); (cell_7_6__BLANK_, cell_7_6__BLANK_) }; - EQ___cell_1__cell_1 { - (cell_1_0__BLANK_, cell_1_0__BLANK_); - (cell_1_0__BLANK_, cell_2_0__BLANK_); - (cell_1_0__BLANK_, cell_3_0__BLANK_); - (cell_1_0__BLANK_, cell_4_0__BLANK_); - (cell_1_0__BLANK_, cell_5_0__BLANK_); - (cell_1_0__BLANK_, cell_6_0__BLANK_); - (cell_1_0__BLANK_, cell_7_0__BLANK_); - (cell_1_1__BLANK_, cell_1_1__BLANK_); - (cell_1_1__BLANK_, cell_2_1__BLANK_); - (cell_1_1__BLANK_, cell_3_1__BLANK_); - (cell_1_1__BLANK_, cell_4_1__BLANK_); - (cell_1_1__BLANK_, cell_5_1__BLANK_); - (cell_1_1__BLANK_, cell_6_1__BLANK_); - (cell_1_1__BLANK_, cell_7_1__BLANK_); - (cell_1_2__BLANK_, cell_1_2__BLANK_); - (cell_1_2__BLANK_, cell_2_2__BLANK_); - (cell_1_2__BLANK_, cell_3_2__BLANK_); - (cell_1_2__BLANK_, cell_4_2__BLANK_); - (cell_1_2__BLANK_, cell_5_2__BLANK_); - (cell_1_2__BLANK_, cell_6_2__BLANK_); - (cell_1_2__BLANK_, cell_7_2__BLANK_); - (cell_1_3__BLANK_, cell_1_3__BLANK_); - (cell_1_3__BLANK_, cell_2_3__BLANK_); - (cell_1_3__BLANK_, cell_3_3__BLANK_); - (cell_1_3__BLANK_, cell_4_3__BLANK_); - (cell_1_3__BLANK_, cell_5_3__BLANK_); - (cell_1_3__BLANK_, cell_6_3__BLANK_); - (cell_1_3__BLANK_, cell_7_3__BLANK_); - (cell_1_4__BLANK_, cell_1_4__BLANK_); - (cell_1_4__BLANK_, cell_2_4__BLANK_); - (cell_1_4__BLANK_, cell_3_4__BLANK_); - (cell_1_4__BLANK_, cell_4_4__BLANK_); - (cell_1_4__BLANK_, cell_5_4__BLANK_); - (cell_1_4__BLANK_, cell_6_4__BLANK_); - (cell_1_4__BLANK_, cell_7_4__BLANK_); - (cell_1_5__BLANK_, cell_1_5__BLANK_); - (cell_1_5__BLANK_, cell_2_5__BLANK_); - (cell_1_5__BLANK_, cell_3_5__BLANK_); - (cell_1_5__BLANK_, cell_4_5__BLANK_); - (cell_1_5__BLANK_, cell_5_5__BLANK_); - (cell_1_5__BLANK_, cell_6_5__BLANK_); - (cell_1_5__BLANK_, cell_7_5__BLANK_); - (cell_1_6__BLANK_, cell_1_6__BLANK_); - (cell_1_6__BLANK_, cell_2_6__BLANK_); - (cell_1_6__BLANK_, cell_3_6__BLANK_); - (cell_1_6__BLANK_, cell_4_6__BLANK_); - (cell_1_6__BLANK_, cell_5_6__BLANK_); - (cell_1_6__BLANK_, cell_6_6__BLANK_); - (cell_1_6__BLANK_, cell_7_6__BLANK_); - (cell_2_0__BLANK_, cell_1_0__BLANK_); - (cell_2_0__BLANK_, cell_2_0__BLANK_); - (cell_2_0__BLANK_, cell_3_0__BLANK_); - (cell_2_0__BLANK_, cell_4_0__BLANK_); - (cell_2_0__BLANK_, cell_5_0__BLANK_); - (cell_2_0__BLANK_, cell_6_0__BLANK_); - (cell_2_0__BLANK_, cell_7_0__BLANK_); - (cell_2_1__BLANK_, cell_1_1__BLANK_); - (cell_2_1__BLANK_, cell_2_1__BLANK_); - (cell_2_1__BLANK_, cell_3_1__BLANK_); - (cell_2_1__BLANK_, cell_4_1__BLANK_); - (cell_2_1__BLANK_, cell_5_1__BLANK_); - (cell_2_1__BLANK_, cell_6_1__BLANK_); - (cell_2_1__BLANK_, cell_7_1__BLANK_); - (cell_2_2__BLANK_, cell_1_2__BLANK_); - (cell_2_2__BLANK_, cell_2_2__BLANK_); - (cell_2_2__BLANK_, cell_3_2__BLANK_); - (cell_2_2__BLANK_, cell_4_2__BLANK_); - (cell_2_2__BLANK_, cell_5_2__BLANK_); - (cell_2_2__BLANK_, cell_6_2__BLANK_); - (cell_2_2__BLANK_, cell_7_2__BLANK_); - (cell_2_3__BLANK_, cell_1_3__BLANK_); - (cell_2_3__BLANK_, cell_2_3__BLANK_); - (cell_2_3__BLANK_, cell_3_3__BLANK_); - (cell_2_3__BLANK_, cell_4_3__BLANK_); - (cell_2_3__BLANK_, cell_5_3__BLANK_); - (cell_2_3__BLANK_, cell_6_3__BLANK_); - (cell_2_3__BLANK_, cell_7_3__BLANK_); - (cell_2_4__BLANK_, cell_1_4__BLANK_); - (cell_2_4__BLANK_, cell_2_4__BLANK_); - (cell_2_4__BLANK_, cell_3_4__BLANK_); - (cell_2_4__BLANK_, cell_4_4__BLANK_); - (cell_2_4__BLANK_, cell_5_4__BLANK_); - (cell_2_4__BLANK_, cell_6_4__BLANK_); - (cell_2_4__BLANK_, cell_7_4__BLANK_); - (cell_2_5__BLANK_, cell_1_5__BLANK_); - (cell_2_5__BLANK_, cell_2_5__BLANK_); - (cell_2_5__BLANK_, cell_3_5__BLANK_); - (cell_2_5__BLANK_, cell_4_5__BLANK_); - (cell_2_5__BLANK_, cell_5_5__BLANK_); - (cell_2_5__BLANK_, cell_6_5__BLANK_); - (cell_2_5__BLANK_, cell_7_5__BLANK_); - (cell_2_6__BLANK_, cell_1_6__BLANK_); - (cell_2_6__BLANK_, cell_2_6__BLANK_); - (cell_2_6__BLANK_, cell_3_6__BLANK_); - (cell_2_6__BLANK_, cell_4_6__BLANK_); - (cell_2_6__BLANK_, cell_5_6__BLANK_); - (cell_2_6__BLANK_, cell_6_6__BLANK_); - (cell_2_6__BLANK_, cell_7_6__BLANK_); - (cell_3_0__BLANK_, cell_1_0__BLANK_); - (cell_3_0__BLANK_, cell_2_0__BLANK_); - (cell_3_0__BLANK_, cell_3_0__BLANK_); - (cell_3_0__BLANK_, cell_4_0__BLANK_); - (cell_3_0__BLANK_, cell_5_0__BLANK_); - (cell_3_0__BLANK_, cell_6_0__BLANK_); - (cell_3_0__BLANK_, cell_7_0__BLANK_); - (cell_3_1__BLANK_, cell_1_1__BLANK_); - (cell_3_1__BLANK_, cell_2_1__BLANK_); - (cell_3_1__BLANK_, cell_3_1__BLANK_); - (cell_3_1__BLANK_, cell_4_1__BLANK_); - (cell_3_1__BLANK_, cell_5_1__BLANK_); - (cell_3_1__BLANK_, cell_6_1__BLANK_); - (cell_3_1__BLANK_, cell_7_1__BLANK_); - (cell_3_2__BLANK_, cell_1_2__BLANK_); - (cell_3_2__BLANK_, cell_2_2__BLANK_); - (cell_3_2__BLANK_, cell_3_2__BLANK_); - (cell_3_2__BLANK_, cell_4_2__BLANK_); - (cell_3_2__BLANK_, cell_5_2__BLANK_); - (cell_3_2__BLANK_, cell_6_2__BLANK_); - (cell_3_2__BLANK_, cell_7_2__BLANK_); - (cell_3_3__BLANK_, cell_1_3__BLANK_); - (cell_3_3__BLANK_, cell_2_3__BLANK_); - (cell_3_3__BLANK_, cell_3_3__BLANK_); - (cell_3_3__BLANK_, cell_4_3__BLANK_); - (cell_3_3__BLANK_, cell_5_3__BLANK_); - (cell_3_3__BLANK_, cell_6_3__BLANK_); - (cell_3_3__BLANK_, cell_7_3__BLANK_); - (cell_3_4__BLANK_, cell_1_4__BLANK_); - (cell_3_4__BLANK_, cell_2_4__BLANK_); - (cell_3_4__BLANK_, cell_3_4__BLANK_); - (cell_3_4__BLANK_, cell_4_4__BLANK_); - (cell_3_4__BLANK_, cell_5_4__BLANK_); - (cell_3_4__BLANK_, cell_6_4__BLANK_); - (cell_3_4__BLANK_, cell_7_4__BLANK_); - (cell_3_5__BLANK_, cell_1_5__BLANK_); - (cell_3_5__BLANK_, cell_2_5__BLANK_); - (cell_3_5__BLANK_, cell_3_5__BLANK_); - (cell_3_5__BLANK_, cell_4_5__BLANK_); - (cell_3_5__BLANK_, cell_5_5__BLANK_); - (cell_3_5__BLANK_, cell_6_5__BLANK_); - (cell_3_5__BLANK_, cell_7_5__BLANK_); - (cell_3_6__BLANK_, cell_1_6__BLANK_); - (cell_3_6__BLANK_, cell_2_6__BLANK_); - (cell_3_6__BLANK_, cell_3_6__BLANK_); - (cell_3_6__BLANK_, cell_4_6__BLANK_); - (cell_3_6__BLANK_, cell_5_6__BLANK_); - (cell_3_6__BLANK_, cell_6_6__BLANK_); - (cell_3_6__BLANK_, cell_7_6__BLANK_); - (cell_4_0__BLANK_, cell_1_0__BLANK_); - (cell_4_0__BLANK_, cell_2_0__BLANK_); - (cell_4_0__BLANK_, cell_3_0__BLANK_); - (cell_4_0__BLANK_, cell_4_0__BLANK_); - (cell_4_0__BLANK_, cell_5_0__BLANK_); - (cell_4_0__BLANK_, cell_6_0__BLANK_); - (cell_4_0__BLANK_, cell_7_0__BLANK_); - (cell_4_1__BLANK_, cell_1_1__BLANK_); - (cell_4_1__BLANK_, cell_2_1__BLANK_); - (cell_4_1__BLANK_, cell_3_1__BLANK_); - (cell_4_1__BLANK_, cell_4_1__BLANK_); - (cell_4_1__BLANK_, cell_5_1__BLANK_); - (cell_4_1__BLANK_, cell_6_1__BLANK_); - (cell_4_1__BLANK_, cell_7_1__BLANK_); - (cell_4_2__BLANK_, cell_1_2__BLANK_); - (cell_4_2__BLANK_, cell_2_2__BLANK_); - (cell_4_2__BLANK_, cell_3_2__BLANK_); - (cell_4_2__BLANK_, cell_4_2__BLANK_); - (cell_4_2__BLANK_, cell_5_2__BLANK_); - (cell_4_2__BLANK_, cell_6_2__BLANK_); - (cell_4_2__BLANK_, cell_7_2__BLANK_); - (cell_4_3__BLANK_, cell_1_3__BLANK_); - (cell_4_3__BLANK_, cell_2_3__BLANK_); - (cell_4_3__BLANK_, cell_3_3__BLANK_); - (cell_4_3__BLANK_, cell_4_3__BLANK_); - (cell_4_3__BLANK_, cell_5_3__BLANK_); - (cell_4_3__BLANK_, cell_6_3__BLANK_); - (cell_4_3__BLANK_, cell_7_3__BLANK_); - (cell_4_4__BLANK_, cell_1_4__BLANK_); - (cell_4_4__BLANK_, cell_2_4__BLANK_); - (cell_4_4__BLANK_, cell_3_4__BLANK_); - (cell_4_4__BLANK_, cell_4_4__BLANK_); - (cell_4_4__BLANK_, cell_5_4__BLANK_); - (cell_4_4__BLANK_, cell_6_4__BLANK_); - (cell_4_4__BLANK_, cell_7_4__BLANK_); - (cell_4_5__BLANK_, cell_1_5__BLANK_); - (cell_4_5__BLANK_, cell_2_5__BLANK_); - (cell_4_5__BLANK_, cell_3_5__BLANK_); - (cell_4_5__BLANK_, cell_4_5__BLANK_); - (cell_4_5__BLANK_, cell_5_5__BLANK_); - (cell_4_5__BLANK_, cell_6_5__BLANK_); - (cell_4_5__BLANK_, cell_7_5__BLANK_); - (cell_4_6__BLANK_, cell_1_6__BLANK_); - (cell_4_6__BLANK_, cell_2_6__BLANK_); - (cell_4_6__BLANK_, cell_3_6__BLANK_); - (cell_4_6__BLANK_, cell_4_6__BLANK_); - (cell_4_6__BLANK_, cell_5_6__BLANK_); - (cell_4_6__BLANK_, cell_6_6__BLANK_); - (cell_4_6__BLANK_, cell_7_6__BLANK_); - (cell_5_0__BLANK_, cell_1_0__BLANK_); - (cell_5_0__BLANK_, cell_2_0__BLANK_); - (cell_5_0__BLANK_, cell_3_0__BLANK_); - (cell_5_0__BLANK_, cell_4_0__BLANK_); - (cell_5_0__BLANK_, cell_5_0__BLANK_); - (cell_5_0__BLANK_, cell_6_0__BLANK_); - (cell_5_0__BLANK_, cell_7_0__BLANK_); - (cell_5_1__BLANK_, cell_1_1__BLANK_); - (cell_5_1__BLANK_, cell_2_1__BLANK_); - (cell_5_1__BLANK_, cell_3_1__BLANK_); - (cell_5_1__BLANK_, cell_4_1__BLANK_); - (cell_5_1__BLANK_, cell_5_1__BLANK_); - (cell_5_1__BLANK_, cell_6_1__BLANK_); - (cell_5_1__BLANK_, cell_7_1__BLANK_); - (cell_5_2__BLANK_, cell_1_2__BLANK_); - (cell_5_2__BLANK_, cell_2_2__BLANK_); - (cell_5_2__BLANK_, cell_3_2__BLANK_); - (cell_5_2__BLANK_, cell_4_2__BLANK_); - (cell_5_2__BLANK_, cell_5_2__BLANK_); - (cell_5_2__BLANK_, cell_6_2__BLANK_); - (cell_5_2__BLANK_, cell_7_2__BLANK_); - (cell_5_3__BLANK_, cell_1_3__BLANK_); - (cell_5_3__BLANK_, cell_2_3__BLANK_); - (cell_5_3__BLANK_, cell_3_3__BLANK_); - (cell_5_3__BLANK_, cell_4_3__BLANK_); - (cell_5_3__BLANK_, cell_5_3__BLANK_); - (cell_5_3__BLANK_, cell_6_3__BLANK_); - (cell_5_3__BLANK_, cell_7_3__BLANK_); - (cell_5_4__BLANK_, cell_1_4__BLANK_); - (cell_5_4__BLANK_, cell_2_4__BLANK_); - (cell_5_4__BLANK_, cell_3_4__BLANK_); - (cell_5_4__BLANK_, cell_4_4__BLANK_); - (cell_5_4__BLANK_, cell_5_4__BLANK_); - (cell_5_4__BLANK_, cell_6_4__BLANK_); - (cell_5_4__BLANK_, cell_7_4__BLANK_); - (cell_5_5__BLANK_, cell_1_5__BLANK_); - (cell_5_5__BLANK_, cell_2_5__BLANK_); - (cell_5_5__BLANK_, cell_3_5__BLANK_); - (cell_5_5__BLANK_, cell_4_5__BLANK_); - (cell_5_5__BLANK_, cell_5_5__BLANK_); - (cell_5_5__BLANK_, cell_6_5__BLANK_); - (cell_5_5__BLANK_, cell_7_5__BLANK_); - (cell_5_6__BLANK_, cell_1_6__BLANK_); - (cell_5_6__BLANK_, cell_2_6__BLANK_); - (cell_5_6__BLANK_, cell_3_6__BLANK_); - (cell_5_6__BLANK_, cell_4_6__BLANK_); - (cell_5_6__BLANK_, cell_5_6__BLANK_); - (cell_5_6__BLANK_, cell_6_6__BLANK_); - (cell_5_6__BLANK_, cell_7_6__BLANK_); - (cell_6_0__BLANK_, cell_1_0__BLANK_); - (cell_6_0__BLANK_, cell_2_0__BLANK_); - (cell_6_0__BLANK_, cell_3_0__BLANK_); - (cell_6_0__BLANK_, cell_4_0__BLANK_); - (cell_6_0__BLANK_, cell_5_0__BLANK_); - (cell_6_0__BLANK_, cell_6_0__BLANK_); - (cell_6_0__BLANK_, cell_7_0__BLANK_); - (cell_6_1__BLANK_, cell_1_1__BLANK_); - (cell_6_1__BLANK_, cell_2_1__BLANK_); - (cell_6_1__BLANK_, cell_3_1__BLANK_); - (cell_6_1__BLANK_, cell_4_1__BLANK_); - (cell_6_1__BLANK_, cell_5_1__BLANK_); - (cell_6_1__BLANK_, cell_6_1__BLANK_); - (cell_6_1__BLANK_, cell_7_1__BLANK_); - (cell_6_2__BLANK_, cell_1_2__BLANK_); - (cell_6_2__BLANK_, cell_2_2__BLANK_); - (cell_6_2__BLANK_, cell_3_2__BLANK_); - (cell_6_2__BLANK_, cell_4_2__BLANK_); - (cell_6_2__BLANK_, cell_5_2__BLANK_); - (cell_6_2__BLANK_, cell_6_2__BLANK_); - (cell_6_2__BLANK_, cell_7_2__BLANK_); - (cell_6_3__BLANK_, cell_1_3__BLANK_); - (cell_6_3__BLANK_, cell_2_3__BLANK_); - (cell_6_3__BLANK_, cell_3_3__BLANK_); - (cell_6_3__BLANK_, cell_4_3__BLANK_); - (cell_6_3__BLANK_, cell_5_3__BLANK_); - (cell_6_3__BLANK_, cell_6_3__BLANK_); - (cell_6_3__BLANK_, cell_7_3__BLANK_); - (cell_6_4__BLANK_, cell_1_4__BLANK_); - (cell_6_4__BLANK_, cell_2_4__BLANK_); - (cell_6_4__BLANK_, cell_3_4__BLANK_); - (cell_6_4__BLANK_, cell_4_4__BLANK_); - (cell_6_4__BLANK_, cell_5_4__BLANK_); - (cell_6_4__BLANK_, cell_6_4__BLANK_); - (cell_6_4__BLANK_, cell_7_4__BLANK_); - (cell_6_5__BLANK_, cell_1_5__BLANK_); - (cell_6_5__BLANK_, cell_2_5__BLANK_); - (cell_6_5__BLANK_, cell_3_5__BLANK_); - (cell_6_5__BLANK_, cell_4_5__BLANK_); - (cell_6_5__BLANK_, cell_5_5__BLANK_); - (cell_6_5__BLANK_, cell_6_5__BLANK_); - (cell_6_5__BLANK_, cell_7_5__BLANK_); - (cell_6_6__BLANK_, cell_1_6__BLANK_); - (cell_6_6__BLANK_, cell_2_6__BLANK_); - (cell_6_6__BLANK_, cell_3_6__BLANK_); - (cell_6_6__BLANK_, cell_4_6__BLANK_); - (cell_6_6__BLANK_, cell_5_6__BLANK_); - (cell_6_6__BLANK_, cell_6_6__BLANK_); - (cell_6_6__BLANK_, cell_7_6__BLANK_); - (cell_7_0__BLANK_, cell_1_0__BLANK_); - (cell_7_0__BLANK_, cell_2_0__BLANK_); - (cell_7_0__BLANK_, cell_3_0__BLANK_); - (cell_7_0__BLANK_, cell_4_0__BLANK_); - (cell_7_0__BLANK_, cell_5_0__BLANK_); - (cell_7_0__BLANK_, cell_6_0__BLANK_); - (cell_7_0__BLANK_, cell_7_0__BLANK_); - (cell_7_1__BLANK_, cell_1_1__BLANK_); - (cell_7_1__BLANK_, cell_2_1__BLANK_); - (cell_7_1__BLANK_, cell_3_1__BLANK_); - (cell_7_1__BLANK_, cell_4_1__BLANK_); - (cell_7_1__BLANK_, cell_5_1__BLANK_); - (cell_7_1__BLANK_, cell_6_1__BLANK_); - (cell_7_1__BLANK_, cell_7_1__BLANK_); - (cell_7_2__BLANK_, cell_1_2__BLANK_); - (cell_7_2__BLANK_, cell_2_2__BLANK_); - (cell_7_2__BLANK_, cell_3_2__BLANK_); - (cell_7_2__BLANK_, cell_4_2__BLANK_); - (cell_7_2__BLANK_, cell_5_2__BLANK_); - (cell_7_2__BLANK_, cell_6_2__BLANK_); - (cell_7_2__BLANK_, cell_7_2__BLANK_); - (cell_7_3__BLANK_, cell_1_3__BLANK_); - (cell_7_3__BLANK_, cell_2_3__BLANK_); - (cell_7_3__BLANK_, cell_3_3__BLANK_); - (cell_7_3__BLANK_, cell_4_3__BLANK_); - (cell_7_3__BLANK_, cell_5_3__BLANK_); - (cell_7_3__BLANK_, cell_6_3__BLANK_); - (cell_7_3__BLANK_, cell_7_3__BLANK_); - (cell_7_4__BLANK_, cell_1_4__BLANK_); - (cell_7_4__BLANK_, cell_2_4__BLANK_); - (cell_7_4__BLANK_, cell_3_4__BLANK_); - (cell_7_4__BLANK_, cell_4_4__BLANK_); - (cell_7_4__BLANK_, cell_5_4__BLANK_); - (cell_7_4__BLANK_, cell_6_4__BLANK_); - (cell_7_4__BLANK_, cell_7_4__BLANK_); - (cell_7_5__BLANK_, cell_1_5__BLANK_); - (cell_7_5__BLANK_, cell_2_5__BLANK_); - (cell_7_5__BLANK_, cell_3_5__BLANK_); - (cell_7_5__BLANK_, cell_4_5__BLANK_); - (cell_7_5__BLANK_, cell_5_5__BLANK_); - (cell_7_5__BLANK_, cell_6_5__BLANK_); - (cell_7_5__BLANK_, cell_7_5__BLANK_); - (cell_7_6__BLANK_, cell_1_6__BLANK_); - (cell_7_6__BLANK_, cell_2_6__BLANK_); - (cell_7_6__BLANK_, cell_3_6__BLANK_); - (cell_7_6__BLANK_, cell_4_6__BLANK_); - (cell_7_6__BLANK_, cell_5_6__BLANK_); - (cell_7_6__BLANK_, cell_6_6__BLANK_); - (cell_7_6__BLANK_, cell_7_6__BLANK_) - }; R { (cell_1_0__BLANK_, cell_1_1__BLANK_); (cell_1_1__BLANK_, cell_1_2__BLANK_); @@ -1243,306 +886,9 @@ }; cell_2r:1 {}; cell_2w:1 {}; control_0red:1 {}; control_0white (control__BLANK_); control__BLANK_ (control__BLANK_); - role {val__red; val__white}; - succ__cell_1__cell_1 { - (cell_1_0__BLANK_, cell_1_1__BLANK_); - (cell_1_0__BLANK_, cell_2_1__BLANK_); - (cell_1_0__BLANK_, cell_3_1__BLANK_); - (cell_1_0__BLANK_, cell_4_1__BLANK_); - (cell_1_0__BLANK_, cell_5_1__BLANK_); - (cell_1_0__BLANK_, cell_6_1__BLANK_); - (cell_1_0__BLANK_, cell_7_1__BLANK_); - (cell_1_1__BLANK_, cell_1_2__BLANK_); - (cell_1_1__BLANK_, cell_2_2__BLANK_); - (cell_1_1__BLANK_, cell_3_2__BLANK_); - (cell_1_1__BLANK_, cell_4_2__BLANK_); - (cell_1_1__BLANK_, cell_5_2__BLANK_); - (cell_1_1__BLANK_, cell_6_2__BLANK_); - (cell_1_1__BLANK_, cell_7_2__BLANK_); - (cell_1_2__BLANK_, cell_1_3__BLANK_); - (cell_1_2__BLANK_, cell_2_3__BLANK_); - (cell_1_2__BLANK_, cell_3_3__BLANK_); - (cell_1_2__BLANK_, cell_4_3__BLANK_); - (cell_1_2__BLANK_, cell_5_3__BLANK_); - (cell_1_2__BLANK_, cell_6_3__BLANK_); - (cell_1_2__BLANK_, cell_7_3__BLANK_); - (cell_1_3__BLANK_, cell_1_4__BLANK_); - (cell_1_3__BLANK_, cell_2_4__BLANK_); - (cell_1_3__BLANK_, cell_3_4__BLANK_); - (cell_1_3__BLANK_, cell_4_4__BLANK_); - (cell_1_3__BLANK_, cell_5_4__BLANK_); - (cell_1_3__BLANK_, cell_6_4__BLANK_); - (cell_1_3__BLANK_, cell_7_4__BLANK_); - (cell_1_4__BLANK_, cell_1_5__BLANK_); - (cell_1_4__BLANK_, cell_2_5__BLANK_); - (cell_1_4__BLANK_, cell_3_5__BLANK_); - (cell_1_4__BLANK_, cell_4_5__BLANK_); - (cell_1_4__BLANK_, cell_5_5__BLANK_); - (cell_1_4__BLANK_, cell_6_5__BLANK_); - (cell_1_4__BLANK_, cell_7_5__BLANK_); - (cell_1_5__BLANK_, cell_1_6__BLANK_); - (cell_1_5__BLANK_, cell_2_6__BLANK_); - (cell_1_5__BLANK_, cell_3_6__BLANK_); - (cell_1_5__BLANK_, cell_4_6__BLANK_); - (cell_1_5__BLANK_, cell_5_6__BLANK_); - (cell_1_5__BLANK_, cell_6_6__BLANK_); - (cell_1_5__BLANK_, cell_7_6__BLANK_); - (cell_2_0__BLANK_, cell_1_1__BLANK_); - (cell_2_0__BLANK_, cell_2_1__BLANK_); - (cell_2_0__BLANK_, cell_3_1__BLANK_); - (cell_2_0__BLANK_, cell_4_1__BLANK_); - (cell_2_0__BLANK_, cell_5_1__BLANK_); - (cell_2_0__BLANK_, cell_6_1__BLANK_); - (cell_2_0__BLANK_, cell_7_1__BLANK_); - (cell_2_1__BLANK_, cell_1_2__BLANK_); - (cell_2_1__BLANK_, cell_2_2__BLANK_); - (cell_2_1__BLANK_, cell_3_2__BLANK_); - (cell_2_1__BLANK_, cell_4_2__BLANK_); - (cell_2_1__BLANK_, cell_5_2__BLANK_); - (cell_2_1__BLANK_, cell_6_2__BLANK_); - (cell_2_1__BLANK_, cell_7_2__BLANK_); - (cell_2_2__BLANK_, cell_1_3__BLANK_); - (cell_2_2__BLANK_, cell_2_3__BLANK_); - (cell_2_2__BLANK_, cell_3_3__BLANK_); - (cell_2_2__BLANK_, cell_4_3__BLANK_); - (cell_2_2__BLANK_, cell_5_3__BLANK_); - (cell_2_2__BLANK_, cell_6_3__BLANK_); - (cell_2_2__BLANK_, cell_7_3__BLANK_); - (cell_2_3__BLANK_, cell_1_4__BLANK_); - (cell_2_3__BLANK_, cell_2_4__BLANK_); - (cell_2_3__BLANK_, cell_3_4__BLANK_); - (cell_2_3__BLANK_, cell_4_4__BLANK_); - (cell_2_3__BLANK_, cell_5_4__BLANK_); - (cell_2_3__BLANK_, cell_6_4__BLANK_); - (cell_2_3__BLANK_, cell_7_4__BLANK_); - (cell_2_4__BLANK_, cell_1_5__BLANK_); - (cell_2_4__BLANK_, cell_2_5__BLANK_); - (cell_2_4__BLANK_, cell_3_5__BLANK_); - (cell_2_4__BLANK_, cell_4_5__BLANK_); - (cell_2_4__BLANK_, cell_5_5__BLANK_); - (cell_2_4__BLANK_, cell_6_5__BLANK_); - (cell_2_4__BLANK_, cell_7_5__BLANK_); - (cell_2_5__BLANK_, cell_1_6__BLANK_); - (cell_2_5__BLANK_, cell_2_6__BLANK_); - (cell_2_5__BLANK_, cell_3_6__BLANK_); - (cell_2_5__BLANK_, cell_4_6__BLANK_); - (cell_2_5__BLANK_, cell_5_6__BLANK_); - (cell_2_5__BLANK_, cell_6_6__BLANK_); - (cell_2_5__BLANK_, cell_7_6__BLANK_); - (cell_3_0__BLANK_, cell_1_1__BLANK_); - (cell_3_0__BLANK_, cell_2_1__BLANK_); - (cell_3_0__BLANK_, cell_3_1__BLANK_); - (cell_3_0__BLANK_, cell_4_1__BLANK_); - (cell_3_0__BLANK_, cell_5_1__BLANK_); - (cell_3_0__BLANK_, cell_6_1__BLANK_); - (cell_3_0__BLANK_, cell_7_1__BLANK_); - (cell_3_1__BLANK_, cell_1_2__BLANK_); - (cell_3_1__BLANK_, cell_2_2__BLANK_); - (cell_3_1__BLANK_, cell_3_2__BLANK_); - (cell_3_1__BLANK_, cell_4_2__BLANK_); - (cell_3_1__BLANK_, cell_5_2__BLANK_); - (cell_3_1__BLANK_, cell_6_2__BLANK_); - (cell_3_1__BLANK_, cell_7_2__BLANK_); - (cell_3_2__BLANK_, cell_1_3__BLANK_); - (cell_3_2__BLANK_, cell_2_3__BLANK_); - (cell_3_2__BLANK_, cell_3_3__BLANK_); - (cell_3_2__BLANK_, cell_4_3__BLANK_); - (cell_3_2__BLANK_, cell_5_3__BLANK_); - (cell_3_2__BLANK_, cell_6_3__BLANK_); - (cell_3_2__BLANK_, cell_7_3__BLANK_); - (cell_3_3__BLANK_, cell_1_4__BLANK_); - (cell_3_3__BLANK_, cell_2_4__BLANK_); - (cell_3_3__BLANK_, cell_3_4__BLANK_); - (cell_3_3__BLANK_, cell_4_4__BLANK_); - (cell_3_3__BLANK_, cell_5_4__BLANK_); - (cell_3_3__BLANK_, cell_6_4__BLANK_); - (cell_3_3__BLANK_, cell_7_4__BLANK_); - (cell_3_4__BLANK_, cell_1_5__BLANK_); - (cell_3_4__BLANK_, cell_2_5__BLANK_); - (cell_3_4__BLANK_, cell_3_5__BLANK_); - (cell_3_4__BLANK_, cell_4_5__BLANK_); - (cell_3_4__BLANK_, cell_5_5__BLANK_); - (cell_3_4__BLANK_, cell_6_5__BLANK_); - (cell_3_4__BLANK_, cell_7_5__BLANK_); - (cell_3_5__BLANK_, cell_1_6__BLANK_); - (cell_3_5__BLANK_, cell_2_6__BLANK_); - (cell_3_5__BLANK_, cell_3_6__BLANK_); - (cell_3_5__BLANK_, cell_4_6__BLANK_); - (cell_3_5__BLANK_, cell_5_6__BLANK_); - (cell_3_5__BLANK_, cell_6_6__BLANK_); - (cell_3_5__BLANK_, cell_7_6__BLANK_); - (cell_4_0__BLANK_, cell_1_1__BLANK_); - (cell_4_0__BLANK_, cell_2_1__BLANK_); - (cell_4_0__BLANK_, cell_3_1__BLANK_); - (cell_4_0__BLANK_, cell_4_1__BLANK_); - (cell_4_0__BLANK_, cell_5_1__BLANK_); - (cell_4_0__BLANK_, cell_6_1__BLANK_); - (cell_4_0__BLANK_, cell_7_1__BLANK_); - (cell_4_1__BLANK_, cell_1_2__BLANK_); - (cell_4_1__BLANK_, cell_2_2__BLANK_); - (cell_4_1__BLANK_, cell_3_2__BLANK_); - (cell_4_1__BLANK_, cell_4_2__BLANK_); - (cell_4_1__BLANK_, cell_5_2__BLANK_); - (cell_4_1__BLANK_, cell_6_2__BLANK_); - (cell_4_1__BLANK_, cell_7_2__BLANK_); - (cell_4_2__BLANK_, cell_1_3__BLANK_); - (cell_4_2__BLANK_, cell_2_3__BLANK_); - (cell_4_2__BLANK_, cell_3_3__BLANK_); - (cell_4_2__BLANK_, cell_4_3__BLANK_); - (cell_4_2__BLANK_, cell_5_3__BLANK_); - (cell_4_2__BLANK_, cell_6_3__BLANK_); - (cell_4_2__BLANK_, cell_7_3__BLANK_); - (cell_4_3__BLANK_, cell_1_4__BLANK_); - (cell_4_3__BLANK_, cell_2_4__BLANK_); - (cell_4_3__BLANK_, cell_3_4__BLANK_); - (cell_4_3__BLANK_, cell_4_4__BLANK_); - (cell_4_3__BLANK_, cell_5_4__BLANK_); - (cell_4_3__BLANK_, cell_6_4__BLANK_); - (cell_4_3__BLANK_, cell_7_4__BLANK_); - (cell_4_4__BLANK_, cell_1_5__BLANK_); - (cell_4_4__BLANK_, cell_2_5__BLANK_); - (cell_4_4__BLANK_, cell_3_5__BLANK_); - (cell_4_4__BLANK_, cell_4_5__BLANK_); - (cell_4_4__BLANK_, cell_5_5__BLANK_); - (cell_4_4__BLANK_, cell_6_5__BLANK_); - (cell_4_4__BLANK_, cell_7_5__BLANK_); - (cell_4_5__BLANK_, cell_1_6__BLANK_); - (cell_4_5__BLANK_, cell_2_6__BLANK_); - (cell_4_5__BLANK_, cell_3_6__BLANK_); - (cell_4_5__BLANK_, cell_4_6__BLANK_); - (cell_4_5__BLANK_, cell_5_6__BLANK_); - (cell_4_5__BLANK_, cell_6_6__BLANK_); - (cell_4_5__BLANK_, cell_7_6__BLANK_); - (cell_5_0__BLANK_, cell_1_1__BLANK_); - (cell_5_0__BLANK_, cell_2_1__BLANK_); - (cell_5_0__BLANK_, cell_3_1__BLANK_); - (cell_5_0__BLANK_, cell_4_1__BLANK_); - (cell_5_0__BLANK_, cell_5_1__BLANK_); - (cell_5_0__BLANK_, cell_6_1__BLANK_); - (cell_5_0__BLANK_, cell_7_1__BLANK_); - (cell_5_1__BLANK_, cell_1_2__BLANK_); - (cell_5_1__BLANK_, cell_2_2__BLANK_); - (cell_5_1__BLANK_, cell_3_2__BLANK_); - (cell_5_1__BLANK_, cell_4_2__BLANK_); - (cell_5_1__BLANK_, cell_5_2__BLANK_); - (cell_5_1__BLANK_, cell_6_2__BLANK_); - (cell_5_1__BLANK_, cell_7_2__BLANK_); - (cell_5_2__BLANK_, cell_1_3__BLANK_); - (cell_5_2__BLANK_, cell_2_3__BLANK_); - (cell_5_2__BLANK_, cell_3_3__BLANK_); - (cell_5_2__BLANK_, cell_4_3__BLANK_); - (cell_5_2__BLANK_, cell_5_3__BLANK_); - (cell_5_2__BLANK_, cell_6_3__BLANK_); - (cell_5_2__BLANK_, cell_7_3__BLANK_); - (cell_5_3__BLANK_, cell_1_4__BLANK_); - (cell_5_3__BLANK_, cell_2_4__BLANK_); - (cell_5_3__BLANK_, cell_3_4__BLANK_); - (cell_5_3__BLANK_, cell_4_4__BLANK_); - (cell_5_3__BLANK_, cell_5_4__BLANK_); - (cell_5_3__BLANK_, cell_6_4__BLANK_); - (cell_5_3__BLANK_, cell_7_4__BLANK_); - (cell_5_4__BLANK_, cell_1_5__BLANK_); - (cell_5_4__BLANK_, cell_2_5__BLANK_); - (cell_5_4__BLANK_, cell_3_5__BLANK_); - (cell_5_4__BLANK_, cell_4_5__BLANK_); - (cell_5_4__BLANK_, cell_5_5__BLANK_); - (cell_5_4__BLANK_, cell_6_5__BLANK_); - (cell_5_4__BLANK_, cell_7_5__BLANK_); - (cell_5_5__BLANK_, cell_1_6__BLANK_); - (cell_5_5__BLANK_, cell_2_6__BLANK_); - (cell_5_5__BLANK_, cell_3_6__BLANK_); - (cell_5_5__BLANK_, cell_4_6__BLANK_); - (cell_5_5__BLANK_, cell_5_6__BLANK_); - (cell_5_5__BLANK_, cell_6_6__BLANK_); - (cell_5_5__BLANK_, cell_7_6__BLANK_); - (cell_6_0__BLANK_, cell_1_1__BLANK_); - (cell_6_0__BLANK_, cell_2_1__BLANK_); - (cell_6_0__BLANK_, cell_3_1__BLANK_); - (cell_6_0__BLANK_, cell_4_1__BLANK_); - (cell_6_0__BLANK_, cell_5_1__BLANK_); - (cell_6_0__BLANK_, cell_6_1__BLANK_); - (cell_6_0__BLANK_, cell_7_1__BLANK_); - (cell_6_1__BLANK_, cell_1_2__BLANK_); - (cell_6_1__BLANK_, cell_2_2__BLANK_); - (cell_6_1__BLANK_, cell_3_2__BLANK_); - (cell_6_1__BLANK_, cell_4_2__BLANK_); - (cell_6_1__BLANK_, cell_5_2__BLANK_); - (cell_6_1__BLANK_, cell_6_2__BLANK_); - (cell_6_1__BLANK_, cell_7_2__BLANK_); - (cell_6_2__BLANK_, cell_1_3__BLANK_); - (cell_6_2__BLANK_, cell_2_3__BLANK_); - (cell_6_2__BLANK_, cell_3_3__BLANK_); - (cell_6_2__BLANK_, cell_4_3__BLANK_); - (cell_6_2__BLANK_, cell_5_3__BLANK_); - (cell_6_2__BLANK_, cell_6_3__BLANK_); - (cell_6_2__BLANK_, cell_7_3__BLANK_); - (cell_6_3__BLANK_, cell_1_4__BLANK_); - (cell_6_3__BLANK_, cell_2_4__BLANK_); - (cell_6_3__BLANK_, cell_3_4__BLANK_); - (cell_6_3__BLANK_, cell_4_4__BLANK_); - (cell_6_3__BLANK_, cell_5_4__BLANK_); - (cell_6_3__BLANK_, cell_6_4__BLANK_); - (cell_6_3__BLANK_, cell_7_4__BLANK_); - (cell_6_4__BLANK_, cell_1_5__BLANK_); - (cell_6_4__BLANK_, cell_2_5__BLANK_); - (cell_6_4__BLANK_, cell_3_5__BLANK_); - (cell_6_4__BLANK_, cell_4_5__BLANK_); - (cell_6_4__BLANK_, cell_5_5__BLANK_); - (cell_6_4__BLANK_, cell_6_5__BLANK_); - (cell_6_4__BLANK_, cell_7_5__BLANK_); - (cell_6_5__BLANK_, cell_1_6__BLANK_); - (cell_6_5__BLANK_, cell_2_6__BLANK_); - (cell_6_5__BLANK_, cell_3_6__BLANK_); - (cell_6_5__BLANK_, cell_4_6__BLANK_); - (cell_6_5__BLANK_, cell_5_6__BLANK_); - (cell_6_5__BLANK_, cell_6_6__BLANK_); - (cell_6_5__BLANK_, cell_7_6__BLANK_); - (cell_7_0__BLANK_, cell_1_1__BLANK_); - (cell_7_0__BLANK_, cell_2_1__BLANK_); - (cell_7_0__BLANK_, cell_3_1__BLANK_); - (cell_7_0__BLANK_, cell_4_1__BLANK_); - (cell_7_0__BLANK_, cell_5_1__BLANK_); - (cell_7_0__BLANK_, cell_6_1__BLANK_); - (cell_7_0__BLANK_, cell_7_1__BLANK_); - (cell_7_1__BLANK_, cell_1_2__BLANK_); - (cell_7_1__BLANK_, cell_2_2__BLANK_); - (cell_7_1__BLANK_, cell_3_2__BLANK_); - (cell_7_1__BLANK_, cell_4_2__BLANK_); - (cell_7_1__BLANK_, cell_5_2__BLANK_); - (cell_7_1__BLANK_, cell_6_2__BLANK_); - (cell_7_1__BLANK_, cell_7_2__BLANK_); - (cell_7_2__BLANK_, cell_1_3__BLANK_); - (cell_7_2__BLANK_, cell_2_3__BLANK_); - (cell_7_2__BLANK_, cell_3_3__BLANK_); - (cell_7_2__BLANK_, cell_4_3__BLANK_); - (cell_7_2__BLANK_, cell_5_3__BLANK_); - (cell_7_2__BLANK_, cell_6_3__BLANK_); - (cell_7_2__BLANK_, cell_7_3__BLANK_); - (cell_7_3__BLANK_, cell_1_4__BLANK_); - (cell_7_3__BLANK_, cell_2_4__BLANK_); - (cell_7_3__BLANK_, cell_3_4__BLANK_); - (cell_7_3__BLANK_, cell_4_4__BLANK_); - (cell_7_3__BLANK_, cell_5_4__BLANK_); - (cell_7_3__BLANK_, cell_6_4__BLANK_); - (cell_7_3__BLANK_, cell_7_4__BLANK_); - (cell_7_4__BLANK_, cell_1_5__BLANK_); - (cell_7_4__BLANK_, cell_2_5__BLANK_); - (cell_7_4__BLANK_, cell_3_5__BLANK_); - (cell_7_4__BLANK_, cell_4_5__BLANK_); - (cell_7_4__BLANK_, cell_5_5__BLANK_); - (cell_7_4__BLANK_, cell_6_5__BLANK_); - (cell_7_4__BLANK_, cell_7_5__BLANK_); - (cell_7_5__BLANK_, cell_1_6__BLANK_); - (cell_7_5__BLANK_, cell_2_6__BLANK_); - (cell_7_5__BLANK_, cell_3_6__BLANK_); - (cell_7_5__BLANK_, cell_4_6__BLANK_); - (cell_7_5__BLANK_, cell_5_6__BLANK_); - (cell_7_5__BLANK_, cell_6_6__BLANK_); - (cell_7_5__BLANK_, cell_7_6__BLANK_) - }; - val__08 (val__8); val__0b (val__b); val__0dirt (val__dirt); - val__0r (val__r); val__0red (val__red); val__0w (val__w); - val__0white (val__white); + role {val__red; val__white}; val__08 (val__8); val__0b (val__b); + val__0dirt (val__dirt); val__0r (val__r); val__0red (val__red); + val__0w (val__w); val__0white (val__white); val___BLANK_ { val__8; val__b; val__dirt; val__r; val__red; val__w; val__white} | This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-10-21 14:16:28
|
Revision: 1609 http://toss.svn.sourceforge.net/toss/?rev=1609&view=rev Author: lukstafi Date: 2011-10-21 14:16:20 +0000 (Fri, 21 Oct 2011) Log Message: ----------- GDL translation: bug fix in detecting unframed fluents. Introducing 2player_normal_form_joint.gdl with synchronization according to Toss semantics. Alternative tictactoe definition missing from previous commit. Modified Paths: -------------- trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml trunk/Toss/GGP/tests/pacman3p-raw.toss trunk/Toss/GGP/tests/pacman3p-simpl.toss Added Paths: ----------- trunk/Toss/GGP/examples/2player_normal_form_joint.gdl trunk/Toss/GGP/examples/tictactoe-other.gdl trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss trunk/Toss/GGP/tests/tictactoe-other-raw.toss trunk/Toss/GGP/tests/tictactoe-other-simpl.toss Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-10-20 21:14:28 UTC (rev 1608) +++ trunk/Toss/GGP/TranslateGame.ml 2011-10-21 14:16:20 UTC (rev 1609) @@ -263,7 +263,7 @@ playout_prolog ~aggregate:true players !playout_horizon program in *) (* {{{ log entry *) - if !debug_level > 3 then ( + if !debug_level > 4 then ( Printf.printf "prepare_paths_and_elems: static_base= %s\n%!" (String.concat ", " (List.map rel_atom_str (graph_to_atoms static_base))) @@ -2108,10 +2108,15 @@ let signat = Structure.rel_signature struc in (* we find which rule results should have their old values erased, in cases not covered by erasure clauses *) - let unframed_fluents = Aux.list_diff - (Aux.concat_map - (map_paths (fun p subt -> p, subt) f_paths) case_rhs) - framed_fluents in + let used_fluents = Aux.concat_map + (map_paths (fun p subt -> p, subt) f_paths) case_rhs in + let unframed_fluents = List.filter + (fun (p, subt) -> + let f_subts = Aux.assoc_all p framed_fluents in + not (List.exists (function + | Var _ -> true + | f_subt -> f_subt = subt) f_subts)) + used_fluents in let unframed_elems = List.filter (fun st -> List.exists (fun (p,subt) -> try at_path st p = subt with Not_found -> false) Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-10-20 21:14:28 UTC (rev 1608) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-10-21 14:16:20 UTC (rev 1609) @@ -214,9 +214,9 @@ ~loc1_noop:"NOOP" ~loc1_move:"(MARK 3 3)" ); - "2player_normal_form_2010" >:: + "2player_normal_form_joint" >:: (fun () -> - simult_test_case ~game_name:"2player_normal_form_2010" ~player:"row" + simult_test_case ~game_name:"2player_normal_form_joint" ~player:"row" ~plnum:1 (* 0 is environment! *) ~moves:[|"r1"; "c1"|] ~rules_and_embs:[| @@ -361,18 +361,14 @@ let a () = set_debug_level 4; - game_test_case ~game_name:"tictactoe" ~player:"xplayer" - ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"mark_x6_y_noop" - ~loc0_emb:[ - "cell_x6_y__BLANK_", "cell_2_2__BLANK_"; - "control__BLANK_", "control__BLANK_"] - ~loc0_move:"(mark 2 2)" ~loc0_noop:"noop" - ~loc1:1 ~loc1_rule_name:"noop_mark_x7_y0" - ~loc1_emb:[ - "cell_x7_y0__BLANK_", "cell_1_1__BLANK_"; - "control__BLANK_", "control__BLANK_"] - ~loc1_noop:"noop" ~loc1_move:"(mark 1 1)"; + simult_test_case ~game_name:"2player_normal_form_joint" ~player:"row" + ~plnum:1 (* 0 is environment! *) + ~moves:[|"r1"; "c1"|] + ~rules_and_embs:[| + "m", ["did__BLANK__m", "did__BLANK__r1"; + "synch_control_", "synch_control_"]; + "m2", ["did__BLANK__m2", "did__BLANK__c1"; + "synch_control_", "synch_control_"] |]; (* failwith "tested"; *) () @@ -417,6 +413,7 @@ (* regenerate ~debug:true ~game_name:"pawn_whopping" ~player:"x"; *) (* regenerate ~debug:false ~game_name:"connect4" ~player:"white"; *) (* regenerate ~debug:false ~game_name:"2player_normal_form_2010" ~player:"row"; *) + (* regenerate ~debug:false ~game_name:"2player_normal_form_joint" ~player:"row"; *) (* regenerate ~debug:true ~game_name:"pacman3p" ~player:"pacman"; *) (* failwith "generated"; *) () Added: trunk/Toss/GGP/examples/2player_normal_form_joint.gdl =================================================================== --- trunk/Toss/GGP/examples/2player_normal_form_joint.gdl (rev 0) +++ trunk/Toss/GGP/examples/2player_normal_form_joint.gdl 2011-10-21 14:16:20 UTC (rev 1609) @@ -0,0 +1,41 @@ +; While 2player_normal_form_2010 uses disjunction over players +; to test termination, we check conjunction, to get synchronization +; that matches Toss semantics. + +(role row) +(role column) + +(init (reward r1 c1 90 90)) +(init (reward r1 c2 40 30)) +(init (reward r1 c3 20 80)) +(init (reward r2 c1 30 40)) +(init (reward r2 c2 0 0)) +(init (reward r2 c3 50 100)) +(init (reward r3 c1 80 20)) +(init (reward r3 c2 100 50)) +(init (reward r3 c3 10 10)) + +(<= (legal row ?m1) + (true (reward ?m1 ?m2 ?r1 ?r2))) +(<= (legal column ?m2) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (next (did ?p ?m)) + (does ?p ?m)) + +(<= (next (reward ?m1 ?m2 ?r1 ?r2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (goal row ?r1) + (true (did row ?m1)) + (true (did column ?m2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= (goal column ?r2) + (true (did row ?m1)) + (true (did column ?m2)) + (true (reward ?m1 ?m2 ?r1 ?r2))) + +(<= terminal + (true (did row ?m1)) + (true (did column ?m2))) Added: trunk/Toss/GGP/examples/tictactoe-other.gdl =================================================================== --- trunk/Toss/GGP/examples/tictactoe-other.gdl (rev 0) +++ trunk/Toss/GGP/examples/tictactoe-other.gdl 2011-10-21 14:16:20 UTC (rev 1609) @@ -0,0 +1,33 @@ +(ROLE XPLAYER) +(ROLE OPLAYER) +(INIT (CELL 1 1 XPLAYER)) +(INIT (CELL 1 2 OPLAYER)) +(INIT (CELL 1 3 B)) +(INIT (CELL 2 1 B)) +(INIT (CELL 2 2 B)) +(INIT (CELL 2 3 B)) +(INIT (CELL 3 1 B)) +(INIT (CELL 3 2 B)) +(INIT (CELL 3 3 B)) +(INIT (CONTROL XPLAYER)) +(<= (NEXT (CELL ?X ?Y ?PLAYER)) (DOES ?PLAYER (MARK ?X ?Y))) +(<= (NEXT (CELL ?X ?Y ?MARK)) (TRUE (CELL ?X ?Y ?MARK)) (DOES ?PLAYER (MARK ?M ?N)) (DISTINCTCELL ?X ?Y ?M ?N)) +(<= (NEXT (CONTROL XPLAYER)) (TRUE (CONTROL OPLAYER))) +(<= (NEXT (CONTROL OPLAYER)) (TRUE (CONTROL XPLAYER))) +(<= (ROW ?X ?PLAYER) (ROLE ?PLAYER) (TRUE (CELL ?X 1 ?PLAYER)) (TRUE (CELL ?X 2 ?PLAYER)) (TRUE (CELL ?X 3 ?PLAYER))) +(<= (COLUMN ?Y ?PLAYER) (ROLE ?PLAYER) (TRUE (CELL 1 ?Y ?PLAYER)) (TRUE (CELL 2 ?Y ?PLAYER)) (TRUE (CELL 3 ?Y ?PLAYER))) +(<= (DIAGONAL ?PLAYER) (ROLE ?PLAYER) (TRUE (CELL 1 1 ?PLAYER)) (TRUE (CELL 2 2 ?PLAYER)) (TRUE (CELL 3 3 ?PLAYER))) +(<= (DIAGONAL ?PLAYER) (ROLE ?PLAYER) (TRUE (CELL 1 3 ?PLAYER)) (TRUE (CELL 2 2 ?PLAYER)) (TRUE (CELL 3 1 ?PLAYER))) +(<= (LINE ?PLAYER) (ROW ?X ?PLAYER)) +(<= (LINE ?PLAYER) (COLUMN ?Y ?PLAYER)) +(<= (LINE ?PLAYER) (DIAGONAL ?PLAYER)) +(<= OPEN (TRUE (CELL ?X ?Y B))) +(<= (DISTINCTCELL ?X ?Y ?M ?N) (DISTINCT ?X ?M)) +(<= (DISTINCTCELL ?X ?Y ?M ?N) (DISTINCT ?Y ?N)) +(<= (LEGAL ?PLAYER (MARK ?X ?Y)) (TRUE (CELL ?X ?Y B)) (TRUE (CONTROL ?PLAYER))) +(<= (LEGAL ?PLAYER NOOP) (NOT (TRUE (CONTROL ?PLAYER)))) +(<= (GOAL ?PLAYER 100) (LINE ?PLAYER)) +(<= (GOAL ?PLAYER 50) (NOT (LINE XPLAYER)) (NOT (LINE OPLAYER)) (NOT OPEN)) +(<= (GOAL ?PLAYER1 0) (LINE ?PLAYER2) (DISTINCT ?PLAYER1 ?PLAYER2)) +(<= TERMINAL (LINE ?PLAYER)) +(<= TERMINAL (NOT OPEN)) \ No newline at end of file Added: trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss =================================================================== --- trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss (rev 0) +++ trunk/Toss/GGP/tests/2player_normal_form_joint-raw.toss 2011-10-21 14:16:20 UTC (rev 1609) @@ -0,0 +1,274 @@ +REL terminal() = + ex did__BLANK__m11, did__BLANK__m12 + (true and + did_0row(did__BLANK__m11) and did__BLANK___BLANK_(did__BLANK__m11) and + did_0column(did__BLANK__m12) and did__BLANK___BLANK_(did__BLANK__m12)) +PLAYERS environment, row, column +RULE m: + [did__BLANK__m, synch_control_ | + _opt_column__SYNC {did__BLANK__m; synch_control_}; + _opt_did_0column {did__BLANK__m; synch_control_}; + _opt_did_0row {did__BLANK__m; synch_control_}; + _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m); + synch_control_ (synch_control_) + | + ] -> + [did__BLANK__m, synch_control_ | + did_0row (did__BLANK__m); row__SYNC (synch_control_); + synch_control_ (synch_control_) + | + ] emb row__SYNC, column__SYNC, did_0column, did_0row + pre + (not terminal() and + ex val__r0, val__r, did__BLANK__m0 + (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and + val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r, + val__r0))) +RULE m2: + [did__BLANK__m2, synch_control_ | + _opt_column__SYNC (did__BLANK__m2); + _opt_did_0column {did__BLANK__m2; synch_control_}; + _opt_did_0row {did__BLANK__m2; synch_control_}; + _opt_row__SYNC {did__BLANK__m2; synch_control_}; + did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_) + | + ] -> + [did__BLANK__m2, synch_control_ | + column__SYNC (synch_control_); did_0column (did__BLANK__m2); + synch_control_ (synch_control_) + | + ] emb row__SYNC, column__SYNC, did_0column, did_0row + pre + (not terminal() and + ex val__r2, val__r1, did__BLANK__m1 + (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and + val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2, + val__r1, val__r2))) +RULE environment: + [synch_control_ | + _opt_did_0column (synch_control_); _opt_did_0row (synch_control_); + column__SYNC (synch_control_); row__SYNC (synch_control_); + synch_control_ (synch_control_) + | + ] -> [synch_control_ | | ] + emb row__SYNC, column__SYNC, did_0column, did_0row +LOC 0 { + PLAYER environment { PAYOFF 0. MOVES [environment -> 0] } + PLAYER row { + PAYOFF + 10. * + :( + ex val__r6, val__10, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__10, val__r6) and + val___BLANK_(val__r6) and val__010(val__10) and + val___BLANK_(val__10) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 100. * + :( + ex val__r6, val__100, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__100, val__r6) and + val___BLANK_(val__r6) and val__0100(val__100) and + val___BLANK_(val__100) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 20. * + :( + ex val__r6, val__20, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__20, val__r6) and + val___BLANK_(val__r6) and val__020(val__20) and + val___BLANK_(val__20) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 30. * + :( + ex val__r6, val__30, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__30, val__r6) and + val___BLANK_(val__r6) and val__030(val__30) and + val___BLANK_(val__30) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 40. * + :( + ex val__r6, val__40, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__40, val__r6) and + val___BLANK_(val__r6) and val__040(val__40) and + val___BLANK_(val__40) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 50. * + :( + ex val__r6, val__50, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__50, val__r6) and + val___BLANK_(val__r6) and val__050(val__50) and + val___BLANK_(val__50) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 80. * + :( + ex val__r6, val__80, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__80, val__r6) and + val___BLANK_(val__r6) and val__080(val__80) and + val___BLANK_(val__80) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + + + 90. * + :( + ex val__r6, val__90, did__BLANK__m7, did__BLANK__m8 + (reward(did__BLANK__m7, did__BLANK__m8, val__90, val__r6) and + val___BLANK_(val__r6) and val__090(val__90) and + val___BLANK_(val__90) and did_0row(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m7) and + did_0column(did__BLANK__m8) and did__BLANK___BLANK_(did__BLANK__m8)) + ) + MOVES [m -> 0] } + PLAYER column { + PAYOFF + 10. * + :( + ex val__10, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__10) and + val__010(val__10) and val___BLANK_(val__10) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 100. * + :( + ex val__100, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__100) and + val__0100(val__100) and val___BLANK_(val__100) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 20. * + :( + ex val__20, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__20) and + val__020(val__20) and val___BLANK_(val__20) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 30. * + :( + ex val__30, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__30) and + val__030(val__30) and val___BLANK_(val__30) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 40. * + :( + ex val__40, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__40) and + val__040(val__40) and val___BLANK_(val__40) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 50. * + :( + ex val__50, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__50) and + val__050(val__50) and val___BLANK_(val__50) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 80. * + :( + ex val__80, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__80) and + val__080(val__80) and val___BLANK_(val__80) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + + + 90. * + :( + ex val__90, val__r7, did__BLANK__m9, did__BLANK__m10 + (reward(did__BLANK__m9, did__BLANK__m10, val__r7, val__90) and + val__090(val__90) and val___BLANK_(val__90) and + val___BLANK_(val__r7) and did_0row(did__BLANK__m9) and + did__BLANK___BLANK_(did__BLANK__m9) and + did_0column(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m10)) + ) + MOVES [m2 -> 0] } +} +MODEL + [did__BLANK__c1, did__BLANK__c2, did__BLANK__c3, did__BLANK__r1, + did__BLANK__r2, did__BLANK__r3, val__0, val__10, val__100, val__20, + val__30, val__40, val__50, val__80, val__90, val__column, val__row, + synch_control_ | + EQ___did_1__did_1 { + (did__BLANK__c1, did__BLANK__c1); (did__BLANK__c2, did__BLANK__c2); + (did__BLANK__c3, did__BLANK__c3); (did__BLANK__r1, did__BLANK__r1); + (did__BLANK__r2, did__BLANK__r2); (did__BLANK__r3, did__BLANK__r3) + }; + EQ___val__0__val__0 { + (val__0, val__0); (val__10, val__10); (val__100, val__100); + (val__20, val__20); (val__30, val__30); (val__40, val__40); + (val__50, val__50); (val__80, val__80); (val__90, val__90); + (val__column, val__column); (val__row, val__row) + }; + column__SYNC:1 {}; did_0column:1 {}; did_0row:1 {}; + did_1c1 (did__BLANK__c1); did_1c2 (did__BLANK__c2); + did_1c3 (did__BLANK__c3); did_1r1 (did__BLANK__r1); + did_1r2 (did__BLANK__r2); did_1r3 (did__BLANK__r3); + did__BLANK___BLANK_ { + did__BLANK__c1; did__BLANK__c2; did__BLANK__c3; did__BLANK__r1; + did__BLANK__r2; did__BLANK__r3 + }; + reward { + (did__BLANK__r1, did__BLANK__c1, val__90, val__90); + (did__BLANK__r1, did__BLANK__c2, val__40, val__30); + (did__BLANK__r1, did__BLANK__c3, val__20, val__80); + (did__BLANK__r2, did__BLANK__c1, val__30, val__40); + (did__BLANK__r2, did__BLANK__c2, val__0, val__0); + (did__BLANK__r2, did__BLANK__c3, val__50, val__100); + (did__BLANK__r3, did__BLANK__c1, val__80, val__20); + (did__BLANK__r3, did__BLANK__c2, val__100, val__50); + (did__BLANK__r3, did__BLANK__c3, val__10, val__10) + }; + role {val__column; val__row}; row__SYNC:1 {}; + synch_control_ (synch_control_); val__00 (val__0); val__010 (val__10); + val__0100 (val__100); val__020 (val__20); val__030 (val__30); + val__040 (val__40); val__050 (val__50); val__080 (val__80); + val__090 (val__90); val__0column (val__column); val__0row (val__row); + val___BLANK_ { + val__0; val__10; val__100; val__20; val__30; val__40; val__50; val__80; + val__90; val__column; val__row + } + | + ] Added: trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss (rev 0) +++ trunk/Toss/GGP/tests/2player_normal_form_joint-simpl.toss 2011-10-21 14:16:20 UTC (rev 1609) @@ -0,0 +1,256 @@ +REL terminal() = + ex did__BLANK__m11, did__BLANK__m12 + (did__BLANK___BLANK_(did__BLANK__m11) and + did__BLANK___BLANK_(did__BLANK__m12) and did_0row(did__BLANK__m11) and + did_0column(did__BLANK__m12)) +PLAYERS environment, row, column +RULE m: + [did__BLANK__m, synch_control_ | + _opt_column__SYNC {did__BLANK__m; synch_control_}; + _opt_did_0column {did__BLANK__m; synch_control_}; + _opt_did_0row {did__BLANK__m; synch_control_}; + _opt_row__SYNC (did__BLANK__m); did__BLANK___BLANK_ (did__BLANK__m); + synch_control_ (synch_control_) + | + ] -> + [did__BLANK__m, synch_control_ | + did_0row (did__BLANK__m); row__SYNC (synch_control_); + synch_control_ (synch_control_) + | + ] emb column__SYNC, did_0column, did_0row, row__SYNC + pre + (not terminal() and + ex val__r0, val__r, did__BLANK__m0 + (did__BLANK___BLANK_(did__BLANK__m0) and val___BLANK_(val__r) and + val___BLANK_(val__r0) and reward(did__BLANK__m, did__BLANK__m0, val__r, + val__r0))) +RULE m2: + [did__BLANK__m2, synch_control_ | + _opt_column__SYNC (did__BLANK__m2); + _opt_did_0column {did__BLANK__m2; synch_control_}; + _opt_did_0row {did__BLANK__m2; synch_control_}; + _opt_row__SYNC {did__BLANK__m2; synch_control_}; + did__BLANK___BLANK_ (did__BLANK__m2); synch_control_ (synch_control_) + | + ] -> + [did__BLANK__m2, synch_control_ | + column__SYNC (synch_control_); did_0column (did__BLANK__m2); + synch_control_ (synch_control_) + | + ] emb column__SYNC, did_0column, did_0row, row__SYNC + pre + (not terminal() and + ex val__r2, val__r1, did__BLANK__m1 + (did__BLANK___BLANK_(did__BLANK__m1) and val___BLANK_(val__r1) and + val___BLANK_(val__r2) and reward(did__BLANK__m1, did__BLANK__m2, + val__r1, val__r2))) +RULE environment: + [synch_control_ | + _opt_did_0column (synch_control_); _opt_did_0row (synch_control_); + column__SYNC (synch_control_); row__SYNC (synch_control_); + synch_control_ (synch_control_) + | + ] -> [synch_control_ | | ] + emb column__SYNC, did_0column, did_0row, row__SYNC +LOC 0 { + PLAYER environment { PAYOFF 0. MOVES [environment -> 0] } + PLAYER row { + PAYOFF + 10. * + :( + ex val__r6, val__10, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__010(val__10) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__10, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 100. * + :( + ex val__r6, val__100, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__0100(val__100) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__100, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 20. * + :( + ex val__r6, val__20, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__020(val__20) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__20, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 30. * + :( + ex val__r6, val__30, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__030(val__30) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__30, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 40. * + :( + ex val__r6, val__40, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__040(val__40) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__40, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 50. * + :( + ex val__r6, val__50, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__050(val__50) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__50, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 80. * + :( + ex val__r6, val__80, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__080(val__80) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__80, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + + + 90. * + :( + ex val__r6, val__90, did__BLANK__m7, did__BLANK__m8 + (did__BLANK___BLANK_(did__BLANK__m7) and + did__BLANK___BLANK_(did__BLANK__m8) and val__090(val__90) and + val___BLANK_(val__r6) and reward(did__BLANK__m7, did__BLANK__m8, + val__90, val__r6) and did_0row(did__BLANK__m7) and + did_0column(did__BLANK__m8)) + ) + MOVES [m -> 0] } + PLAYER column { + PAYOFF + 10. * + :( + ex val__10, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__010(val__10) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__10) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 100. * + :( + ex val__100, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__0100(val__100) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__100) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 20. * + :( + ex val__20, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__020(val__20) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__20) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 30. * + :( + ex val__30, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__030(val__30) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__30) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 40. * + :( + ex val__40, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__040(val__40) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__40) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 50. * + :( + ex val__50, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__050(val__50) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__50) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 80. * + :( + ex val__80, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__080(val__80) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__80) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + + + 90. * + :( + ex val__90, val__r7, did__BLANK__m9, did__BLANK__m10 + (did__BLANK___BLANK_(did__BLANK__m10) and + did__BLANK___BLANK_(did__BLANK__m9) and val__090(val__90) and + val___BLANK_(val__r7) and reward(did__BLANK__m9, did__BLANK__m10, + val__r7, val__90) and did_0column(did__BLANK__m10) and + did_0row(did__BLANK__m9)) + ) + MOVES [m2 -> 0] } +} +MODEL + [did__BLANK__c1, did__BLANK__c2, did__BLANK__c3, did__BLANK__r1, + did__BLANK__r2, did__BLANK__r3, val__0, val__10, val__100, val__20, + val__30, val__40, val__50, val__80, val__90, val__column, val__row, + synch_control_ | + column__SYNC:1 {}; did_0column:1 {}; did_0row:1 {}; + did_1c1 (did__BLANK__c1); did_1c2 (did__BLANK__c2); + did_1c3 (did__BLANK__c3); did_1r1 (did__BLANK__r1); + did_1r2 (did__BLANK__r2); did_1r3 (did__BLANK__r3); + did__BLANK___BLANK_ { + did__BLANK__c1; did__BLANK__c2; did__BLANK__c3; did__BLANK__r1; + did__BLANK__r2; did__BLANK__r3 + }; + reward { + (did__BLANK__r1, did__BLANK__c1, val__90, val__90); + (did__BLANK__r1, did__BLANK__c2, val__40, val__30); + (did__BLANK__r1, did__BLANK__c3, val__20, val__80); + (did__BLANK__r2, did__BLANK__c1, val__30, val__40); + (did__BLANK__r2, did__BLANK__c2, val__0, val__0); + (did__BLANK__r2, did__BLANK__c3, val__50, val__100); + (did__BLANK__r3, did__BLANK__c1, val__80, val__20); + (did__BLANK__r3, did__BLANK__c2, val__100, val__50); + (did__BLANK__r3, did__BLANK__c3, val__10, val__10) + }; + role {val__column; val__row}; row__SYNC:1 {}; + synch_control_ (synch_control_); val__00 (val__0); val__010 (val__10); + val__0100 (val__100); val__020 (val__20); val__030 (val__30); + val__040 (val__40); val__050 (val__50); val__080 (val__80); + val__090 (val__90); val__0column (val__column); val__0row (val__row); + val___BLANK_ { + val__0; val__10; val__100; val__20; val__30; val__40; val__50; val__80; + val__90; val__column; val__row + } + | + ] Modified: trunk/Toss/GGP/tests/pacman3p-raw.toss =================================================================== --- trunk/Toss/GGP/tests/pacman3p-raw.toss 2011-10-20 21:14:28 UTC (rev 1608) +++ trunk/Toss/GGP/tests/pacman3p-raw.toss 2011-10-21 14:16:20 UTC (rev 1609) @@ -278,13 +278,10 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__east, control__BLANK_ + ex val__pacman, control__BLANK_ (control_0pacman(control__BLANK_) and - control__BLANK_(control__BLANK_) and val__0east(val__east) and - val___BLANK_(val__east) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and movable(val__pacman) and - val__0pacman(val__pacman) and val___BLANK_(val__pacman) and - not EQ___val__0__val__0(val__east, val__nowhere))) + control__BLANK_(control__BLANK_) and movable(val__pacman) and + val__0pacman(val__pacman) and val___BLANK_(val__pacman))) RULE move_north: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -367,13 +364,10 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__north, control__BLANK_ + ex val__pacman, control__BLANK_ (control_0pacman(control__BLANK_) and - control__BLANK_(control__BLANK_) and val__0north(val__north) and - val___BLANK_(val__north) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and movable(val__pacman) and - val__0pacman(val__pacman) and val___BLANK_(val__pacman) and - not EQ___val__0__val__0(val__north, val__nowhere))) + control__BLANK_(control__BLANK_) and movable(val__pacman) and + val__0pacman(val__pacman) and val___BLANK_(val__pacman))) RULE move_south: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -456,13 +450,10 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__south, control__BLANK_ + ex val__pacman, control__BLANK_ (control_0pacman(control__BLANK_) and - control__BLANK_(control__BLANK_) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and movable(val__pacman) and - val__0pacman(val__pacman) and val___BLANK_(val__pacman) and - val__0south(val__south) and val___BLANK_(val__south) and - not EQ___val__0__val__0(val__south, val__nowhere))) + control__BLANK_(control__BLANK_) and movable(val__pacman) and + val__0pacman(val__pacman) and val___BLANK_(val__pacman))) RULE move_west: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -545,13 +536,10 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__west, control__BLANK_ + ex val__pacman, control__BLANK_ (control_0pacman(control__BLANK_) and - control__BLANK_(control__BLANK_) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and movable(val__pacman) and - val__0pacman(val__pacman) and val___BLANK_(val__pacman) and - val__0west(val__west) and val___BLANK_(val__west) and - not EQ___val__0__val__0(val__west, val__nowhere))) + control__BLANK_(control__BLANK_) and movable(val__pacman) and + val__0pacman(val__pacman) and val___BLANK_(val__pacman))) RULE move_nowhere: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, synch_control_ | @@ -696,14 +684,11 @@ location_0pellet pre (not terminal() and - ex val__blinky, val__nowhere, val__east, control__BLANK_ + ex val__blinky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__blinky) and movable(val__blinky) and val__0blinky(val__blinky) and - val___BLANK_(val__blinky) and val__0east(val__east) and - val___BLANK_(val__east) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and - not EQ___val__0__val__0(val__east, val__nowhere))) + val___BLANK_(val__blinky))) RULE move_north0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -767,14 +752,11 @@ location_0pellet pre (not terminal() and - ex val__blinky, val__nowhere, val__north, control__BLANK_ + ex val__blinky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__blinky) and movable(val__blinky) and val__0blinky(val__blinky) and - val___BLANK_(val__blinky) and val__0north(val__north) and - val___BLANK_(val__north) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and - not EQ___val__0__val__0(val__north, val__nowhere))) + val___BLANK_(val__blinky))) RULE move_south0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -838,14 +820,11 @@ location_0pellet pre (not terminal() and - ex val__blinky, val__nowhere, val__south, control__BLANK_ + ex val__blinky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__blinky) and movable(val__blinky) and val__0blinky(val__blinky) and - val___BLANK_(val__blinky) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and val__0south(val__south) and - val___BLANK_(val__south) and - not EQ___val__0__val__0(val__south, val__nowhere))) + val___BLANK_(val__blinky))) RULE move_west0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -909,14 +888,11 @@ location_0pellet pre (not terminal() and - ex val__blinky, val__nowhere, val__west, control__BLANK_ + ex val__blinky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__blinky) and movable(val__blinky) and val__0blinky(val__blinky) and - val___BLANK_(val__blinky) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and val__0west(val__west) and - val___BLANK_(val__west) and - not EQ___val__0__val__0(val__west, val__nowhere))) + val___BLANK_(val__blinky))) RULE move_nowhere0: [location__BLANK__x11_y11, location__BLANK__x12_y12, synch_control_ | _nondistinct_ (location__BLANK__x11_y11, location__BLANK__x12_y12); @@ -1022,13 +998,11 @@ location_0pellet pre (not terminal() and - ex val__inky, val__nowhere, val__east, control__BLANK_ + ex val__inky, control__BLANK_ (control_0ghosts(control__BLANK_) and - control__BLANK_(control__BLANK_) and val__0east(val__east) and - val___BLANK_(val__east) and ghost(val__inky) and movable(val__inky) and - val__0inky(val__inky) and val___BLANK_(val__inky) and - val__0nowhere(val__nowhere) and val___BLANK_(val__nowhere) and - not EQ___val__0__val__0(val__east, val__nowhere))) + control__BLANK_(control__BLANK_) and ghost(val__inky) and + movable(val__inky) and val__0inky(val__inky) and + val___BLANK_(val__inky))) RULE move_north1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -1091,14 +1065,11 @@ location_0pellet pre (not terminal() and - ex val__inky, val__nowhere, val__north, control__BLANK_ + ex val__inky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__inky) and movable(val__inky) and val__0inky(val__inky) and - val___BLANK_(val__inky) and val__0north(val__north) and - val___BLANK_(val__north) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and - not EQ___val__0__val__0(val__north, val__nowhere))) + val___BLANK_(val__inky))) RULE move_south1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -1161,14 +1132,11 @@ location_0pellet pre (not terminal() and - ex val__inky, val__nowhere, val__south, control__BLANK_ + ex val__inky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__inky) and movable(val__inky) and val__0inky(val__inky) and - val___BLANK_(val__inky) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and val__0south(val__south) and - val___BLANK_(val__south) and - not EQ___val__0__val__0(val__south, val__nowhere))) + val___BLANK_(val__inky))) RULE move_west1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -1231,14 +1199,11 @@ location_0pellet pre (not terminal() and - ex val__inky, val__nowhere, val__west, control__BLANK_ + ex val__inky, control__BLANK_ (control_0ghosts(control__BLANK_) and control__BLANK_(control__BLANK_) and ghost(val__inky) and movable(val__inky) and val__0inky(val__inky) and - val___BLANK_(val__inky) and val__0nowhere(val__nowhere) and - val___BLANK_(val__nowhere) and val__0west(val__west) and - val___BLANK_(val__west) and - not EQ___val__0__val__0(val__west, val__nowhere))) + val___BLANK_(val__inky))) RULE move_nowhere1: [location__BLANK__x13_y13, location__BLANK__x14_y14, synch_control_ | _nondistinct_ (location__BLANK__x13_y13, location__BLANK__x14_y14); Modified: trunk/Toss/GGP/tests/pacman3p-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/pacman3p-simpl.toss 2011-10-20 21:14:28 UTC (rev 1608) +++ trunk/Toss/GGP/tests/pacman3p-simpl.toss 2011-10-21 14:16:20 UTC (rev 1609) @@ -149,11 +149,9 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__east, control__BLANK_ - (control__BLANK_(control__BLANK_) and val__0east(val__east) and - val__0nowhere(val__nowhere) and val__0pacman(val__pacman) and - control_0pacman(control__BLANK_) and - not EQ___val__0__val__0(val__east, val__nowhere))) + ex val__pacman, control__BLANK_ + (control__BLANK_(control__BLANK_) and val__0pacman(val__pacman) and + control_0pacman(control__BLANK_))) RULE move_north: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -236,11 +234,9 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__north, control__BLANK_ - (control__BLANK_(control__BLANK_) and val__0north(val__north) and - val__0nowhere(val__nowhere) and val__0pacman(val__pacman) and - control_0pacman(control__BLANK_) and - not EQ___val__0__val__0(val__north, val__nowhere))) + ex val__pacman, control__BLANK_ + (control__BLANK_(control__BLANK_) and val__0pacman(val__pacman) and + control_0pacman(control__BLANK_))) RULE move_south: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -323,11 +319,9 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__south, control__BLANK_ - (control__BLANK_(control__BLANK_) and val__0nowhere(val__nowhere) and - val__0pacman(val__pacman) and val__0south(val__south) and - control_0pacman(control__BLANK_) and - not EQ___val__0__val__0(val__south, val__nowhere))) + ex val__pacman, control__BLANK_ + (control__BLANK_(control__BLANK_) and val__0pacman(val__pacman) and + control_0pacman(control__BLANK_))) RULE move_west: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, location__BLANK__x_y, synch_control_ | @@ -410,11 +404,9 @@ ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and - ex val__pacman, val__nowhere, val__west, control__BLANK_ - (control__BLANK_(control__BLANK_) and val__0nowhere(val__nowhere) and - val__0pacman(val__pacman) and val__0west(val__west) and - control_0pacman(control__BLANK_) and - not EQ___val__0__val__0(val__west, val__nowhere))) + ex val__pacman, control__BLANK_ + (control__BLANK_(control__BLANK_) and val__0pacman(val__pacman) and + control_0pacman(control__BLANK_))) RULE move_nowhere: [gdl__counter, location__BLANK__x10_y10, location__BLANK__x9_y9, synch_control_ | @@ -556,11 +548,9 @@ pacman__SYNC pre (not terminal() and - ex val__blinky, val__nowhere, val__east, control__BLANK_ + ex val__blinky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0blinky(val__blinky) and - val__0east(val__east) and val__0nowhere(val__nowhere) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__east, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_north0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -624,11 +614,9 @@ pacman__SYNC pre (not terminal() and - ex val__blinky, val__nowhere, val__north, control__BLANK_ + ex val__blinky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0blinky(val__blinky) and - val__0north(val__north) and val__0nowhere(val__nowhere) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__north, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_south0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -692,11 +680,9 @@ pacman__SYNC pre (not terminal() and - ex val__blinky, val__nowhere, val__south, control__BLANK_ + ex val__blinky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0blinky(val__blinky) and - val__0nowhere(val__nowhere) and val__0south(val__south) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__south, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_west0: [location__BLANK__x11_y11, location__BLANK__x12_y12, location__BLANK__x1_y1, synch_control_ | @@ -760,11 +746,9 @@ pacman__SYNC pre (not terminal() and - ex val__blinky, val__nowhere, val__west, control__BLANK_ + ex val__blinky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0blinky(val__blinky) and - val__0nowhere(val__nowhere) and val__0west(val__west) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__west, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_nowhere0: [location__BLANK__x11_y11, location__BLANK__x12_y12, synch_control_ | _nondistinct_ (location__BLANK__x11_y11, location__BLANK__x12_y12); @@ -867,11 +851,9 @@ pacman__SYNC pre (not terminal() and - ex val__inky, val__nowhere, val__east, control__BLANK_ - (control__BLANK_(control__BLANK_) and val__0east(val__east) and - val__0inky(val__inky) and val__0nowhere(val__nowhere) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__east, val__nowhere))) + ex val__inky, control__BLANK_ + (control__BLANK_(control__BLANK_) and val__0inky(val__inky) and + control_0ghosts(control__BLANK_))) RULE move_north1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -934,11 +916,9 @@ pacman__SYNC pre (not terminal() and - ex val__inky, val__nowhere, val__north, control__BLANK_ + ex val__inky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0inky(val__inky) and - val__0north(val__north) and val__0nowhere(val__nowhere) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__north, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_south1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -1001,11 +981,9 @@ pacman__SYNC pre (not terminal() and - ex val__inky, val__nowhere, val__south, control__BLANK_ + ex val__inky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0inky(val__inky) and - val__0nowhere(val__nowhere) and val__0south(val__south) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__south, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_west1: [location__BLANK__x13_y13, location__BLANK__x14_y14, location__BLANK__x2_y2, synch_control_ | @@ -1068,11 +1046,9 @@ pacman__SYNC pre (not terminal() and - ex val__inky, val__nowhere, val__west, control__BLANK_ + ex val__inky, control__BLANK_ (control__BLANK_(control__BLANK_) and val__0inky(val__inky) and - val__0nowhere(val__nowhere) and val__0west(val__west) and - control_0ghosts(control__BLANK_) and - not EQ___val__0__val__0(val__west, val__nowhere))) + control_0ghosts(control__BLANK_))) RULE move_nowhere1: [location__BLANK__x13_y13, location__BLANK__x14_y14, synch_control_ | _nondistinct_ (location__BLANK__x13_y13, location__BLANK__x14_y14); @@ -2284,44 +2260,6 @@ (location__BLANK__8_8, location__BLANK__7_8); (location__BLANK__8_8, location__BLANK__8_8) }; - EQ___val__0__val__0 { - (val__0, val__0); (val__10, val__10); (val__100, val__100); - (val__11, val__11); (val__12, val__12); (val__13, val__13); - (val__14, val__14); (val__15, val__15); (val__16, val__16); - (val__17, val__17); (val__18, val__18); (val__19, val__19); - (val__20, val__20); (val__21, val__21); (val__22, val__22); - (val__23, val__23); (val__24, val__24); (val__25, val__25); - (val__26, val__26); (val__27, val__27); (val__28, val__28); - (val__29, val__29); (val__30, val__30); (val__31, val__31); - (val__32, val__32); (val__33, val__33); (val__34, val__34); - (val__35, val__35); (val__36, val__36); (val__37, val__37); - (val__38, val__38); (val__39, val__39); (val__40, val__40); - (val__41, val__41); (val__42, val__42); (val__43, val__43); - (val__44, val__44); (val__45, val__45); (val__46, val__46); - (val__47, val__47); (val__48, val__48); (val__49, val__49); - (val__50, val__50); (val__51, val__51); (val__52, val__52); - (val__53, val__53); (val__54, val__54); (val__55, val__55); - (val__56, val__56); (val__57, val__57); (val__58, val__58); - (val__59, val__59); (val__60, val__60); (val__61, val__61); - (val__62, val__62); (val__63, val__63); (val__64, val__64); - (val__65, val__65); (val__66, val__66); (val__67, val__67); - (val__68, val__68); (val__69, val__69); (val__70, val__70); - (val__71, val__71); (val__72, val__72); (val__73, val__73); - (val__74, val__74); (val__75, val__75); (val__76, val__76); - (val__77, val__77); (val__78, val__78); (val__79, val__79); - (val__80, val__80); (val__81, val__81); (val__82, val__82); - (val__83, val__83); (val__84, val__84); (val__85, val__85); - (val__86, val__86); (val__87, val__87); (val__88, val__88); - (val__89, val__89); (val__9, val__9); (val__90, val__90); - (val__91, val__91); (val__92, val__92); (val__93, val__93); - (val__94, val__94); (val__95, val__95); (val__96, val__96); - (val__97, val__97); (val__98, val__98); (val__99, val__99); - (val__blinky, val__blinky); (val__east, val__east); - (val__ghosts, val__ghosts); (val__inky, val__inky); - (val__north, val__north); (val__nowhere, val__nowhere); - (val__pacman, val__pacman); (val__pellet, val__pellet); - (val__south, val__south); (val__west, val__west) - }; R { (location__BLANK__1_1, location__BLANK__2_1); (location__BLANK__1_2, location__BLANK__2_2); Added: trunk/Toss/GGP/tests/tictactoe-other-raw.toss =================================================================== --- trunk/Toss/GGP/tests/tictactoe-other-raw.toss (rev 0) +++ trunk/Toss/GGP/tests/tictactoe-other-raw.toss 2011-10-21 14:16:20 UTC (rev 1609) @@ -0,0 +1,360 @@ +REL DISTINCTCELL(v0, v1) = + ex cELL_X7_Y7__BLANK_, cELL_M1_N1__BLANK_ + (v0 = cELL_X7_Y7__BLANK_ and v1 = cELL_M1_N1__BLANK_ and + not EQ___CELL_0__CELL_0(cELL_X7_Y7__BLANK_, cELL_M1_N1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_M1_N1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X7_Y7__BLANK_)) or + ex cELL_X8_Y8__BLANK_, cELL_M2_N2__BLANK_ + (v0 = cELL_X8_Y8__BLANK_ and v1 = cELL_M2_N2__BLANK_ and + not EQ___CELL_1__CELL_1(cELL_X8_Y8__BLANK_, cELL_M2_N2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_M2_N2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X8_Y8__BLANK_)) +REL COLUMN__oPLAYER(v0) = + ex cELL_1_Y4__BLANK_ + (v0 = cELL_1_Y4__BLANK_ and + ex cELL_2_Y4__BLANK_, cELL_3_Y4__BLANK_ + (EQ___CELL_1__CELL_1(cELL_1_Y4__BLANK_, cELL_2_Y4__BLANK_) and + EQ___CELL_1__CELL_1(cELL_1_Y4__BLANK_, cELL_3_Y4__BLANK_) and + EQ___CELL_1__CELL_1(cELL_2_Y4__BLANK_, cELL_1_Y4__BLANK_) and + EQ___CELL_1__CELL_1(cELL_2_Y4__BLANK_, cELL_3_Y4__BLANK_) and + EQ___CELL_1__CELL_1(cELL_3_Y4__BLANK_, cELL_1_Y4__BLANK_) and + EQ___CELL_1__CELL_1(cELL_3_Y4__BLANK_, cELL_2_Y4__BLANK_) and + CELL_01(cELL_1_Y4__BLANK_) and CELL_2oPLAYER(cELL_1_Y4__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_Y4__BLANK_) and + CELL_02(cELL_2_Y4__BLANK_) and CELL_2oPLAYER(cELL_2_Y4__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_Y4__BLANK_) and + CELL_03(cELL_3_Y4__BLANK_) and CELL_2oPLAYER(cELL_3_Y4__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_Y4__BLANK_))) +REL COLUMN__xPLAYER(v0) = + ex cELL_1_Y3__BLANK_ + (v0 = cELL_1_Y3__BLANK_ and + ex cELL_2_Y3__BLANK_, cELL_3_Y3__BLANK_ + (EQ___CELL_1__CELL_1(cELL_1_Y3__BLANK_, cELL_2_Y3__BLANK_) and + EQ___CELL_1__CELL_1(cELL_1_Y3__BLANK_, cELL_3_Y3__BLANK_) and + EQ___CELL_1__CELL_1(cELL_2_Y3__BLANK_, cELL_1_Y3__BLANK_) and + EQ___CELL_1__CELL_1(cELL_2_Y3__BLANK_, cELL_3_Y3__BLANK_) and + EQ___CELL_1__CELL_1(cELL_3_Y3__BLANK_, cELL_1_Y3__BLANK_) and + EQ___CELL_1__CELL_1(cELL_3_Y3__BLANK_, cELL_2_Y3__BLANK_) and + CELL_01(cELL_1_Y3__BLANK_) and CELL_2xPLAYER(cELL_1_Y3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_Y3__BLANK_) and + CELL_02(cELL_2_Y3__BLANK_) and CELL_2xPLAYER(cELL_2_Y3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_Y3__BLANK_) and + CELL_03(cELL_3_Y3__BLANK_) and CELL_2xPLAYER(cELL_3_Y3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_Y3__BLANK_))) +REL DIAGONAL__oPLAYER() = + ex cELL_1_1__BLANK_, cELL_2_2__BLANK_, cELL_3_3__BLANK_ + (true and + CELL_01(cELL_1_1__BLANK_) and CELL_11(cELL_1_1__BLANK_) and + CELL_2oPLAYER(cELL_1_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_1__BLANK_) and + CELL_02(cELL_2_2__BLANK_) and CELL_12(cELL_2_2__BLANK_) and + CELL_2oPLAYER(cELL_2_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_2__BLANK_) and + CELL_03(cELL_3_3__BLANK_) and CELL_13(cELL_3_3__BLANK_) and + CELL_2oPLAYER(cELL_3_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_3__BLANK_)) or + ex cELL_1_3__BLANK_, cELL_2_2__BLANK_, cELL_3_1__BLANK_ + (true and + CELL_01(cELL_1_3__BLANK_) and CELL_13(cELL_1_3__BLANK_) and + CELL_2oPLAYER(cELL_1_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_3__BLANK_) and + CELL_02(cELL_2_2__BLANK_) and CELL_12(cELL_2_2__BLANK_) and + CELL_2oPLAYER(cELL_2_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_2__BLANK_) and + CELL_03(cELL_3_1__BLANK_) and CELL_11(cELL_3_1__BLANK_) and + CELL_2oPLAYER(cELL_3_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_1__BLANK_)) +REL DIAGONAL__xPLAYER() = + ex cELL_1_1__BLANK_, cELL_2_2__BLANK_, cELL_3_3__BLANK_ + (true and + CELL_01(cELL_1_1__BLANK_) and CELL_11(cELL_1_1__BLANK_) and + CELL_2xPLAYER(cELL_1_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_1__BLANK_) and + CELL_02(cELL_2_2__BLANK_) and CELL_12(cELL_2_2__BLANK_) and + CELL_2xPLAYER(cELL_2_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_2__BLANK_) and + CELL_03(cELL_3_3__BLANK_) and CELL_13(cELL_3_3__BLANK_) and + CELL_2xPLAYER(cELL_3_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_3__BLANK_)) or + ex cELL_1_3__BLANK_, cELL_2_2__BLANK_, cELL_3_1__BLANK_ + (true and + CELL_01(cELL_1_3__BLANK_) and CELL_13(cELL_1_3__BLANK_) and + CELL_2xPLAYER(cELL_1_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_1_3__BLANK_) and + CELL_02(cELL_2_2__BLANK_) and CELL_12(cELL_2_2__BLANK_) and + CELL_2xPLAYER(cELL_2_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_2_2__BLANK_) and + CELL_03(cELL_3_1__BLANK_) and CELL_11(cELL_3_1__BLANK_) and + CELL_2xPLAYER(cELL_3_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_3_1__BLANK_)) +REL LINE__oPLAYER() = + ex cELL_X5__BLANK___BLANK_ + (ROW__oPLAYER(cELL_X5__BLANK___BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X5__BLANK___BLANK_)) or + ex cELL__BLANK__Y5__BLANK_ + (COLUMN__oPLAYER(cELL__BLANK__Y5__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL__BLANK__Y5__BLANK_)) or + (DIAGONAL__oPLAYER() and true) +REL LINE__xPLAYER() = + ex cELL_X5__BLANK___BLANK_ + (ROW__xPLAYER(cELL_X5__BLANK___BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X5__BLANK___BLANK_)) or + ex cELL__BLANK__Y5__BLANK_ + (COLUMN__xPLAYER(cELL__BLANK__Y5__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL__BLANK__Y5__BLANK_)) or + (DIAGONAL__xPLAYER() and true) +REL OPEN() = + ex cELL_X6_Y6__BLANK_ + (true and + CELL_2b(cELL_X6_Y6__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X6_Y6__BLANK_)) +REL ROW__oPLAYER(v0) = + ex cELL_X4_1__BLANK_ + (v0 = cELL_X4_1__BLANK_ and + ex cELL_X4_2__BLANK_, cELL_X4_3__BLANK_ + (EQ___CELL_0__CELL_0(cELL_X4_1__BLANK_, cELL_X4_2__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X4_1__BLANK_, cELL_X4_3__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X4_2__BLANK_, cELL_X4_1__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X4_2__BLANK_, cELL_X4_3__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X4_3__BLANK_, cELL_X4_1__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X4_3__BLANK_, cELL_X4_2__BLANK_) and + CELL_11(cELL_X4_1__BLANK_) and CELL_2oPLAYER(cELL_X4_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X4_1__BLANK_) and + CELL_12(cELL_X4_2__BLANK_) and CELL_2oPLAYER(cELL_X4_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X4_2__BLANK_) and + CELL_13(cELL_X4_3__BLANK_) and CELL_2oPLAYER(cELL_X4_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X4_3__BLANK_))) +REL ROW__xPLAYER(v0) = + ex cELL_X3_1__BLANK_ + (v0 = cELL_X3_1__BLANK_ and + ex cELL_X3_2__BLANK_, cELL_X3_3__BLANK_ + (EQ___CELL_0__CELL_0(cELL_X3_1__BLANK_, cELL_X3_2__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X3_1__BLANK_, cELL_X3_3__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X3_2__BLANK_, cELL_X3_1__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X3_2__BLANK_, cELL_X3_3__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X3_3__BLANK_, cELL_X3_1__BLANK_) and + EQ___CELL_0__CELL_0(cELL_X3_3__BLANK_, cELL_X3_2__BLANK_) and + CELL_11(cELL_X3_1__BLANK_) and CELL_2xPLAYER(cELL_X3_1__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X3_1__BLANK_) and + CELL_12(cELL_X3_2__BLANK_) and CELL_2xPLAYER(cELL_X3_2__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X3_2__BLANK_) and + CELL_13(cELL_X3_3__BLANK_) and CELL_2xPLAYER(cELL_X3_3__BLANK_) and + cELL__BLANK___BLANK___BLANK_(cELL_X3_3__BLANK_))) +REL terminal() = + (LINE__oPLAYER() and true) or (LINE__xPLAYER() and true) or + (not OPEN() and true) +PLAYERS xPLAYER, oPLAYER +RULE mARK_X9_Y9_nOOP: + [cELL_X9_Y9__BLANK_, cONTROL__BLANK_ | + CELL_2b (cELL_X9_Y9__BLANK_); CONTROL_0xPLAYER (cONTROL__BLANK_); + _opt_CELL_2b (cONTROL__BLANK_); + _opt_CELL_2oPLAYER {cELL_X9_Y9__BLANK_; cONTROL__BLANK_}; + _opt_CELL_2xPLAYER {cELL_X9_Y9__BLANK_; cONTROL__BLANK_}; + _opt_CONTROL_0oPLAYER (cELL_X9_Y9__BLANK_); + _opt_CONTROL_0xPLAYER (cELL_X9_Y9__BLANK_); + cELL__BLANK___BLANK___BLANK_ (cELL_X9_Y9__BLANK_); + cONTROL__BLANK_ (cONTROL__BLANK_) + | + ] -> + [cELL_X9_Y9__BLANK_, cONTROL__BLANK_ | + CELL_2xPLAYER (cELL_X9_Y9__BLANK_); CONTROL_0oPLAYER (cONTROL__BLANK_) | + ] + emb CELL_2b, CELL_2oPLAYER, CELL_2xPLAYER, CONTROL_0oPLAYER, + CONTROL_0xPLAYER + pre not terminal() +RULE nOOP_mARK_X10_Y10: + [cELL_X10_Y10__BLANK_, cONTROL__BLANK_ | + CELL_2b (cELL_X10_Y10__BLANK_); CONTROL_0oPLAYER (cONTROL__BLANK_); + _opt_CELL_2b (cONTROL__BLANK_); + _opt_CELL_2oPLAYER {cELL_X10_Y10__BLANK_; cONTROL__BLANK_}; + _opt_CELL_2xPLAYER {cELL_X10_Y10__BLANK_; cONTROL__BLANK_}; + _opt_CONTROL_0oPLAYER (cELL_X10_Y10__BLANK_); + _opt_CONTROL_0xPLAYER (cELL_X10_Y10__BLANK_); + cELL__BLANK___BLANK___BLANK_ (cELL_X10_Y10__BLANK_); + cONTROL__BLANK_ (cONTROL__BLANK_) + | + ] -> + [cELL_X10_Y10__BLANK_, cONTROL__BLANK_ | + CELL_2oPLAYER (cELL_X10_Y10__BLANK_); CONTROL_0xPLAYER (cONTROL__BLANK_) + | + ] + emb CELL_2b, CELL_2oPLAYER, CELL_2xPLAYER, CONTROL_0oPLAYER, + CONTROL_0xPLAYER + pre not terminal() +LOC 0 { + + PLAYER xPLAYER { + PAYOFF + 100. * :((LINE__xPLAYER() and true)) + + 50. * + :((not LINE__xPLAYER() and not LINE__oPLAYER() and not OPEN() and true)) + MOVES [mARK_X9_Y9_nOOP -> 1] } + PLAYER oPLAYER { + PAYOFF + 100. * :((LINE__oPLAYER() and true)) + + 50. * + :((not LINE__xPLAYER() and not LINE__oPLAYER() and not OPEN() and true)) + } +} +LOC 1 { + + PLAYER xPLAYER { + PAYOFF + 100. * :((LINE__xPLAYER() and true)) + + 50. * + :((not LINE__xPLAYER() and not LINE__oPLAYER() and not OPEN() and true)) + } + PLAYER oPLAYER { + PAYOFF + 100. * :((LINE__oPLAYER() and true)) + + 50. * + :((not LINE__xPLAYER() and not LINE__oPLAYER() and not OPEN() and true)) + MOVES [nOOP_mARK_X10_Y10 -> 0] } +} +MODEL + [cELL_1_1__BLANK_, cELL_1_2__BLANK_, cELL_1_3__BLANK_, cELL_2_1__BLANK_, + cELL_2_2__BLANK_, cELL_2_3__BLANK_, cELL_3_1__BLANK_, cELL_3_2__BLANK_, + cELL_3_3__BLANK_, val__B, val__OPLAYER, val__XPLAYER, cONTROL__BLANK_ | + CELL_01 {cELL_1_1__BLANK_; cELL_1_2__BLANK_; cELL_1_3__BLANK_}; + CELL_02 {cELL_2_1__BLANK_; cELL_2_2__BLANK_; cELL_2_3__BLANK_}; + CELL_03 {cELL_3_1__BLANK_; cELL_3_2__BLANK_; cELL_3_3__BLANK_}; + CELL_11 {cELL_1_1__BLANK_; cELL_2_1__BLANK_; cELL_3_1__BLANK_}; + CELL_12 {cELL_1_2__BLANK_; cELL_2_2__BLANK_; cELL_3_2__BLANK_}; + CELL_13 {cELL_1_3__BLANK_; cELL_2_3__BLANK_; cELL_3_3__BLANK_}; + CELL_2b { + ... [truncated message content] |
From: <luk...@us...> - 2011-10-25 08:24:36
|
Revision: 1616 http://toss.svn.sourceforge.net/toss/?rev=1616&view=rev Author: lukstafi Date: 2011-10-25 08:24:28 +0000 (Tue, 25 Oct 2011) Log Message: ----------- GDL translation: extend the redundancy pruning from legal clauses vs next clauses, to regular next clauses vs counter clauses. Modified Paths: -------------- trunk/Toss/GGP/TranslateFormula.ml trunk/Toss/GGP/TranslateFormula.mli trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml trunk/Toss/GGP/tests/pacman3p-raw.toss trunk/Toss/GGP/tests/pacman3p-simpl.toss Modified: trunk/Toss/GGP/TranslateFormula.ml =================================================================== --- trunk/Toss/GGP/TranslateFormula.ml 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/TranslateFormula.ml 2011-10-25 08:24:28 UTC (rev 1616) @@ -306,8 +306,11 @@ (* [translate_disjunct] is $\mathrm{Tr}(\Phi_i,E)$, [rels_phi] is $G_i$, [pos_state_phi] is $ST^{+}_i$, [neg_state_phi] is - $ST^{-}_i$, [ext_phi] is $E$. *) -let transl_disjunct data rels_phi pos_state_phi neg_state_phi ext_phi = + $ST^{-}_i$, [ext_phi] is $E$. [ctx_terms] is additional state + terms for translating a formula with a broader context (e.g. the + update condition in the context of rewrite rule application). *) +let transl_disjunct data ctx_terms rels_phi + pos_state_phi neg_state_phi ext_phi = let is_c = function | Func (f, _) when List.mem f data.counters -> true | _ -> false in @@ -327,7 +330,7 @@ List.exists (fun v->List.mem v (neg_vars :> Formula.var list)) (FormulaSubst.free_vars conj)) ext_phi in - let all_terms = pos_terms @ neg_terms in + let all_terms = ctx_terms @ pos_terms @ neg_terms in let phi_vars = clause_vars (("", [| |]), rels_phi @ pos_state_phi @ neg_state_phi) in @@ -365,7 +368,8 @@ let base_part = Formula.And ( pos_ext @ - [ transl_rels data cv_map counter_vars rels_eqs pos_terms pos_vars; + [ transl_rels data cv_map counter_vars rels_eqs + (ctx_terms @ pos_terms) pos_vars; transl_state data pos_state_phi] @ universal_part) in if pos_vars = [] then base_part @@ -377,11 +381,11 @@ FormulaMap.fold_Fun = (fun _ v -> v = counter_v)} t (* Translate a disjunction of conjunctions of literals (and disjs of lits). *) -let translate ?(counter_guard=true) data disj = +let translate ?(counter_guard=true) ?(ctx_terms=[]) data disj = let disj = separate_disj data.counters disj in let res = Formula.Or (List.map (fun (rels_phi, pos_state, neg_state) -> - transl_disjunct data rels_phi pos_state neg_state [] + transl_disjunct data ctx_terms rels_phi pos_state neg_state [] ) disj) in if counter_guard && has_counter res then Formula.Ex Modified: trunk/Toss/GGP/TranslateFormula.mli =================================================================== --- trunk/Toss/GGP/TranslateFormula.mli 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/TranslateFormula.mli 2011-10-25 08:24:28 UTC (rev 1616) @@ -26,9 +26,14 @@ (** Translate a disjunction of conjunctions of literals (and disjs of lits). [counter_guard] is set to false, do not introduce - "gdl__counter(gdl__counter)" atom. *) + "gdl__counter(gdl__counter)" atom. + + [ctx_terms] is additional state terms for translating a formula + with a broader context (e.g. the update condition in the context + of rewrite rule application). *) val translate : - ?counter_guard:bool -> transl_data -> GDL.literal list list -> + ?counter_guard:bool -> ?ctx_terms:GDL.term list -> + transl_data -> GDL.literal list list -> Formula.formula val build_defrels : Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/TranslateGame.ml 2011-10-25 08:24:28 UTC (rev 1616) @@ -1440,6 +1440,91 @@ Aux.collect counter_cls, rule_cls +(* Partition literals into connected components where edges are + shared variables. *) +let partition_lits lits = + let parts = List.fold_left + (fun parts lit -> + let l_vars = literals_vars [lit] in + let more_parts, cur_parts = List.partition + (fun (_, p_vars) -> + Aux.Strings.is_empty (Aux.Strings.inter l_vars p_vars)) + parts in + let cur_part = List.fold_left + (fun (c_lits, c_vars) (p_lits, p_vars) -> + c_lits @ p_lits, Aux.Strings.union c_vars p_vars) + ([lit], l_vars) cur_parts in + cur_part::more_parts) + [] lits in + List.map fst parts + +let encode_lit = function + | Pos a -> + let rel, args = rel_of_atom a in + "Pos "^rel, args + | Neg a -> + let rel, args = rel_of_atom a in + "Neg "^rel, args + | Disj _ -> raise Not_found + + +let filter_poss_redundant legal_lits body = + let legal_lits_enc = Aux.map_try encode_lit legal_lits in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "filter_poss_redundant:\nlegal_lits=%s\nbody=%s\n\n%!" + (rel_atoms_str legal_lits_enc) (literals_str body) + ); + (* }}} *) + List.fold_right + (fun lit (sb, keep) -> + try + let lit_enc = encode_lit lit in + let sb = + Aux.find_try (unify_rels ~sb lit_enc) legal_lits_enc in + sb, keep + with Not_found -> sb, lit::keep) + body ([], []) + +(* We remove literals in [body] that are considered subsumed by + [legal_lits]. We find the most coarse partition of [body] such that + different classes do not share variables. A group of [body] + literals is considered subsumed if its every literal unifies with a + [legal_lits] literal under a common substitution. The current + algorithm is greedy in that we only consider the first matching + legal literal for a given [body] literal. We also ignore + disjunctions. + + If [filter_possibly_redundant] is true, rather than processing + [body] literals in bulk, check each literal separately, removing + those that unify with some "legal" clause literal, even though they + may be intended for different elements as witnessed by remaining + "next" clause literals. *) +let filter_redundant legal_lits body = + if !filter_possibly_redundant + then filter_poss_redundant legal_lits body + else + let parts = partition_lits body in + let legal_lits_enc = Aux.map_try encode_lit legal_lits in + (* {{{ log entry *) + if !debug_level > 3 then ( + Printf.printf "filter_redundant:\nlegal_lits=%s\nbody=%s\n\n%!" + (rel_atoms_str legal_lits_enc) (literals_str body) + ); + (* }}} *) + let sbs, keep_parts = Aux.partition_map + (fun part -> + try + let sb = List.fold_left + (fun sb lit -> + let lit_enc = encode_lit lit in + Aux.find_try (unify_rels ~sb lit_enc) legal_lits_enc) + [] part in + Aux.Left sb + with Not_found -> Aux.Right part) + parts in + List.concat sbs, List.concat keep_parts + let remove_local_vars gvars lits = List.filter (fun l -> Aux.Strings.subset (literals_vars [l]) gvars) lits @@ -1490,6 +1575,16 @@ (fun (h, required, body) -> if required then Some (h, body) else None) rule_cls in let required_body = Aux.concat_map snd required_cls in + let counter_cls = List.map + (fun (f, brs) -> + let brs = List.map + (fun (cond, update) -> + let sb, cond = filter_redundant required_body cond in + subst_literals sb cond, update) + brs in + f, brs) + counter_cls in + let unrequired_cls = Aux.map_some (fun (h, required, body) -> if not required then Some (h, body) else None) rule_cls in @@ -1681,91 +1776,6 @@ List.map (add_erasure_clauses f_paths) move_tups -(* Partition literals into connected components where edges are - shared variables. *) -let partition_lits lits = - let parts = List.fold_left - (fun parts lit -> - let l_vars = literals_vars [lit] in - let more_parts, cur_parts = List.partition - (fun (_, p_vars) -> - Aux.Strings.is_empty (Aux.Strings.inter l_vars p_vars)) - parts in - let cur_part = List.fold_left - (fun (c_lits, c_vars) (p_lits, p_vars) -> - c_lits @ p_lits, Aux.Strings.union c_vars p_vars) - ([lit], l_vars) cur_parts in - cur_part::more_parts) - [] lits in - List.map fst parts - -let encode_lit = function - | Pos a -> - let rel, args = rel_of_atom a in - "Pos "^rel, args - | Neg a -> - let rel, args = rel_of_atom a in - "Neg "^rel, args - | Disj _ -> raise Not_found - - -let filter_poss_redundant legal_lits body = - let legal_lits_enc = Aux.map_try encode_lit legal_lits in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "filter_poss_redundant:\nlegal_lits=%s\nbody=%s\n\n%!" - (rel_atoms_str legal_lits_enc) (literals_str body) - ); - (* }}} *) - List.fold_right - (fun lit (sb, keep) -> - try - let lit_enc = encode_lit lit in - let sb = - Aux.find_try (unify_rels ~sb lit_enc) legal_lits_enc in - sb, keep - with Not_found -> sb, lit::keep) - body ([], []) - -(* We remove literals in [body] that are considered subsumed by - [legal_lits]. We find the most coarse partition of [body] such that - different classes do not share variables. A group of [body] - literals is considered subsumed if its every literal unifies with a - [legal_lits] literal under a common substitution. The current - algorithm is greedy in that we only consider the first matching - legal literal for a given [body] literal. We also ignore - disjunctions. - - If [filter_possibly_redundant] is true, rather than processing - [body] literals in bulk, check each literal separately, removing - those that unify with some "legal" clause literal, even though they - may be intended for different elements as witnessed by remaining - "next" clause literals. *) -let filter_redundant legal_lits body = - if !filter_possibly_redundant - then filter_poss_redundant legal_lits body - else - let parts = partition_lits body in - let legal_lits_enc = Aux.map_try encode_lit legal_lits in - (* {{{ log entry *) - if !debug_level > 3 then ( - Printf.printf "filter_redundant:\nlegal_lits=%s\nbody=%s\n\n%!" - (rel_atoms_str legal_lits_enc) (literals_str body) - ); - (* }}} *) - let sbs, keep_parts = Aux.partition_map - (fun part -> - try - let sb = List.fold_left - (fun sb lit -> - let lit_enc = encode_lit lit in - Aux.find_try (unify_rels ~sb lit_enc) legal_lits_enc) - [] part in - Aux.Left sb - with Not_found -> Aux.Right part) - parts in - List.concat sbs, List.concat keep_parts - (* Filter the "next" clauses removing conditions common with legal clauses, pass the result to [rule_cases]. *) let add_legal_cond counters num_functors static_rels testground @@ -2161,13 +2171,14 @@ List.fold_left comp_f xvar path | _ -> assert false -let transl_cond_updates transl_data rule_elems num_functions cond_updates = +let transl_cond_updates transl_data ctx_terms rule_elems + num_functions cond_updates = let cond_update (cond, update) = let update = transl_update_path num_functions update in let cond = FormulaOps.del_vars_quant (List.map Formula.fo_var_of_string rule_elems :> Formula.var list) (TranslateFormula.translate - ~counter_guard:false transl_data [cond]) in + ~counter_guard:false ~ctx_terms transl_data [cond]) in Formula.Times (Formula.Char cond, update) in match cond_updates with | [] -> assert false @@ -2281,6 +2292,13 @@ let discrete = DiscreteRule.translate_from_precond ~precond ~add:rhs_add ~nondistinct ~emb_rels:fluents ~signat ~struc_elems in + let ctx_terms = state_terms case_cond in + (* {{{ log entry *) + if !debug_level > 3 && counter_cls <> [] then ( + Printf.printf "build_toss_rule: ctx_terms=%s\n%!" + (String.concat " "(List.map term_str ctx_terms)) + ); + (* }}} *) let updates = List.map (fun (f, cond_updates) -> (f, counter_n), (* a trick to force instantiating the counter variable -- note @@ -2288,7 +2306,8 @@ precondition *) (*Formula.Sum ([`FO counter_n], Formula.Rel (counter_n, [|`FO counter_n|]),) *) - transl_cond_updates transl_data struc_elems num_functions cond_updates) + transl_cond_updates transl_data ctx_terms struc_elems + num_functions cond_updates) counter_cls in let rule = ContinuousRule.make_rule signat [] discrete @@ -2521,7 +2540,7 @@ match counter_goal_cls with | [] -> Formula.Const 0. | cond_upds -> - transl_cond_updates transl_data [] num_functions cond_upds in + transl_cond_updates transl_data [] [] num_functions cond_upds in if num_payoff = Formula.Const 0. then counter_payoff else if counter_payoff = Formula.Const 0. Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-10-25 08:24:28 UTC (rev 1616) @@ -369,18 +369,24 @@ let a () = - game_test_case ~game_name:"connect4" ~player:"white" - ~own_plnum:0 ~opponent_plnum:1 - ~loc0_rule_name:"drop_c11_noop" - ~loc0_emb:[ - "cell_c11_y18__BLANK_", "cell_2_1__BLANK_"; - "control__BLANK_", "control__BLANK_"] - ~loc0_move:"(drop 2)" ~loc0_noop:"noop" - ~loc1:1 ~loc1_rule_name:"noop_drop_c12" - ~loc1_emb:[ - "cell_c12_y20__BLANK_", "cell_2_2__BLANK_"; - "control__BLANK_", "control__BLANK_"] - ~loc1_noop:"noop" ~loc1_move:"(drop 2)"; + set_debug_level 4; + simult_test_case ~game_name:"pacman3p" ~player:"pacman" + ~plnum:1 (* 0 is environment! *) + ~moves:[|"(move east)"; "(move nowhere)"; "(move nowhere)"|] + ~rules_and_embs:[| + "move_east", [ + "gdl__counter", "gdl__counter"; + "location__BLANK__x10_y10", "location__BLANK__6_3"; + "location__BLANK__x_y", "location__BLANK__5_3"; + "synch_control_", "synch_control_"]; + "move_nowhere0", [ + "location__BLANK__x11_y11", "location__BLANK__4_6"; + "location__BLANK__x12_y12", "location__BLANK__4_6"; + "synch_control_", "synch_control_"]; + "move_nowhere1", [ + "location__BLANK__x13_y13", "location__BLANK__5_6"; + "location__BLANK__x14_y14", "location__BLANK__5_6"; + "synch_control_", "synch_control_"]|]; (* failwith "tested"; *) () Modified: trunk/Toss/GGP/tests/pacman3p-raw.toss =================================================================== --- trunk/Toss/GGP/tests/pacman3p-raw.toss 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/tests/pacman3p-raw.toss 2011-10-25 08:24:28 UTC (rev 1616) @@ -244,21 +244,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__east(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__east(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__east(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -322,21 +317,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__north(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__north(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__north(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -400,21 +390,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__south(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__south(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__south(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -478,21 +463,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__west(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__west(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__west(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -555,23 +535,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6, location__BLANK__x5_y5 - (nextcell__nowhere(location__BLANK__x5_y5, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location_0pacman(location__BLANK__x5_y5) and - location__BLANK___BLANK___BLANK_(location__BLANK__x5_y5) and - not - (nextcell__nowhere(location__BLANK__x5_y5, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x3_y3, location__BLANK__x4_y4 - (nextcell__nowhere(location__BLANK__x3_y3, location__BLANK__x4_y4) and - location_0pacman(location__BLANK__x3_y3) and - location__BLANK___BLANK___BLANK_(location__BLANK__x3_y3) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and Modified: trunk/Toss/GGP/tests/pacman3p-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/pacman3p-simpl.toss 2011-10-24 21:38:29 UTC (rev 1615) +++ trunk/Toss/GGP/tests/pacman3p-simpl.toss 2011-10-25 08:24:28 UTC (rev 1616) @@ -119,21 +119,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__east(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__east(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__east(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -196,21 +191,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__north(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__north(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__north(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -273,21 +263,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__south(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__south(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__south(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -350,21 +335,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6 - (nextcell__west(location__BLANK__x_y, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - not - (nextcell__west(location__BLANK__x_y, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x4_y4 - (nextcell__west(location__BLANK__x_y, location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x_y) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and @@ -426,23 +406,16 @@ update :collected(gdl__counter) = :( - ex location__BLANK__x6_y6, location__BLANK__x5_y5 - (nextcell__nowhere(location__BLANK__x5_y5, location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6) and - location_0pacman(location__BLANK__x5_y5) and - location__BLANK___BLANK___BLANK_(location__BLANK__x5_y5) and - not - (nextcell__nowhere(location__BLANK__x5_y5, location__BLANK__x6_y6) and - location_0pellet(location__BLANK__x6_y6) and - location__BLANK___BLANK___BLANK_(location__BLANK__x6_y6))) + (true and true and + not + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10))) ) * :collected(gdl__counter) + :( - ex location__BLANK__x3_y3, location__BLANK__x4_y4 - (nextcell__nowhere(location__BLANK__x3_y3, location__BLANK__x4_y4) and - location_0pacman(location__BLANK__x3_y3) and - location__BLANK___BLANK___BLANK_(location__BLANK__x3_y3) and - location_0pellet(location__BLANK__x4_y4) and - location__BLANK___BLANK___BLANK_(location__BLANK__x4_y4)) + (true and + location_0pellet(location__BLANK__x10_y10) and + location__BLANK___BLANK___BLANK_(location__BLANK__x10_y10)) ) * (1. * (:collected(gdl__counter) - 98.) + 99.) pre (not terminal() and ex val__pacman val__0pacman(val__pacman) and This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <luk...@us...> - 2011-11-05 17:01:32
|
Revision: 1621 http://toss.svn.sourceforge.net/toss/?rev=1621&view=rev Author: lukstafi Date: 2011-11-05 17:01:26 +0000 (Sat, 05 Nov 2011) Log Message: ----------- GDL translation: finding unframed fluents after selecting clauses with matching legal/does terms (finding them globally was a bug). Modified Paths: -------------- trunk/Toss/GGP/TranslateGame.ml trunk/Toss/GGP/TranslateGameTest.ml trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss trunk/Toss/GGP/tests/asteroids-scrambled-simpl.toss trunk/Toss/GGP/tests/breakthrough-simpl.toss Modified: trunk/Toss/GGP/TranslateGame.ml =================================================================== --- trunk/Toss/GGP/TranslateGame.ml 2011-11-05 14:15:19 UTC (rev 1620) +++ trunk/Toss/GGP/TranslateGame.ml 2011-11-05 17:01:26 UTC (rev 1621) @@ -402,17 +402,11 @@ let arities = Aux.unique_sorted unused_roots @ arities in let unused_roots = Aux.strings_of_list (List.map fst unused_roots) in let static_rels = Aux.Strings.elements unused_roots @ static_rels in - (* later, we will need to somehow erase unframed fluents... *) - let framed_fluents = Aux.concat_map - (fun (head, _) -> map_paths (fun p subt -> p, subt) f_paths head) - frame_clauses in (* {{{ log entry *) if !debug_level > 2 then ( - Printf.printf "prepare_paths_and_elems:\nused_roots=%s\nunused_roots=%s\nframed_fluents=%s; static_rels=%s\n%!" + Printf.printf "prepare_paths_and_elems:\nused_roots=%s\nunused_roots=%s\nstatic_rels=%s\n%!" (String.concat ", "(Aux.Strings.elements used_roots)) (String.concat ", "(Aux.Strings.elements unused_roots)) - (String.concat ", " (List.map (fun (p, subt) -> - path_str p^"->"^term_str subt) framed_fluents)) (String.concat ", " static_rels) ); (* }}} *) @@ -548,7 +542,6 @@ ); (* }}} *) static_base, init_state, c_paths, f_paths, element_reps, root_reps, - framed_fluents, ground_state_terms, arities, term_arities, static_rels, nonstatic_rels, frame_clauses, move_clauses, clauses, program, playout_states @@ -1333,6 +1326,10 @@ let frame_cls, move_cl_bodies = Aux.partition_map (fun (s, frame, body) -> if frame then Aux.Left (s, body) else Aux.Right body) next_cls in + (* later, we will need to erase unframed fluents... *) + let framed_fluents = Aux.concat_map + (fun (head, _) -> map_paths (fun p subt -> p, subt) f_paths head) + frame_cls in let cl_pos_terms = Aux.concat_map pos_state_terms (legal_cl_bodies @ move_cl_bodies) in (* {{{ log entry *) @@ -1487,7 +1484,7 @@ if not frame then Some (s, Next_cl, body) else None) next_cls in - legal_tup, next_cls @ erasure_cls + legal_tup, framed_fluents, next_cls @ erasure_cls let ignore_rhs = Const "__IGNORE_RHS__" @@ -1975,7 +1972,7 @@ (* Filter the "next" clauses removing conditions common with legal clauses, pass the result to [rule_cases]. *) let add_legal_cond counters num_functors static_rels testground - program playout_states (legal_tup, next_cls) = + program playout_states (legal_tup, framed_fluents, next_cls) = let legal_tup, legal_conds = List.split legal_tup in (* We fix the variables in the legal conditions because we will search for "embeddings" of parts of legal conditions in "next" @@ -1994,6 +1991,7 @@ next_cls in (* Filter-out redundant conditions. Note that unfixed variables in "next" clauses are local to clauses. *) + (* TODO: collect the substitutions and apply them to all clauses *) let next_cls = List.map (fun (head, kind, body) -> let sb, body = filter_redundant legal_lits body in @@ -2021,7 +2019,7 @@ (fun body -> ignore_rhs, Legal_cl, body) legal_conds in List.map (fun (ids, (pos_rhs, neg_rhs, updates, case_cond)) -> - ids, (legal_tup, pos_rhs, neg_rhs, updates, case_cond)) + ids, (legal_tup, framed_fluents, pos_rhs, neg_rhs, updates, case_cond)) (rule_cases counters num_functors static_rels testground program playout_states (legal_cls @ next_cls)) @@ -2200,8 +2198,11 @@ let counters_str (counter, cond_updates) = counter^": "^String.concat ", " (List.map cond_upd_str cond_updates) in - let print_rcand i (_, (_, pos_rhs, neg_rhs, counter_cls, case_cond)) = - Printf.printf "\nRCAND: #%d\nPOS-RHS: %s\nNEG-RHS: %s\nCOUNTER_CLs: %s\nLHS: %s\n%!" i + let print_rcand i (_, (_, framed_fluents, pos_rhs, neg_rhs, counter_cls, case_cond)) = + Printf.printf "\nRCAND: #%d\nFRAMED-FLUENTS: %s\nPOS-RHS: %s\nNEG-RHS: %s\nCOUNTER_CLs: %s\nLHS: %s\n%!" i + (String.concat "; " + (List.map (fun (p,subt)->path_str p^"->"^term_str subt) + framed_fluents)) (String.concat " " (List.map term_str pos_rhs)) (String.concat " " (List.map term_str neg_rhs)) (String.concat "; " (List.map counters_str counter_cls)) @@ -2224,7 +2225,7 @@ playout_states rule_cands = let check_cands cands = let cands = - List.filter (fun (_, (_, _, _, _, case_cond)) -> + List.filter (fun (_, (_, _, _, _, _, case_cond)) -> (* {{{ log entry *) if !debug_level > 1 then ( Printf.printf "check_cands: cond %s%!" @@ -2252,11 +2253,12 @@ (Aux.maximal_unique (fun (s1, _) (s2, _) -> Aux.Ints.subset s1 s2) cands) in - let add_rhs_as_lhs (legal_tup, pos_rhs, neg_rhs, updates, case_cond) = + let add_rhs_as_lhs (legal_tup, framed_fl, + pos_rhs, neg_rhs, updates, case_cond) = let case_blanks = List.map (fun s -> Pos (True (simult_subst f_paths blank s))) (pos_rhs @ neg_rhs) in - legal_tup, pos_rhs, neg_rhs, updates, + legal_tup, framed_fl, pos_rhs, neg_rhs, updates, Aux.unique_sorted (case_blanks @ case_cond) in let process cands = List.map add_rhs_as_lhs (check_cands cands) in match rule_cands with @@ -2417,9 +2419,9 @@ (cond_update c_upd) c_upds let build_toss_rule num_functions transl_data rule_names - framed_fluents f_paths struc fluents + f_paths struc fluents synch_elems synch_precond synch_postcond - (legal_tuple, pos_rhs, neg_rhs, counter_cls, case_cond) = + (legal_tuple, framed_fluents, pos_rhs, neg_rhs, counter_cls, case_cond) = let rname = if legal_tuple = [] then term_to_name env_player else String.concat "_" (List.map term_to_name legal_tuple) in @@ -2499,9 +2501,9 @@ List.map (fun (subt, path) -> pred_on_path_subterm path subt, vartup) s_subterms) in - let add = synch_postcond @ extract_tups pos_rhs in + let add = Aux.unique_sorted (synch_postcond @ extract_tups pos_rhs) in (* let add = if counter_cls = [] then add else *) - let del = unframed_tups @ extract_tups neg_rhs in + let del = Aux.unique_sorted (unframed_tups @ extract_tups neg_rhs) in let all_rhs = pos_rhs @ neg_rhs in let struc_elems = List.map (fun sterm -> term_to_name (blank_out transl_data sterm)) @@ -2591,7 +2593,7 @@ (* a rule belongs to a player if other players' legal terms in the legal tuple are their noop terms for current location *) let loc_rules = Aux.map_some - (fun (legal_tup, _, _, _, _ as rcand) -> + (fun (legal_tup, _, _, _, _, _ as rcand) -> let legal_tup = Array.of_list legal_tup in if Aux.array_for_alli (fun pl noop -> pl = player_num || @@ -2815,13 +2817,13 @@ let proc_counter_upds i (counter, updates) = let updates = List.map (proc_update i) updates in counter, updates in - let proc_cand (legal_tup, pos_tup, neg_tup, updates, cond) = + let proc_cand (legal_tup, framed_fl, pos_tup, neg_tup, updates, cond) = let i = !rule_cl_i in incr rule_cl_i; rule_upd_j := 0; let updates = List.map (proc_counter_upds i) updates in more_cls := (("rule clause", [|Const (string_of_int i)|]), cond):: !more_cls; - legal_tup, pos_tup, neg_tup, updates, i in + legal_tup, framed_fl, pos_tup, neg_tup, updates, i in let rule_cands = match rule_cands with | Aux.Left cands -> Aux.Left (List.map proc_cand cands) @@ -2848,8 +2850,9 @@ let proc_counter_upds i (counter, updates) = let updates = List.map (proc_update i) updates in counter, updates in - let proc_cand (legal_tup, pos_tup, neg_tup, updates, i) = - legal_tup, pos_tup, neg_tup, List.map (proc_counter_upds i) updates, + let proc_cand (legal_tup, framed_fl, pos_tup, neg_tup, updates, i) = + legal_tup, framed_fl, pos_tup, neg_tup, + List.map (proc_counter_upds i) updates, List.assoc i rule_cls in let rule_cands = match rule_cands with @@ -3067,7 +3070,6 @@ ); (* }}} *) let static_base, init_state, c_paths, f_paths, element_reps, root_reps, - framed_fluents, ground_state_terms, arities, term_arities, static_rels, nonstatic_rels, frame_clauses, move_clauses, clauses, program, playout_states = prepare_paths_and_elems players_wo_env ~playout_states clauses in @@ -3165,8 +3167,9 @@ (* optimize candidates for fast pruning *) let rule_cands = let process cands = List.map - (fun (ids, (legal_tup, pos_rhs_tup, neg_rhs_tup, updates, cond)) -> - ids, (legal_tup, pos_rhs_tup, neg_rhs_tup, updates, + (fun (ids, (legal_tup, framed_fl, + pos_rhs_tup, neg_rhs_tup, updates, cond)) -> + ids, (legal_tup, framed_fl, pos_rhs_tup, neg_rhs_tup, updates, optimize_goal ~testground cond)) cands in match rule_cands with @@ -3251,7 +3254,7 @@ | Some (loc_players, loc_noops), Aux.Left cands -> let build_rule = build_toss_rule num_functions transl_data rule_names - framed_fluents f_paths struc fluents [] [] [] in + f_paths struc fluents [] [] [] in loc_graph_turn_based player_names payoffs loc_players loc_noops build_rule cands, @@ -3259,14 +3262,14 @@ | None, Aux.Right cands when is_concurrent -> let build_rule = build_toss_rule num_functions transl_data rule_names - framed_fluents f_paths in + f_paths in (* add Environment's payoff *) loc_graph_concurrent players_wo_env payoffs struc build_rule fluents cands | None, Aux.Right cands -> let build_rule = (* TODO *) build_toss_rule num_functions transl_data rule_names - framed_fluents f_paths in + f_paths in loc_graph_general_int players_wo_env payoffs struc build_rule fluents cands | _ -> assert false Modified: trunk/Toss/GGP/TranslateGameTest.ml =================================================================== --- trunk/Toss/GGP/TranslateGameTest.ml 2011-11-05 14:15:19 UTC (rev 1620) +++ trunk/Toss/GGP/TranslateGameTest.ml 2011-11-05 17:01:26 UTC (rev 1621) @@ -327,6 +327,7 @@ "value___BLANK__new0", "value___BLANK__i13"; "value___BLANK__new", "value___BLANK__i12"; "value___BLANK__east", "value___BLANK__east"; + "value___BLANK__north", "value___BLANK__north"; "gdl__counter", "gdl__counter"; ] ~loc0_move:"(turn clock)" @@ -337,7 +338,9 @@ "value___BLANK__new0", "value___BLANK__i16"; "value___BLANK__old", "value___BLANK__i12"; "value___BLANK__old0", "value___BLANK__i13"; - "value___BLANK__s12", "value___BLANK__i3"] + "value___BLANK__s11", "value___BLANK__i2"; + "value___BLANK__s12", "value___BLANK__i3"; + "value___BLANK__s15", "value___BLANK__i2"] ~loc1_move:"thrust" (); ); @@ -353,30 +356,34 @@ let a () = - set_debug_level 4; - (* Works only with [filter_possibly_redundant] true. *) - let old_filter_possibly_redundant = - !TranslateGame.filter_possibly_redundant in - TranslateGame.filter_possibly_redundant := true; - simult_test_case ~game_name:"pacman3p" ~player:"pacman" - ~plnum:1 (* 0 is environment! *) - ~moves:[|"(move east)"; "(move nowhere)"; "(move nowhere)"|] - ~rules_and_embs:[| - "move_east", [ - "control__BLANK_", "control__BLANK_"; - "gdl__counter", "gdl__counter"; - "location__BLANK__x10_y10", "location__BLANK__6_3"; - "location__BLANK__x_y", "location__BLANK__5_3"; - "synch_control_", "synch_control_"]; - "move_nowhere0", [ - "location__BLANK__x11_y11", "location__BLANK__4_6"; - "location__BLANK__x12_y12", "location__BLANK__4_6"; - "synch_control_", "synch_control_"]; - "move_nowhere1", [ - "location__BLANK__x13_y13", "location__BLANK__5_6"; - "location__BLANK__x14_y14", "location__BLANK__5_6"; - "synch_control_", "synch_control_"]|]; - TranslateGame.filter_possibly_redundant := old_filter_possibly_redundant; + (* set_debug_level 4; *) + (try + game_test_case ~game_name:"asteroids-scrambled" ~player:"ship" + ~own_plnum:0 ~opponent_plnum:0 + ~loc0_rule_name:"turn_clock2" + ~loc0_emb:[ + "value___BLANK__old0", "value___BLANK__i10"; + "value___BLANK__old", "value___BLANK__i10"; + "value___BLANK__new0", "value___BLANK__i13"; + "value___BLANK__new", "value___BLANK__i12"; + "value___BLANK__east", "value___BLANK__east"; + "value___BLANK__north", "value___BLANK__north"; + "gdl__counter", "gdl__counter"; + ] + ~loc0_move:"(turn clock)" + ~loc1:0 ~loc1_rule_name:"thrust0" + ~loc1_emb:[ + "gdl__counter", "gdl__counter"; + "value___BLANK__new", "value___BLANK__i14"; + "value___BLANK__new0", "value___BLANK__i16"; + "value___BLANK__old", "value___BLANK__i12"; + "value___BLANK__old0", "value___BLANK__i13"; + "value___BLANK__s11", "value___BLANK__i2"; + "value___BLANK__s12", "value___BLANK__i3"; + "value___BLANK__s15", "value___BLANK__i2"] + ~loc1_move:"thrust" (); + with e -> print_endline (Printexc.to_string e); + flush stdout; flush stderr; raise e); (* failwith "tested"; *) () Modified: trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss =================================================================== --- trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss 2011-11-05 14:15:19 UTC (rev 1620) +++ trunk/Toss/GGP/tests/asteroids-scrambled-raw.toss 2011-11-05 17:01:26 UTC (rev 1621) @@ -224,7 +224,7 @@ RULE turn_clock: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__west, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1north(value___BLANK__north) and @@ -256,7 +256,9 @@ (value__0heading(value___BLANK__south) and value__1south(value___BLANK__south) and value___BLANK___BLANK_(value___BLANK__south))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -266,7 +268,7 @@ RULE turn_clock0: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__south, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1west(value___BLANK__west) and @@ -298,7 +300,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -308,7 +312,7 @@ RULE turn_clock1: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__east, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1south(value___BLANK__south) and @@ -340,7 +344,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -350,7 +356,7 @@ RULE turn_clock2: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__north, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1east(value___BLANK__east) and @@ -382,7 +388,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -392,7 +400,7 @@ RULE turn_counter: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__east, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1north(value___BLANK__north) and @@ -424,7 +432,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -434,7 +444,7 @@ RULE turn_counter0: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__south, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1east(value___BLANK__east) and @@ -466,7 +476,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -476,7 +488,7 @@ RULE turn_counter1: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__west, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1south(value___BLANK__south) and @@ -508,7 +520,9 @@ (value__0heading(value___BLANK__south) and value__1south(value___BLANK__south) and value___BLANK___BLANK_(value___BLANK__south))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -518,7 +532,7 @@ RULE turn_counter2: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__north, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (mapc43(value___BLANK__old, value___BLANK__s15, value___BLANK__new) and mapc43(value___BLANK__old0, value___BLANK__s16, value___BLANK__new0) and value__1west(value___BLANK__west) and @@ -550,7 +564,9 @@ (value__0heading(value___BLANK__west) and value__1west(value___BLANK__west) and value___BLANK___BLANK_(value___BLANK__west))))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) Modified: trunk/Toss/GGP/tests/asteroids-scrambled-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/asteroids-scrambled-simpl.toss 2011-11-05 14:15:19 UTC (rev 1620) +++ trunk/Toss/GGP/tests/asteroids-scrambled-simpl.toss 2011-11-05 17:01:26 UTC (rev 1621) @@ -171,7 +171,7 @@ RULE turn_clock: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__west, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and value__1north(value___BLANK__north) and @@ -193,7 +193,9 @@ value__0heading(value___BLANK__east)) or (value__1south(value___BLANK__south) and value__0heading(value___BLANK__south)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -203,7 +205,7 @@ RULE turn_clock0: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__south, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and value___BLANK___BLANK_(value___BLANK__old) and @@ -225,7 +227,9 @@ value__0heading(value___BLANK__east)) or (value__1north(value___BLANK__north) and value__0heading(value___BLANK__north)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -235,7 +239,7 @@ RULE turn_clock1: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__east, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value__1east(value___BLANK__east) and value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and @@ -257,7 +261,9 @@ value__0heading(value___BLANK__north)) or (value__1west(value___BLANK__west) and value__0heading(value___BLANK__west)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -267,7 +273,7 @@ RULE turn_clock2: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__north, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value__1east(value___BLANK__east) and value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and @@ -289,7 +295,9 @@ value__0heading(value___BLANK__south)) or (value__1west(value___BLANK__west) and value__0heading(value___BLANK__west)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -299,7 +307,7 @@ RULE turn_counter: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__east, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value__1east(value___BLANK__east) and value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and @@ -321,7 +329,9 @@ value__0heading(value___BLANK__south)) or (value__1west(value___BLANK__west) and value__0heading(value___BLANK__west)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -331,7 +341,7 @@ RULE turn_counter0: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__south, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value__1east(value___BLANK__east) and value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and @@ -353,7 +363,9 @@ value__0heading(value___BLANK__north)) or (value__1west(value___BLANK__west) and value__0heading(value___BLANK__west)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__east), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -363,7 +375,7 @@ RULE turn_counter1: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__west, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and value___BLANK___BLANK_(value___BLANK__old) and @@ -385,7 +397,9 @@ value__0heading(value___BLANK__east)) or (value__1north(value___BLANK__north) and value__0heading(value___BLANK__north)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__south), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) @@ -395,7 +409,7 @@ RULE turn_counter2: MATCH gdl__counter(gdl__counter) and not terminal() and - ex value___BLANK__s15, value___BLANK__north, value___BLANK__s16 + ex value___BLANK__s15, value___BLANK__s16 (value___BLANK___BLANK_(value___BLANK__new) and value___BLANK___BLANK_(value___BLANK__new0) and value__1north(value___BLANK__north) and @@ -417,7 +431,9 @@ value__0heading(value___BLANK__east)) or (value__1south(value___BLANK__south) and value__0heading(value___BLANK__south)))) - DEL RELS value__0x(value___BLANK__old), value__0y(value___BLANK__old0) + DEL + RELS value__0heading(value___BLANK__north), value__0x(value___BLANK__old), + value__0y(value___BLANK__old0) ADD RELS value__0heading(value___BLANK__west), value__0x(value___BLANK__new), value__0y(value___BLANK__new0) Modified: trunk/Toss/GGP/tests/breakthrough-simpl.toss =================================================================== --- trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-11-05 14:15:19 UTC (rev 1620) +++ trunk/Toss/GGP/tests/breakthrough-simpl.toss 2011-11-05 17:01:26 UTC (rev 1621) @@ -36,10 +36,10 @@ cellholds_2white(cellholds_x_y__BLANK_) and control_0white(control__BLANK_) and not terminal() DEL - RELS cellholds_2black(cellholds_x_y__BLANK_), - cellholds_2black(cellholds_x_y0__BLANK_), - cellholds_2white(cellholds_x_y__BLANK_), - cellholds_2white(cellholds_x_y0__BLANK_), control_0white(control__BLANK_) + RELS cellholds_2black(cellholds_x_y0__BLANK_), + cellholds_2black(cellholds_x_y__BLANK_), + cellholds_2white(cellholds_x_y0__BLANK_), + cellholds_2white(cellholds_x_y__BLANK_), control_0white(control__BLANK_) ADD RELS cellholds_2white(cellholds_x_y0__BLANK_), control_0black(control__BLANK_) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |