public void intraClusterCompression(int tier)
{
if (clusterList.Where(l => l.clusterTier == tier).Select(l => l.clusterMax).Count() == 0)
{
return; //no more queries in this configuration
}
var maxValue = clusterList.Where(l => l.clusterTier == tier).Select(l => l.clusterMax).Max();
int[] humanIntervals = new int[] { 0, 10, 60, 300, 600, 1800, 3600, 7200 };
int intervalMarker = 1;
int counter = 0;
var highInterval = humanIntervals[intervalMarker];
int i = humanIntervals[intervalMarker - 1];
bool done = false;
while (!done)
{
var currentInterval = (from l in clusterList
where l.clusterTier == tier && l.clusterMax >= i &&
l.clusterMax < highInterval
select l).ToList();
if (currentInterval.Count() > 0)
{
Cluster c = new Cluster("Cluster" + counter, tier,
currentInterval.Select(l => l.clusterMax).Min(),
currentInterval.Select(l => l.clusterMax).Max(), i, highInterval);
counter++;
foreach (var q in currentInterval)
{
foreach (var qInner in q.getAllQueries())
{
c.addQuery(qInner);
}
clusterList.Remove(q);
}
clusterList.Add(c);
c.findRoots();
}
//check if finished
if (highInterval > maxValue)
{
done = true;
}
else
{
intervalMarker++;
i = humanIntervals[intervalMarker - 1];
highInterval = humanIntervals[intervalMarker];
}
}
}