INTERFACE GDPool; (* The solution pool *) IMPORT CPUTime; IMPORT GDScore, GDProgressPlot; FROM GDGeometry IMPORT NAT; TYPE T <: PublicT; PublicT = OBJECT (* A set of drawings, with timing and scoring information. *) METHODS init(size: NAT; nC: NAT; ppt: REF Plots): T; (* Must be called before any other method. Initializes the pool with space for "size" items maximum, each with exactly "nC" scores. The "ppt" is an optional list of "nC" `progress plots'. If "ppt" is not NIL, then, whenever any method call causes an item gets deleted from the pool, a horizontal line will be written to each plot "ppt[k]" to show its score and lifetime. *) read(): Item; (* Selects a random entry from the pool, with probabilities depending on rank, and returns its scored drawing. The entry remains in the pool. A result "sd" with "sd.dr = NIL" indicates that the pool is empty. *) store(sd: Item; clock: Time); (* Stores a new solution "sd" into the pool, if "sd.dr" is not NIL. If the pool is already full, deletes an item before inserting this one. *) void(clock: Time): REF ARRAY OF Item; (* Empties the pool and returns a list of the items, sorted by increasing rank. *) END; TYPE Time = CPUTime.T; Score = GDScore.T; Item = OBJECT descr: TEXT; (* A short description of the item, suitable for printouts and debugging. *) METHODS score(k: NAT): Score; (* Returns the "k"th score of the item "it". *) END; Plots = ARRAY OF GDProgressPlot.T; END GDPool. (* Last edited on 2000-01-12 10:57:37 by stolfi *)