Example #1
0
        public List <FactBaseQuery> SoftCombineQueries(params List <FactBaseQuery>[] querypool)
        {
            var nonempty = querypool.Where(i => i.Count > 0);

            var combinedqueries = MathX.CartesianProduct(nonempty);

            var mergedqueries = new List <FactBaseQuery>();

            foreach (var combination in combinedqueries)
            {
                var mergedquery     = new FactBaseQuery();
                var combinationlist = combination.ToList();
                var ix = 0;
                foreach (var fbq in combinationlist)
                {
                    //Merge(fbq, mergedquery);
                    mergedquery.NrOfDictFilters += fbq.NrOfDictFilters;
                    //if (ix == combinationlist.Count - 1)
                    //{
                    //    Merge(fbq, mergedquery);
                    //}
                    FactBaseQuery.Merge(fbq, mergedquery);

                    ix++;
                }
                mergedqueries.Add(mergedquery);
            }
            return(mergedqueries);
        }
Example #2
0
        public List <FactBaseQuery> CombineQueries(params List <FactBaseQuery>[] querypool)
        {
            var nonempty = querypool.Where(i => i.Count > 0);

            var combinedqueries = MathX.CartesianProduct(nonempty);

            var mergedqueries = new List <FactBaseQuery>();

            foreach (var combination in combinedqueries)
            {
                var mergedquery = new FactBaseQuery();
                foreach (var fbq in combination)
                {
                    FactBaseQuery.Merge(fbq, mergedquery);
                }
                mergedqueries.Add(mergedquery);
            }
            return(mergedqueries);
        }