From 5d3731bc294c8478efcec15d9233f2917ca9a99b Mon Sep 17 00:00:00 2001 From: Douglas R Miles Date: Tue, 18 Apr 2023 06:10:34 -0700 Subject: [PATCH] unifiable --- logicmoo_workspace.vpj | 864 +++++++----------- .../prolog/kaggle_arc/kaggle_arc_howdiff.pl | 1 + .../prolog/kaggle_arc/kaggle_arc_test_easy.pl | 14 +- .../kaggle_arc/kaggle_arc_uniqueness.pl | 47 +- 4 files changed, 332 insertions(+), 594 deletions(-) diff --git a/logicmoo_workspace.vpj b/logicmoo_workspace.vpj index e48da9806c..e746f68462 100644 --- a/logicmoo_workspace.vpj +++ b/logicmoo_workspace.vpj @@ -1277,108 +1277,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -10043,29 +9942,6 @@ - - - - - - - - - - - - - - - - - - - - - - - @@ -10111,106 +9987,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -62133,317 +61909,381 @@ - + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - - + + + + + + + + + - - - - - - - - + + + + + + + + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - @@ -88307,82 +88147,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_howdiff.pl b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_howdiff.pl index b8862fe201..2c4801e0d5 100644 --- a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_howdiff.pl +++ b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_howdiff.pl @@ -1522,6 +1522,7 @@ count_difs(A,B,C):- into_grid(A,AA),into_grid(B,BB), !, count_difs0(AA,BB,C). count_difs0(Out,GridO,0):- Out=@=GridO,!. +count_difs0(Out,GridO,1):- \+ compound(Out), \+ compound(GridO), is_bg_color(Out); is_bg_color(Out). count_difs0(Out,GridO,1):- ((\+ compound(Out)) ; \+ compound(GridO)),!. count_difs0([A|Out],[B|GridO],Errors):- count_difs0(A,B,Errors1), diff --git a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_test_easy.pl b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_test_easy.pl index ea886afdef..5e317f126b 100644 --- a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_test_easy.pl +++ b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_test_easy.pl @@ -317,14 +317,14 @@ w_section(title(warn_and_fail_on_bad_p2), ((\+ \+ with_io_training_context(I,Expect, (( put_attr(M,expect_p2,Expect), - (grid_call(P2,I,M)->OurOut=M;OurOut=I), - count_difs(OurOut,Expect,Errors), + (grid_call(P2,I,M)->OurSolution=M;OurSolution=I), + count_difs(OurSolution,Expect,Errors), (Errors = 0 - -> banner_grids(Cyan,I,pass_p2(P2,Ex1),OurOut,"MATCH") - ; (banner_grids(Orange,OurOut,fail(Errors,P2,Ex1),Expect,"MISMATCH"), - assert(fail_p2(Ex1,P2,I,OurOut,Expect)), - banner_grids(red,I,fail(Errors,P2,Ex1),OurOut,"WRONG"), - nop(show_sameness_or_lameness(Cyan,Orange,warn_and_fail_on_bad_p2(P2,Ex1),OurOut,Expect,Errors)), + -> banner_grids(Cyan,I,pass_p2(P2,Ex1),OurSolution,"MATCH") + ; (banner_grids(Orange,OurSolution,fail(Errors,P2,Ex1),Expect,"MISMATCH"), + assert(fail_p2(Ex1,P2,I,OurSolution,Expect)), + banner_grids(red,I,fail(Errors,P2,Ex1),OurSolution,"WRONG"), + nop(show_sameness_or_lameness(Cyan,Orange,warn_and_fail_on_bad_p2(P2,Ex1),OurSolution,Expect,Errors)), !,fail)),!, Errors == 0)))))). diff --git a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_uniqueness.pl b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_uniqueness.pl index 4ee35a2d9d..47b4ab095f 100644 --- a/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_uniqueness.pl +++ b/packs_sys/logicmoo_agi/prolog/kaggle_arc/kaggle_arc_uniqueness.pl @@ -86,10 +86,6 @@ ExampleNum = trn+_, (propcounts(TestID, ExampleNum, Out, count, N2, X) -> true ; N2=0), N1\==N2. -accompany_change30(TestID,P,Same):- - maplist(no_repeats_var,[P]), - accompany_changed_compute_pass1(TestID,P,Same). - compute_scene_change(TestID):- with_pair_mode(whole_test, (banner_lines(red,4), @@ -179,11 +175,11 @@ compute_scene_change_pass2b(_,_). compute_scene_change_pass2c(TestID,P):- - make_unifiable_cc(P,UP), + make_unifiable_u(P,UP), is_accompany_changed_db(TestID,P,Same), is_accompany_changed_db(TestID,UP,DSame), P\=@=UP, - maplist(make_unifiable_cc,DSame,USame), + maplist(make_unifiable_u,DSame,USame), intersection(Same,USame,Kept,_,_),Kept\==[], forall(retract(is_accompany_changed_db(TestID,P,_)),true), assert_ilp_new(is_accompany_changed_db(TestID,P,Kept)). @@ -297,12 +293,11 @@ prop_can(Prop,Can):- ensure_prop_change(Prop), - prop_cant(Prop,Cant), + once((prop_cant(Prop,Cant), prop_can1(Prop,Can1), - intersection(Can1,Cant,_,Can,_). - + intersection(Can1,Cant,_,Can,_))). + %(Can == [] -> (CanL=Can1,fail) ; CanL= Can). -% Turns out due to shortage Fred Meyer doesn't have the XR now anyways .. But i confirmed they do have have a 28 day supply of the non-XR .. .. Go ahead and not send the XR if you haven't sent it prop_cant(Prop,Set):- ensure_prop_change(Prop), @@ -322,34 +317,10 @@ ((enum_object_ext(O),has_prop(giz(g(out)),O),has_prop(cc(bg,0),O), has_prop(Prop,O))),[I|L]), indv_props_list(I,List), - findall(P,(member(P,List),ok_notice(P),forall(member(E,L),has_prop(P,E))),Can). + findall(P,(member(P,List),P\=@=Prop,ok_notice(P),forall(member(E,L),has_prop(P,E))),Can). -accompany_changed_compute_pass1(TestID,P,SameS):- - findall(ac(TestID,X,ExampleNum,PO), - (accompany_change2(TestID,ExampleNum,[X1=P1O,X2=P2O,common=_Intersect]), - member(X=PO,[X1=P1O,X2=P2O])), AC0), - sort(AC0,AC1), - list_to_set_variant(AC1,AC2), - props_change(TestID,P,_), - ac1_or_ac2(TestID,P,AC2,NewSame), - correct_antes3(TestID,P,NewSame,SameS). - -ac1_or_ac2(TestID,P,AC2,NewSame):- - ac1_or_ac2_1(TestID,P,AC2,NewSame)*->true;ac1_or_ac2_2(TestID,P,AC2,NewSame). - -ac1_or_ac2_1(TestID,P,AC2,NewSame):- - findall(ac1(PO),member(ac(TestID,P,_ExampleNum,PO),AC2),AC3), - merge_xtra_props_ac1(AC3,Same), - find_peers_with_same(TestID,P,Same,NewSame), - NewSame\==[]. - -ac1_or_ac2_2(TestID,P,AC2,NewSame):- - findall(ac2(ExampleNum,PO),(member(ac(TestID,P,ExampleNum,PO),AC2)),AC3), - sort(AC3,AC4), - merge_xtra_props_ac2(AC4,Same), - find_peers_with_same(TestID,P,Same,NewSame), - NewSame\==[]. +accompany_changed_compute_pass1(TestID,P,SameS):- props_change(TestID,P,_),prop_can(P,SameS). %xlisting(propcounts+variance_had_count_set+(pen([cc(yellow,1)]);links_count(contains,4))-'$spft$'). /* @@ -393,6 +364,7 @@ ExampleNum \== ExampleNum2, intersection(PO1,PO2,Some),Some\==[],!, merge_xtra_props_ac2([ac2(ExampleNum,Some)|AC4],Same). + merge_xtra_props_ac2([ac2(ExampleNum,PO1)|AC3],[ac2(ExampleNum,PO1)|Same]):- merge_xtra_props_ac2(AC3,Same),!. merge_xtra_props_ac2(Same,Same):-!. @@ -412,7 +384,8 @@ compound(X1),compound(X2), same_functor(X1,X2),!, make_unifiable_u(X1,U1), make_unifiable_u(X2,U2), U1 =@= U2. -%make_unifiable_u(link(sees(L),A),link(sees(_),_)):-!. +make_unifiable_u(Atom,U):- atomic(Atom),!,freeze(U,atomic(U)). +make_unifiable_u(link(sees(L),A),link(sees(U),B)):- !, maplist(make_unifiable_u,[A|L],[B|U]). make_unifiable_u(X1,U1):- make_unifiable_cc(X1,U1),!. accompany_change2(TestID,ExampleNum,[X1=P1O,X2=P2O,common=Intersect]):-