(* JDTLRscan.nb --------------------------------------------------------- *)

(* Runs through file of posets, applying JDTLRQ[] to see which have the JDT 
	property and which have the L-R property.  The jdt posets are written 
	to jdtpsts* and the L-R posets are written to ltlrich*. *)

(* Utility Needed: WriteLstOfLst[]. *)
(* Function Needed: JDTLRQ[]. *)
(* Data Needed: stdisos*, lookups*, invexts* for * = 4 to size-2. *) 

(* User must specify the directory, the size of the posets to be considered,
	and the family of input posets to test. *)

(* Change Diretory: *)
SetDirectory["G:/.isis/home/c/a/cagann/public_html/Posets"];

<< GenrlUtils.m;    << PosetUtils.m;    << InvExIsoFncts.m    << JDTLRQ.m; 

(* Change size of posets considered: *)    nk = 9; 

(* Change input family: *) infam = "UMxndcs/umxndcs";

stmem = MaxMemoryUsed[]; sttim = AbsoluteTime[]; stcpu = TimeUsed[];
plst = ReadList[ StringJoin[infam,ToString[nk]] ];
sfil[nn_] := StringJoin["StdIsos/stdisos",ToString[nn]];
mfil[nn_] := StringJoin["Lookups/lookups",ToString[nn]];
ifil[nn_] := StringJoin["InvExts/invexts",ToString[nn]];
Do[
	<< (sfil[sz]);
	<< (mfil[sz]);
	invrsex[sz] = ReadList[ifil[sz]]
,{sz,4,nk-2}];

(* Determine the order in which ideal sizes are considered. *)
szord = Table[Floor[nk/2]+(-1)^(jsz)*Floor[jsz/2],{jsz,nk-3}];

jdtpsts = {};    ltlrchs = {};

Do[
	tstrslts = JDTLRQ[plst[[np]]];
	If[ tstrslts[[1]], AppendTo[jdtpsts,plst[[np]]] ];
	If[ tstrslts[[2]], AppendTo[ltlrchs,plst[[np]]] ];
,{np,Length[plst]}];

WriteLstOfLst[ StringJoin["CJDTndc/cjdtndc",ToString[nk]], jdtpsts ];
WriteLstOfLst[ StringJoin["CLRndcs/clrndcs",ToString[nk]], ltlrchs ];

emem = MaxMemoryUsed[]; etim = AbsoluteTime[]; ecpu = TimeUsed[];
PrntCnsmptn[stmem,emem,sttim,etim,stcpu,ecpu];

(* End of JDTLRscan.nb. *)