(* BldUMxmls.m ---------------------------------------------------------- *)

(* Creates posets of size n that have a unique maximal element by adjoining 
	one element above the maximal elts of every poset with n-1 elts. *)

(* Utility Needed: WriteLstOfLst[]. *)
(* Function Needed: StdFormIso[]. *)
(* Data Needed: stdpsts* for * = n-1. *)

(* User needs to change the directory and the size, n, of posets created. *)

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

(* Change the size of posets to create: *)    nsiz = 1;

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

stmem = MaxMemoryUsed[]; sttim = AbsoluteTime[]; stcpu = TimeUsed[];

Which[
	nsiz \[Equal] 1,
	smllrpsts = {{}},
	nsiz > 1,
	smllrpsts = ReadList[ StringJoin["StdPsts/stdpsts",ToString[nsiz-1]] ]
];

(* Onto each smaller poset, append the list of maximal elements. *)
umaxlst = 
	Sort[
		Map[
			Append[#,
				Complement[
					Range[nsiz-1],
					Flatten[#]
				]
			]&,
			smllrpsts
		]
	];

WriteLstOfLst[
	StringJoin["UMaxmls/umaxmls",ToString[nsiz]],
	umaxlst
];

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

(* End of BuildUMxmls.m. *)