public TileSuggester(Lattice lattice) {
this.lattice = lattice;
}
public Iterable<? extends Lattice.Tile> tiles() {
final Algorithm algorithm = new MonteCarloAlgorithm();
final PrintWriter pw = new PrintWriter(System.out);
final Progress progress = new ArgumentUtils.TextProgress(pw);
final StatisticsProvider statisticsProvider =
new StatisticsProviderImpl(lattice);
final double f = statisticsProvider.getFactRowCount();
final ImmutableMap<Parameter, Object> map =
ImmutableMap.<Parameter, Object>of(
Algorithm.ParameterEnum.timeLimitSeconds, 1,
Algorithm.ParameterEnum.aggregateLimit, 3,
Algorithm.ParameterEnum.costLimit, f * 5d);
final SchemaImpl schema = new SchemaImpl(lattice, statisticsProvider);
final Result result = algorithm.run(schema, map, progress);
final ImmutableList.Builder<Lattice.Tile> tiles = ImmutableList.builder();
for (Aggregate aggregate : result.getAggregates()) {
System.out.println(aggregate);
tiles.add(toTile(aggregate));
}