Warning: session_start(): open(/var/lib/php/sessions/sess_qce78h272dunmofiuiodj6u67f, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
// always keeps a dynamically updated list of the n most probable
// results
// for maxResults default, see SetOfMostProbable
// not synchronized
srecord noeq PSCollectMostProbable(
IVF1>> action) implements IF0>>, Steppable {
new ProbabilisticScheduler ps;
new SetOfMostProbable results;
bool verbose;
*() {}
*(int maxResults) {
setMaxResults(maxResults);
}
*(int maxResults,
ProbabilisticScheduler *ps,
IVF1>> *action) {
setMaxResults(maxResults);
}
*(int maxResults, IVF2>> action) {
setMaxResults(maxResults);
this.action = out -> action.get(ps, out);
}
void add(WithProbability result) {
results.add(result);
}
selfType run() {
action?.get(result -> add(result));
this;
}
void setMaxResults(int maxResults) {
results.setMaxSize(maxResults);
}
selfType verbose(bool verbose) { this.verbose = verbose; this; }
// results sorted by probability. instant
public Set> results aka get() {
ret results;
}
public bool step() { ret ps.step(); }
}