Alternate BBs
Alternate BBs
ResourceFunction["ParallelMapMonitored"][FindLifetime[Length/@With[{t=6},MWTMEvolveList[#,{{{1,t+1},Table[0,2t+1]}},t]]]&,DeleteCases[Subsets[TMRuleCases[2,2],{2}],{}]]
Compilation
Compilation
In[]:=
FindLifetime[list_]:=If[#Length[list],None,#]&[First[FirstPosition[list,Last[list]]]]
In[]:=
MWTMEvolveList[rule_,inits:{{{_,_},_}...},t_Integer]:=NestList[Union[#,Catenate[Map[MWTMStep[rule,#]&,#]]]&,inits,t]
In[]:=
MWTMStep[rule_List,{{s_,n_},a_}]/;1≤n≤Length[a]:=Apply[{{#1,n+#3},ReplacePart[a,n->#2]}&,ReplaceList[{s,a〚n〛},rule],{1}]
In[]:=
TestTMs[s_,k_,p_,t_,max_]:=ResourceFunction["ParallelMapMonitored"][Function[rule,Catch[FindLifetime[Length/@NestList[With[{u=Union[#,Catenate[Map[MWTMStep[rule,#]&,#]]]},If[Length[u]>max,Throw[TooBig],u]]&,{{{1,t+1},Table[0,2t+1]}},t]]]],DeleteCases[Subsets[TMRuleCases[s,k],{p}],{}]]
In[]:=
RandomSample[DeleteCases[Subsets[TMRuleCases[2,2],{3}],{}],5]
Out[]=
{{{1,1}{1,1,1},{1,0}{1,0,1},{2,0}{2,1,-1}},{{1,0}{1,1,1},{1,0}{2,0,-1},{1,0}{2,1,1}},{{1,1}{1,0,-1},{1,1}{2,0,-1},{2,1}{2,0,1}},{{1,1}{1,0,1},{1,1}{2,1,1},{1,0}{2,1,1}},{{1,1}{2,1,-1},{2,1}{2,0,1},{2,0}{1,1,1}}}
{{{s,pos},{0,0,1,1,0,1,0,1}},XXXX}
Table[
MWTMCF=FunctionCompile[Module[{h=CreateDataStructure["HashSet"]},Table[0,2t+1]
DataStructure[
In[]:=
FunctionCompile[Function[{Typed[init,TypeSpecifier["PackedArray"]["Integer8",1]]},Union[init]]]
Out[]=
Failure
MWTMCF[listofrules,listofstates,t,maxstatect]stoppingtime;None;TooBig