public void TestWeightedSum_DataTable() { string[] strPrefSQL = GetPreferences(); for (int i = 0; i <= strPrefSQL.GetUpperBound(0); i++) { SQLCommon common = new SQLCommon(); common.SkylineType = new SkylineSQL(); DataTable dt = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, strPrefSQL[i]); //Check tuples (every algorithm should deliver the same amount of tuples) Assert.AreEqual(dt.Rows.Count, 55208, 0, "WeightedSum Sorting failed"); } }
public void GeneratePerformanceQueries() { if (MaxDimensions < MinDimensions) { Debug.WriteLine("Max Dimensions must be >= Min Dimensions!"); return; } //Open DBConnection --> Otherwise first query is slower as usual, because DBConnection is not open SQLCommon parser = new SQLCommon(); DataTable dt = parser.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, "SELECT cars.id FROM cars SKYLINE OF cars.price LOW"); //Use the correct line, depending on how incomparable items should be compared ArrayList listPreferences = new ArrayList(); SqlConnection cnnSQL = new SqlConnection(Helper.ConnectionString); //for CLR performance tets ArrayList preferencesMode = new ArrayList(); if (UseCLR) { cnnSQL.Open(); } switch (Set) { case PreferenceSet.ArchiveComparable: preferencesMode = GetArchiveComparablePreferences(); break; case PreferenceSet.ArchiveIncomparable: preferencesMode = GetArchiveIncomparablePreferences(); break; case PreferenceSet.Jon: preferencesMode = GetJonsPreferences(); break; case PreferenceSet.Mya: preferencesMode = GetMyasPreferences(); break; case PreferenceSet.Barra: preferencesMode = GetBarrasPreferences(); break; case PreferenceSet.All: preferencesMode = GetAllPreferences(); break; case PreferenceSet.Numeric: preferencesMode = GetNumericPreferences(); break; case PreferenceSet.NumericIncomparable: preferencesMode = GetNumericIncomparablePreferences(); break; case PreferenceSet.Categoric: preferencesMode = GetCategoricalPreferences(); break; case PreferenceSet.CategoricIncomparable: preferencesMode = GetCategoricalIncomparablePreferences(); break; case PreferenceSet.MinCardinality: preferencesMode = GetMinimalCardinalityPreferences(); break; case PreferenceSet.LowCardinality: preferencesMode = GetLowCardinalityPreferences(); break; case PreferenceSet.HighCardinality: preferencesMode = GetHighCardinalityPreferences(); break; case PreferenceSet.LowAndHighCardinality: preferencesMode = GetLowAndHighCardinalityPreferences(); break; case PreferenceSet.ForRandom10: preferencesMode = Get10ForRandomPreferences(); break; case PreferenceSet.ForRandom17: preferencesMode = Get17ForRandomPreferences(); break; } //Calculate correlationmatrix and cardinality from the preferences ArrayList correlationMatrix = GetCorrelationMatrix(preferencesMode); ArrayList listCardinality = GetCardinalityOfPreferences(preferencesMode); //Depending on the mode create the sets from the preferences if (Mode == PreferenceChooseMode.Combination) { //Tests every possible combination with y preferences from the whole set of preferences if (MaxDimensions > preferencesMode.Count) { Debug.WriteLine("Combination with more dimensions than preferences. Please reduce dimensions!"); return; } //create all possible combinations and add it to listPreferences for (int i = MinDimensions; i <= MaxDimensions; i++) { GetCombinations(preferencesMode, i, 0, new ArrayList(), ref listPreferences); } } else if (Mode == PreferenceChooseMode.SameOrder) { int draws = MaxDimensions - MinDimensions + 1; //Tests x times randomly y preferences for (int iChoose = 0; iChoose < draws; iChoose++) { ArrayList preferencesRandom = new ArrayList(); ArrayList preferencesChoose = (ArrayList)preferencesMode.Clone(); //First define define randomly how many dimensions int sampleDimensions = iChoose + MinDimensions; //Choose x preferences randomly for (int i = 0; i < sampleDimensions; i++) { preferencesRandom.Add(preferencesChoose[i]); } //add random preferences to listPreferences listPreferences.Add(preferencesRandom); } } else if (Mode == PreferenceChooseMode.Shuffle) { //Tests x times randomly y preferences for (int iChoose = 0; iChoose < _randomDraws; iChoose++) { ArrayList preferencesRandom = new ArrayList(); ArrayList preferencesChoose = (ArrayList)preferencesMode.Clone(); //First define define randomly how many dimensions int differentDimensions = MaxDimensions - MinDimensions + 1; int sampleDimensions = Rnd.Next(differentDimensions) + MinDimensions; //Choose x preferences randomly for (int i = 0; i < sampleDimensions; i++) { int r = Rnd.Next(preferencesChoose.Count); preferencesRandom.Add(preferencesChoose[r]); preferencesChoose.RemoveAt(r); } //add random preferences to listPreferences listPreferences.Add(preferencesRandom); } } else if (Mode == PreferenceChooseMode.Correlation) { if (MaxDimensions > 2) { Debug.WriteLine("This test mode only works for 2 dimensions!"); return; } //Sort correlations to find the strongest correlationMatrix.Sort(new CorrelationModel()); //Sort correlations ascending CorrelationModel model = (CorrelationModel)correlationMatrix[0]; preferencesMode.Clear(); preferencesMode.Add(model.ColA); preferencesMode.Add(model.ColB); listPreferences.Add(preferencesMode); } else if (Mode == PreferenceChooseMode.AntiCorrelation) { if (MaxDimensions > 2) { Debug.WriteLine("This test mode only works for 2 dimensions!"); return; } //Sort correlations ascending correlationMatrix.Sort(new CorrelationModel()); //Take only the two preferences with the worst correlation CorrelationModel model = (CorrelationModel)correlationMatrix[correlationMatrix.Count - 1]; preferencesMode.Clear(); preferencesMode.Add(model.ColA); preferencesMode.Add(model.ColB); listPreferences.Add(preferencesMode); } else if (Mode == PreferenceChooseMode.Independent) { if (MaxDimensions > 2) { Debug.WriteLine("This test mode only works for 2 dimensions!"); return; } //Sort correlations to find the strongest correlationMatrix.Sort(new CorrelationModel()); //Find the most independent atributes (closest to zero) CorrelationModel modelBefore = new CorrelationModel(); CorrelationModel modelAfter = new CorrelationModel(); for (int i = 0; i <= correlationMatrix.Count; i++) { CorrelationModel model = (CorrelationModel)correlationMatrix[i]; if (model.Correlation > 0) { //continue until the correlation turnaround modelBefore = model; } else { modelAfter = model; //Leave the function, because now the correlation is getting worse break; } } //Add the two preferences to the list, that are closer to zero preferencesMode.Clear(); if (Math.Abs(modelBefore.Correlation) > Math.Abs(modelAfter.Correlation)) { preferencesMode.Add(modelAfter.ColA); preferencesMode.Add(modelAfter.ColB); } else { preferencesMode.Add(modelBefore.ColA); preferencesMode.Add(modelBefore.ColB); } listPreferences.Add(preferencesMode); } List<SkylineStrategy> listStrategy = new List<SkylineStrategy>(); if (Strategy == null) { //If no strategy is defined --> Take all possible algorithms //listStrategy.Add(new SkylineSQL()); listStrategy.Add(new SkylineBNLSort()); listStrategy.Add(new SkylineBNLSort()); listStrategy.Add(new SkylineDQ()); listStrategy.Add(new SkylineHexagon()); listStrategy.Add(new SkylineDecisionTree()); } else { listStrategy.Add(Strategy); } //Generates the R-Commands for the rpref package (for testig exactly the same statements in rpref) if (WriteRCommand) { StringBuilder sb = new StringBuilder(); sb.AppendLine("---------------------------------------------"); sb.AppendLine("-----------------R-Commands------------------"); sb.AppendLine("---------------------------------------------"); sb.AppendLine("library(rPref)"); sb.AppendLine("setwd(\"E:\\\\Projekte\\\\prefSQL_Paper\\\\Test Scalagon\")"); sb.AppendLine("mydata = read.csv(\"cars_all.csv\", sep=\";\")"); sb.AppendLine("skylinesize <- array(" + listPreferences.Count + ":1)"); sb.AppendLine("timeins <- array(" + listPreferences.Count + ":1)"); for (int iPreferenceIndex = 0; iPreferenceIndex < listPreferences.Count; iPreferenceIndex++) { ArrayList preferences = (ArrayList)listPreferences[iPreferenceIndex]; ArrayList subPreferences = preferences; //.GetRange(0, i); sb.Append("time = system.time(sky1 <- psel(mydata, "); foreach(String pref in preferences) { String rCommand = ""; if(pref.IndexOf("cars.") == -1) { //Categorical preferences //String tableName = pref.Substring(0, pref.IndexOf(".")); rCommand = "low(" + pref.Substring(0, pref.IndexOf(" (")).Replace(".name", "") + ")"; /*preferences.Add("colors.name ('red' >> 'blue' >> 'green' >> 'gold' >> 'black' >> 'gray' >> 'bordeaux' >> OTHERS EQUAL)"); preferences.Add("bodies.name ('bus' >> 'cabriolet' >> 'limousine' >> 'coupé' >> 'van' >> 'estate car' >> OTHERS EQUAL)"); preferences.Add("fuels.name ('petrol' >> 'diesel' >> 'bioethanol' >> 'electro' >> 'gas' >> 'hybrid' >> OTHERS EQUAL)"); preferences.Add("makes.name ('BENTLEY' >> 'DAIMLER' >> 'FIAT'>> 'FORD' >> OTHERS EQUAL)"); preferences.Add("conditions.name ('new' >> 'occasion' >> 'demonstration car' >> 'oldtimer' >> OTHERS EQUAL)"); preferences.Add("drives.name ('front wheel' >> 'all wheel' >> 'rear wheel' >> OTHERS EQUAL)"); preferences.Add("transmissions.name ('manual' >> 'automatic' >> OTHERS EQUAL)");*/ } else { //Numeric preference if (pref.IndexOf("LOW") > 0) { //LOW preference rCommand = "low(" + pref.Substring(0, pref.IndexOf(" ")).Replace("cars.", "") +")"; } else { //HIGH preferences rCommand = "high(" + pref.Substring(0, pref.IndexOf(" ")).Replace("cars.", "") + ")"; } } sb.Append(rCommand); //Don't add * on last record if (pref != (string)preferences[preferences.Count-1]) { sb.Append(" * "); } } sb.AppendLine("))"); sb.AppendLine("timeins[" + (iPreferenceIndex + 1) + "] = time[3]"); sb.AppendLine("skylinesize[" + (iPreferenceIndex + 1) + "] = nrow(sky1)"); sb.AppendLine("skylinesize[" + (iPreferenceIndex + 1) + "]"); sb.AppendLine("timeins[" + (iPreferenceIndex + 1) + "]"); //string strSkylineOf = "SKYLINE OF " + string.Join(",", (string[])subPreferences.ToArray(Type.GetType("System.String"))); //sb.AppendLine(strSkylineOf); } sb.AppendLine("mean(skylinesize)"); sb.AppendLine("min(skylinesize)"); sb.AppendLine("max(skylinesize)"); sb.AppendLine("var(skylinesize)"); sb.AppendLine("sd(skylinesize)"); sb.AppendLine("mean(timeins)"); sb.AppendLine("min(timeins)"); sb.AppendLine("max(timeins)"); sb.AppendLine("var(timeins)"); sb.AppendLine("sd(timeins)"); sb.AppendLine("---------------------------------------------"); sb.AppendLine("---------------------------------------------"); sb.AppendLine("---------------------------------------------"); sb.AppendLine(""); sb.AppendLine(""); Debug.Write(sb.ToString()); //create filename string strFileName = Path + "AllShuffle_RCommands" + DateTime.Now.Ticks + ".txt"; StreamWriter outfile = new StreamWriter(strFileName); outfile.Write(sb.ToString()); outfile.Close(); } int iStrategy = 0; foreach(SkylineStrategy currentStrategy in listStrategy) { //Take all strategies //BNL with attributeposition sorting and bnl with entropy function sorting //For testing the BNL automatically (shuffle mode), once with attributeposition and once with entropy function if (iStrategy == 1) { WindowSort = SQLCommon.Ordering.AttributePosition; } iStrategy++; StringBuilder sb = new StringBuilder(); string strSeparatorLine; if (Sampling) { strSeparatorLine = PerformanceSampling.GetSeparatorLine(ExcessiveTests); } else { strSeparatorLine = FormatLineString('-', "", "", "", "", "", "", "", "", "", "", ""); } if (GenerateScript == false) { //Header sb.AppendLine(" Path: " + Path); sb.AppendLine(" Algorithm: " + currentStrategy); sb.AppendLine(" Use CLR: " + UseCLR); sb.AppendLine(" Preference Set: " + Set.ToString()); sb.AppendLine(" Preference Mode: " + Mode.ToString()); sb.AppendLine(" Host: " + Environment.MachineName); sb.AppendLine(" Set of Preferences: " + listPreferences.Count); sb.AppendLine(" Trials: " + Trials); sb.AppendLine(" Table size: " + TableSize.ToString()); sb.AppendLine(" Dimension from: " + MinDimensions.ToString()); sb.AppendLine(" Dimension to: " + MaxDimensions.ToString()); sb.AppendLine(" BNL Initial Sort: " + WindowSort.ToString()); sb.AppendLine(" BNL Window Handling: " + WindowHandling.ToString()); //sb.AppendLine("Correlation Coefficients:" + string.Join(",", (string[])preferences.ToArray(Type.GetType("System.String")))); //sb.AppendLine(" Cardinalities:" + string.Join(",", (string[])preferences.ToArray(Type.GetType("System.String")))); if (Sampling) { sb.AppendLine(" Sampling: true"); sb.AppendLine(" Subsets Count: " + SamplingSubsetsCount); sb.AppendLine(" Subset Dimension: " + SamplingSubsetDimension); sb.AppendLine(" Sampling Runs: " + SamplingSamplesCount); } sb.AppendLine(""); if (Sampling) { sb.AppendLine(PerformanceSampling.GetHeaderLine()); } else { sb.AppendLine(FormatLineString(' ', "preference set", "trial", "dimensions", "skyline size", "time total", "time algorithm", "min correlation", "max correlation", "product cardinality", "number of moves", "number of comparisons")); } sb.AppendLine(strSeparatorLine); Debug.Write(sb); } List<long> reportDimensions = new List<long>(); List<long> reportSkylineSize = new List<long>(); List<long> reportTimeTotal = new List<long>(); List<long> reportTimeAlgorithm = new List<long>(); List<long> reportNumberOfMoves = new List<long>(); List<long> reportNumberOfComparisons = new List<long>(); List<double> reportMinCorrelation = new List<double>(); List<double> reportMaxCorrelation = new List<double>(); List<double> reportCardinality = new List<double>(); var perfSampling = new PerformanceSampling(SamplingSubsetsCount, SamplingSubsetDimension, SamplingSamplesCount, ExcessiveTests); //For each preference set in the preference list for (int iPreferenceIndex = 0; iPreferenceIndex < listPreferences.Count; iPreferenceIndex++) { ArrayList preferences = (ArrayList)listPreferences[iPreferenceIndex]; //Go only down two 3 dimension (because there are special algorithms for 1 and 2 dimensional skyline) //for (int i = MinDimensions; i <= preferences.Count; i++) //{ //ADD Preferences to SKYLINE ArrayList subPreferences = preferences; //.GetRange(0, i); string strSkylineOf = "SKYLINE OF " + string.Join(",", (string[])subPreferences.ToArray(Type.GetType("System.String"))); //SELECT FROM string strSQL = "SELECT cars.id FROM "; if (TableSize == Size.Small) { strSQL += "cars_small"; } else if (TableSize == Size.Medium) { strSQL += "cars_medium"; } else if (TableSize == Size.Large) { strSQL += "cars_large"; } if (!UseNormalizedValues) { strSQL += " cars "; } else { strSQL += "cars_normalized cars "; } //Add Joins strSQL += GetJoinsForPreferences(strSkylineOf); //Add Skyline-Clause strSQL += strSkylineOf; //Convert to real SQL parser = new SQLCommon(); parser.SkylineType = currentStrategy; parser.ShowInternalAttributes = true; parser.WindowHandling = WindowHandling; parser.WindowSort = WindowSort; if (GenerateScript == false) { for (int iTrial = 0; iTrial < Trials; iTrial++) { Stopwatch sw = new Stopwatch(); try { double minCorrelation = 0; double maxCorrelation = 0; SearchCorrelation(subPreferences, correlationMatrix, ref minCorrelation, ref maxCorrelation); double cardinality = SearchCardinality(subPreferences, listCardinality); long timeAlgorithm = 0; long skylineSize = 0; long numberOfMoves = 0; long numberOfComparisons = 0; if (Sampling) { string strTrial = iTrial + 1 + " / " + _trials; string strPreferenceSet = iPreferenceIndex + 1 + " / " + listPreferences.Count; Console.WriteLine(strPreferenceSet); string strLine = perfSampling.MeasurePerformance(iTrial, iPreferenceIndex, listPreferences, preferences, parser, sw, reportDimensions, reportSkylineSize, reportTimeTotal, reportTimeAlgorithm, reportMinCorrelation, reportMaxCorrelation, minCorrelation, maxCorrelation, reportCardinality, cardinality, strSQL, strPreferenceSet, strTrial, reportNumberOfMoves, numberOfMoves, reportNumberOfComparisons, numberOfComparisons); Debug.WriteLine(strLine); sb.AppendLine(strLine); } else { sw.Start(); ArrayList clauseID = new ArrayList(); String strIDs = ""; for (int skylineLevel = 1; skylineLevel <= SkylineUpToLevel; skylineLevel++) { if (UseCLR) { string strSP = parser.ParsePreferenceSQL(strSQL); SqlDataAdapter dap = new SqlDataAdapter(strSP, cnnSQL); dt.Clear(); //clear datatable dap.Fill(dt); } else { parser.Cardinality = (long)cardinality; string strSQLWithWHERE = strSQL; strSQLWithWHERE = strSQL.Substring(0, strSQL.IndexOf("SKYLINE OF")); strSQLWithWHERE += strIDs; strSQLWithWHERE += strSQL.Substring(strSQL.IndexOf("SKYLINE OF")); dt = parser.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, strSQLWithWHERE); } timeAlgorithm += parser.TimeInMilliseconds; numberOfMoves += parser.NumberOfMoves; numberOfComparisons += parser.NumberOfComparisons; skylineSize += dt.Rows.Count; //only if more queries are requested if (skylineLevel < SkylineUpToLevel && currentStrategy.GetType() != typeof(prefSQL.SQLSkyline.MultipleSkylineBNL)) { //Add ids to WHERE clause foreach (DataRow row in dt.Rows) { clauseID.Add((int)row[0]); } //Add WHERE clause with IDs that were already in the skyline strIDs = ""; foreach (int id in clauseID) { strIDs += id + ","; } if (strIDs.Length > 0) { strIDs = "WHERE cars.id NOT IN (" + strIDs.TrimEnd(',') + ") "; } } else { skylineLevel = SkylineUpToLevel; } } sw.Stop(); reportDimensions.Add(preferences.Count); reportSkylineSize.Add(skylineSize); reportTimeTotal.Add(sw.ElapsedMilliseconds); reportTimeAlgorithm.Add(timeAlgorithm); reportNumberOfMoves.Add(numberOfMoves); reportNumberOfComparisons.Add(numberOfComparisons); reportMinCorrelation.Add(minCorrelation); reportMaxCorrelation.Add(maxCorrelation); reportCardinality.Add(cardinality); //trial|dimensions|skyline size|time total|time algorithm string strTrial = iTrial + 1 + " / " + _trials; string strPreferenceSet = iPreferenceIndex + 1 + " / " + listPreferences.Count; Console.WriteLine(strPreferenceSet); string strLine = ""; //Was there an error? if (dt.Rows.Count == 0) { strLine = FormatLineString("Error! " + strPreferenceSet, strTrial, preferences.Count, dt.Rows.Count, sw.ElapsedMilliseconds, timeAlgorithm, minCorrelation, maxCorrelation, cardinality, numberOfMoves, numberOfComparisons); } else { strLine = FormatLineString(strPreferenceSet, strTrial, preferences.Count, dt.Rows.Count, sw.ElapsedMilliseconds, timeAlgorithm, minCorrelation, maxCorrelation, cardinality, numberOfMoves, numberOfComparisons); } Debug.WriteLine(strLine); sb.AppendLine(strLine); } } catch (Exception e) { Debug.WriteLine(e.Message); return; } } } else { strSQL = parser.ParsePreferenceSQL(strSQL); string[] sizes = { "small", "medium", "large", "superlarge" }; //Format for each of the customer profiles sb.AppendLine("PRINT '----- -------------------------------------------------------- ------'"); sb.AppendLine("PRINT '----- " + (preferences.Count + 1) + " dimensions ------'"); sb.AppendLine("PRINT '----- -------------------------------------------------------- ------'"); foreach (string size in sizes) { sb.AppendLine("GO"); //we need this in order the profiler shows each query in a new line sb.AppendLine(strSQL.Replace("cars", "cars_" + size)); } } //} } //////////////////////////////// //Summary /////////////////////////////// if (GenerateScript == false) { if (Sampling) { perfSampling.AddSummary(sb, strSeparatorLine, reportDimensions, reportSkylineSize, reportTimeTotal, reportTimeAlgorithm, reportMinCorrelation, reportMaxCorrelation, reportCardinality, reportNumberOfMoves, reportNumberOfComparisons); perfSampling.AddPreferenceSetInformation(sb, listPreferences, strSeparatorLine); } else { AddSummary(sb, strSeparatorLine, reportDimensions, reportSkylineSize, reportTimeTotal, reportTimeAlgorithm, reportMinCorrelation, reportMaxCorrelation, reportCardinality, reportNumberOfMoves, reportNumberOfComparisons); } } //Write some empty lines (clarification in output window) Debug.WriteLine(""); Debug.WriteLine(""); Debug.WriteLine(""); //Write in file string strFiletype; if (GenerateScript == false) { strFiletype = ".txt"; } else { strFiletype = ".sql"; } //create filename string strFileName = Path + Set.ToString() + "_" + Mode.ToString() + "_" + MinDimensions + "_" + MaxDimensions + "_" + currentStrategy + DateTime.Now.Ticks + strFiletype; StreamWriter outfile = new StreamWriter(strFileName); outfile.Write(sb.ToString()); outfile.Close(); } //close connection if (UseCLR) { cnnSQL.Close(); } }
public void TestSkylineAmountOfTupelsDataTable() { string skylineSampleSql = TestContext.DataRow["skylineSQL"].ToString(); SQLCommon common = new SQLCommon(); common.SkylineType = new SkylineSQL(); PrefSQLModel model = common.GetPrefSqlModelFromPreferenceSql(skylineSampleSql); DataTable dtNative = common.ExecuteFromPrefSqlModel(Helper.ConnectionString, Helper.ProviderName, model); common.SkylineType = new SkylineBNL(); DataTable dtBNL = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql); common.SkylineType = new SkylineBNLSort(); DataTable dtBNLSort = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql); DataTable dtHexagon = new DataTable(); if (model.ContainsOpenPreference == false) { common.SkylineType = new SkylineHexagon(); dtHexagon = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql); } DataTable dtDQ = new DataTable(); //D&Q does not work with incomparable tuples if (model.WithIncomparable == false) { common.SkylineType = new SkylineDQ(); dtDQ = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, skylineSampleSql); } int currentDataRowIndex = TestContext.DataRow.Table.Rows.IndexOf(TestContext.DataRow); //Check tuples (every algorithm should deliver the same amount of tuples) Assert.AreEqual(dtNative.Rows.Count, dtBNL.Rows.Count, 0, "BNL Amount of tupels in query " + currentDataRowIndex + " do not match"); Assert.AreEqual(dtNative.Rows.Count, dtBNLSort.Rows.Count, 0, "BNLSort Amount of tupels in query " + currentDataRowIndex + " do not match"); //Hexagon cannot handle Categorical preference that have no explicit OTHERS if (model.ContainsOpenPreference == false) { Assert.AreEqual(dtNative.Rows.Count, dtHexagon.Rows.Count, 0, "Hexagon Amount of tupels in query " + currentDataRowIndex + " do not match"); } //D&Q does not work with incomparable tuples if (model.WithIncomparable == false) { Assert.AreEqual(dtNative.Rows.Count, dtDQ.Rows.Count, 0, "D&Q Amount of tupels in query " + currentDataRowIndex + " do not match"); } }
public void TestIssue54() { string prefSQL = "SELECT c.Title AS Name, c.Price, c.Consumption, m.Name AS Manufacturer, b.Name AS Body " + "FROM Cars c " + "LEFT OUTER JOIN Makes m ON c.Make_Id = m.Id " + "LEFT OUTER JOIN Bodies b ON c.Body_Id = b.Id " + "WHERE m.Name = 'VW' AND b.Name = 'Bus' " + "SKYLINE OF c.Price LOW 1000 EQUAL, c.Consumption LOW"; var common = new SQLCommon { SkylineType = new SkylineBNL(), ShowInternalAttributes = true }; try { //If there is no exception in the execution of this query the test is successful DataTable dt = common.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, prefSQL); Assert.IsTrue(true); } catch { Assert.IsFalse(true); } }
public void Run() { try { //SKYLINE Queries //string strPrefSQL = "SELECT t.id FROM cars t SKYLINE OF t.price LOW, t.mileage LOW"; //string strPrefSQL = "select cars.id from cars"; //string strPrefSQL = "SELECT * FROM cars t WHERE t.doors = 5 SKYLINE OF t.price LOW, t.mileage LOW, t.horsepower HIGH, t.consumption LOW, t.registrationnumeric HIGH"; //string strPrefSQL = "SELECT t.title AS Modellname, t.price AS Preis, t.consumption AS Verbrauch FROM cars t LEFT OUTER JOIN Makes m ON t.make_id = m.id LEFT OUTER JOIN Bodies b ON t.body_id = b.id WHERE m.name = 'VW' AND b.name = 'Bus' SKYLINE OF t.price LOW 1000 EQUAL, t.consumption LOW"; //string strPrefSQL = "SELECT t.id, t.title, t.price, c.name, t.enginesize FROM cars t LEFT OUTER JOIN colors c ON t.color_id = c.id SKYLINE OF t.price LOW, c.name ('pink' >> 'black' >> OTHERS INCOMPARABLE), t.enginesize HIGH ORDER BY BEST_RANK()"; //string strPrefSQL = "SELECT t.id, t.title, t.price, c.name, t.enginesize FROM cars t LEFT OUTER JOIN colors c ON t.color_id = c.id SKYLINE OF t.price LOW, c.name (OTHERS EQUAL >> 'pink' >> 'red'), t.enginesize HIGH ORDER BY SUM_RANK()"; //string strPrefSQL = "SELECT t.id, t.title, t.price FROM cars t SKYLINE OF t1.price LOW, t1.mileage LOW ORDER BY BEST_RANK()"; //string strPrefSQL = "SELECT t.id, t.price, t.mileage FROM cars t SKYLINE OF t1.price LOW, t1.mileage LOW ORDER BY SUM_RANK()"; //string strPrefSQL = "SELECT t.id, t.title, bodies.name AS Chassis, t.price, fuels.name FROM cars t LEFT OUTER JOIN fuels ON t.fuel_id = fuels.ID LEFT OUTER JOIN bodies ON t.body_id = bodies.ID SKYLINE OF bodies.name ('bus' >> OTHERS EQUAL) IS MORE IMPORTANT THAN t.price LOW, fuels.name ('petrol' >> OTHERS EQUAL)"; //string strPrefSQL = "SELECT t.id, t.title, t.price, t.mileage, t.enginesize FROM cars t SKYLINE OF t.mileage LOW IS MORE IMPORTANT THAN t.price LOW, t.engineszie HIGH "; //SKYLINE Queries with JOINS //string strPrefSQL = "SELECT c.id, c.price, b.name FROM cars t LEFT OUTER JOIN bodies b ON c.body_id = b.ID SKYLINE OF c.price LOW, b.name ('Bus' >> 'Kleinwagen')"; //string strPrefSQL = "SELECT c.id, c.price FROM cars t LEFT OUTER JOIN colors cc ON c.color_id = cc.id SKYLINE OF c.horsepower HIGH, cc.name ('red' >> 'blue' >> 'yellow')"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, colors.name ('red' >> 'blue' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW, t1.cylinders HIGH, colors.name ('red' >> 'blue' >> 'yellow' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW, t1.cylinders HIGH"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.pric FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name ('red' >> 'blue' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name (OTHERS INCOMPARABLE >> 'blue' >> 'red')"; //string strPrefSQL = "SELECT c.id, c.price FROM cars t LEFT OUTER JOIN colors cc ON c.color_id = cc.id LEFT OUTER JOIN fuels f ON f.id = c.fuel_id SKYLINE OF c.price LOW 1000 INCOMPARABLE, cc.name ('red' == 'blue' >> OTHERS INCOMPARABLE >> 'gray'), f.name ('petrol' >> OTHERS INCOMPARABLE >> 'diesel')"; //string strPrefSQL = "SELECT c.title AS Name, c.Price FROM cars t LEFT OUTER JOIN colors co ON c.color_id = co.ID LEFT OUTER JOIN bodies b ON c.body_id = b.ID SKYLINE OF c.Price LOW, c.Mileage LOW"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name ('silver' >> 'yellow' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t.id, t.title, t.price FROM cars t LEFT OUTER JOIN colors ON t.color_id = colors.id SKYLINE OF t.price LOW, t.mileage LOW, colors.name ('red' >> {'blue', 'yellow'} >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t.id FROM cars t LEFT OUTER JOIN bodies ON t.body_id = bodies.ID LEFT OUTER JOIN colors ON colors.id = t.color_id SKYLINE OF t.price AROUND 10000, colors.name ('red' >> OTHERS EQUAL), bodies.name ('van' >> 'compact car' >> OTHERS EQUAL) ORDER BY BEST_RANK()"; //RANKING Queries string strPrefSQL = "SELECT t.id, t.title FROM cars t ORDER BY WEIGHTEDSUM (t.price LOW 0.8, t.mileage LOW 0.2)"; //string strPrefSQL = "SELECT t.id, t.title FROM cars t LEFT OUTER JOIN colors c ON t.color_id = c.id ORDER BY WEIGTHEDSUM (t.price LOW 0.5, c.name ('brown' >> 'green' >> OTHERS EQUAL) 0.5)"; //Playground --> Test here your queries //string strPrefSQL = "SELECT c.id, c.price, b.name FROM cars_small c LEFT OUTER JOIN bodies b ON c.body_id = b.ID SKYLINE OF c.price LOW, b.name ('Bus' >> 'Kleinwagen')"; //string strPrefSQL = "SELECT c.id, c.price FROM cars_small c LEFT OUTER JOIN colors cc ON c.color_id = cc.id ORDER BY WEIGHTEDSUM (c.price LOW 0.5, cc.name ('brown' >> 'green') 0.5)"; //string strPrefSQL = "SELECT c.id, c.price FROM cars_small c LEFT OUTER JOIN colors cc ON c.color_id = cc.id SKYLINE OF c.horsepower HIGH, cc.name ('red' >> 'blue' >> 'yellow')"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars_small t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, colors.name ('red' >> 'blue' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id FROM cars t1 ORDER BY WEIGHTEDSUM (t1.price HIGH 0.5, t1.mileage HIGH 0.5, t1.horsepower LOW 0.5, t1.enginesize LOW 0.5, t1.consumption HIGH 0.5, t1.doors LOW 0.5, t1.cylinders LOW 0.5)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW, t1.cylinders HIGH, colors.name ('red' >> 'blue' >> 'yellow' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW ORDER BY BEST_RANK()"; //string strPrefSQL = "SELECT t1.id FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW"; //string strPrefSQL = "SELECT cars.id, cars.consumption FROM cars SKYLINE OF cars.consumption LOW, cars.enginesize HIGH, cars.price LOW"; //string strPrefSQL = "SELECT * FROM cars SKYLINE OF cars.registrationnumeric HIGH, cars.mileage LOW, cars.horsepower HIGH 100 EQUAL"; //string strPrefSQL = "SELECT cars.id, cars.horsepower FROM cars SKYLINE OF cars.horsepower HIGH, cars.mileage LOW"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW, t1.cylinders HIGH"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price, t1.mileage, t1.enginesize FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW, t1.enginesize HIGH ORDER BY SUM_RANK()"; //string strPrefSQL = "SELECT t1.id FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW, t1.cylinders HIGH"; //string strPrefSQL = "SELECT t1.id FROM cars_norm t1 SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower LOW, t1.enginesize LOW, t1.doors LOW, t1.consumption LOW, t1.cylinders LOW"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW ORDER BY BEST_RANK()"; //string strPrefSQL = "SELECT t1.id AS ID, t1.title, t1.price FROM cars_small t1 SKYLINE OF t1.price LOW, t1.title ('hans' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price, t1.mileage, colors.name FROM cars_small t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name ('red' >> 'blue' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price, t1.mileage, colors.name FROM cars_small t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name (OTHERS INCOMPARABLE >> 'blue' >> 'red')"; //string strPrefSQL = "SELECT * FROM cars_small cs SKYLINE OF cs.price LOW, cs.mileage LOW SAMPLE BY RANDOM_SUBSETS COUNT 2 DIMENSION 1"; //string strPrefSQL = "SELECT t1.id, t1.price, t1.mileage FROM cars_small t1 SKYLINE OF t1.price LOW, t1.mileage LOW"; //string strPrefSQL = "SELECT t1.id, t1.price, t1.mileage FROM cars_small t1 SKYLINE OF t1.price LOW, t1.mileage LOW ORDER BY SUM_RANK()"; //string strPrefSQL = "SELECT t1.id FROM cars t1 SKYLINE OF t1.price LOW, t1.mileage LOW, t1.horsepower HIGH, t1.enginesize HIGH, t1.doors HIGH, t1.consumption LOW"; //string strPrefSQL = "SELECT c.id, c.price FROM cars_medium c LEFT OUTER JOIN colors cc ON c.color_id = cc.id LEFT OUTER JOIN fuels f ON f.id = c.fuel_id SKYLINE OF c.price LOW 1000 INCOMPARABLE, cc.name ('red' == 'blue' >> OTHERS INCOMPARABLE >> 'gray'), f.name ('petrol' >> OTHERS INCOMPARABLE >> 'diesel')"; //string strPrefSQL = "SELECT c.title AS Name, c.Price, c.Mileage, co.Name AS Color, b.Name AS Body FROM Cars AS c LEFT OUTER JOIN colors co ON c.color_id = co.ID LEFT OUTER JOIN bodies b ON c.body_id = b.ID SKYLINE OF c.Price LOW, c.Mileage LOW"; //string strPrefSQL = "SELECT t.id FROM cars t SKYLINE OF t.price LOW, t.mileage LOW"; //string strPrefSQL = "SELECT t1.id, t1.title, t1.price, colors.name FROM cars t1 LEFT OUTER JOIN colors ON t1.color_id = colors.ID WHERE t1.price < 10000 SKYLINE OF t1.price LOW, colors.name ('silver' >> 'yellow' >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT cars.id, cars.title FROM cars SKYLINE OF cars.price LOW,cars.mileage LOW,cars.horsepower HIGH,cars.enginesize HIGH,cars.consumption LOW,cars.doors HIGH,cars.seats HIGH"; //string strPrefSQL = "SELECT t.id, t.title, t.price, colors.name AS colour FROM cars t LEFT OUTER JOIN colors ON t.color_id = colors.id SKYLINE OF t.price LOW, t.mileage LOW, colors.name ('red' >> {'blue', 'yellow'} >> OTHERS INCOMPARABLE)"; //string strPrefSQL = "SELECT t.id, t.title FROM cars t ORDER BY WEIGHTEDSUM (t.price LOW 0.8, t.mileage LOW 0.2)"; //string strPrefSQL = "SELECT t.id, t.title FROM cars t ORDER BY WEIGHTEDSUM( t.price LOW 0.8, t.mileage LOW 0.2)"; //Query that results in more than 4000 Characters /*string strPrefSQL = "SELECT t1.id , t1.title , t1.price , t1.mileage , colors.name FROM cars_small t1 " + "LEFT OUTER JOIN colors ON t1.color_id = colors.ID " + "LEFT OUTER JOIN bodies ON t1.body_id = bodies.id " + "LEFT OUTER JOIN Conditions ON t1.Condition_Id = Conditions.Id " + "LEFT OUTER JOIN Models ON t1.Model_Id = Models.Id " + "LEFT OUTER JOIN Makes ON t1.Make_Id = Makes.Id " + "LEFT OUTER JOIN Drives ON t1.Drive_Id = Drives.Id " + "LEFT OUTER JOIN Efficiencies ON t1.Efficiency_Id = Efficiencies.Id " + "LEFT OUTER JOIN Pollutions ON t1.Pollution_Id = Pollutions.Id " + "LEFT OUTER JOIN Transmissions ON t1.Transmission_Id = Transmissions.Id " + "LEFT OUTER JOIN Fuels ON t1.Fuel_Id = Fuels.Id " + "WHERE t1.price < 10000 " + "SKYLINE OF " + "t1.price LOW " + ", colors.name " + "(" + "'anthracite' >> 'beige' >> 'blue' >> 'bordeaux' >> " + " 'brown' >> 'yellow' >> 'gold' >> 'gray' >> 'green' >> " + " 'orange' >> 'pink' >> 'red' >> 'black' >> 'silver' >> " + " 'turquoise' >> 'violet' >> 'white'" + ") " + ", bodies.name " + "(" + " 'bus' >> 'cabriolet' >> 'coupé' >> 'van' >> " + " 'compact car' >> 'estate car' >> 'minivan' >> " + " 'limousine' >> 'pick-up' >> 'scooter' >> 'suv' " + ")" + ", fuels.name " + "(" + " 'hybrid' >> 'bioethanol' >> 'diesel' >> 'gas' >> " + " 'electro' >> 'petrol' " + ")";*/ //Query with 2 id spalten //string strPrefSQL = "SELECT t.id, colors.id as colorid, t.title, t.price, colors.name AS colour FROM cars t LEFT OUTER JOIN colors ON t.color_id = colors.id SKYLINE OF t.price LOW, t.mileage LOW, colors.name ('red' >> 'blue' >> OTHERS EQUAL)"; Debug.WriteLine(strPrefSQL); SQLCommon parser = new SQLCommon(); //Choose here your algorithm parser.SkylineType = new SkylineSQL(); //parser.SkylineType = new SkylineBNL(); //parser.SkylineType = new SkylineBNLSort(); //parser.SkylineType = new SkylineHexagon(); //parser.SkylineType = new SkylineDQ(); //parser.SkylineType = new MultipleSkylineBNL(); //parser.SkylineType = new SkylineDecisionTree(); //Some other available properties parser.ShowInternalAttributes = true; parser.SkylineUpToLevel = 1; //First parse only (to get the parsed string for CLR) Debug.WriteLine(parser.ParsePreferenceSQL(strPrefSQL)); //Now parse and execute Stopwatch sw = new Stopwatch(); sw.Start(); DataTable dt = parser.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, strPrefSQL); sw.Stop(); StringBuilder sb = new StringBuilder(); sb.AppendLine("------------------------------------------"); sb.AppendLine("STATISTIC"); sb.AppendLine("------------------------------------------"); sb.AppendLine(" skyline size:" + dt.Rows.Count.ToString().PadLeft(6)); sb.AppendLine(" fields:" + dt.Columns.Count.ToString().PadLeft(6)); sb.AppendLine("algo time elapsed ms:" + parser.TimeInMilliseconds.ToString().PadLeft(6)); sb.AppendLine("total time elapsed ms:" + sw.ElapsedMilliseconds.ToString().PadLeft(6)); Debug.Write(sb); } catch (Exception ex) { Debug.WriteLine("ERROR: " + ex); } Environment.Exit(0); }
internal string MeasurePerformance(int iTrial, int iPreferenceIndex, ArrayList listPreferences, ArrayList preferences, SQLCommon parser, Stopwatch sw, List<long> reportDimensions, List<long> reportSkylineSize, List<long> reportTimeTotal, List<long> reportTimeAlgorithm, List<double> reportMinCorrelation, List<double> reportMaxCorrelation, double minCorrelation, double maxCorrelation, List<double> reportCardinality, double cardinality, string strSQL, string strPreferenceSet, string strTrial, List<long> reportNumberOfMoves, long numberOfMoves, List<long> reportNumberOfComparisons, long numberOfComparisons) { Dictionary<ClusterAnalysis, List<List<double>>> clusterAnalysis; Dictionary<ClusterAnalysis, List<List<double>>> clusterAnalysisMedian; Dictionary<ClusterAnalysis, Dictionary<BigInteger, List<double>>> clusterAnalysisTopBuckets; Dictionary<ClusterAnalysis, Dictionary<BigInteger, List<double>>> clusterAnalysisMedianTopBuckets; List<IEnumerable<CLRSafeHashSet<int>>> producedSubsets = ProduceSubsets(preferences); InitClusterAnalysisDataStructures(out clusterAnalysis); InitClusterAnalysisDataStructures(out clusterAnalysisMedian); InitClusterAnalysisTopBucketsDataStructures( out clusterAnalysisTopBuckets); InitClusterAnalysisTopBucketsDataStructures( out clusterAnalysisMedianTopBuckets); var entireSkylineDataTable = new DataTable(); if (ExcessiveTests) { entireSkylineDataTable = parser.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, strSQL); } else { entireSkylineDataTable = parser.ParseAndExecutePrefSQL(Helper.ConnectionString, Helper.ProviderName, strSQL+ " SAMPLE BY RANDOM_SUBSETS COUNT " + SubsetsCount + " DIMENSION " + SubsetDimension); } List<long[]> entireDataTableSkylineValues = parser.SkylineType.Strategy.SkylineValues; int[] skylineAttributeColumns = SkylineSamplingHelper.GetSkylineAttributeColumns(entireSkylineDataTable); IReadOnlyDictionary<long, object[]> entireSkylineDatabase = prefSQL.SQLSkyline.Helper.GetDatabaseAccessibleByUniqueId( entireSkylineDataTable, 0); IReadOnlyDictionary<long, object[]> entireSkylineNormalized = prefSQL.SQLSkyline.Helper.GetDatabaseAccessibleByUniqueId( entireSkylineDataTable, 0); SkylineSamplingHelper.NormalizeColumns(entireSkylineNormalized, skylineAttributeColumns); DataTable entireDataTable; IReadOnlyDictionary<long, object[]> entireDatabaseNormalized = GetEntireDatabaseNormalized(parser, strSQL, skylineAttributeColumns, out entireDataTable); IReadOnlyDictionary<long, object[]> entireDatabase = prefSQL.SQLSkyline.Helper.GetDatabaseAccessibleByUniqueId( entireDataTable, 0); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> entireDatabaseBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets(entireDatabaseNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedEntireDatabaseBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(entireDatabaseBuckets); foreach ( KeyValuePair<BigInteger, List<IReadOnlyDictionary<long, object[]>>> s in entireDatabaseBuckets.OrderByDescending(l => l.Value.Count) .ThenBy(l => l.Key).Take(5)) { double percent = (double) s.Value.Count / entireDatabaseNormalized.Count; clusterAnalysisTopBuckets[ClusterAnalysis.EntireDb].Add(s.Key, new List<double>()); for (var i = 0; i < producedSubsets.Count; i++) // to enable generalized average calculation { clusterAnalysisTopBuckets[ClusterAnalysis.EntireDb][s.Key] .Add(percent); } } IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> entireSkylineBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets(entireSkylineNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedEntireSkylineBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(entireSkylineBuckets); FillTopBuckets(clusterAnalysisTopBuckets, ClusterAnalysis.EntireSkyline, entireSkylineBuckets, entireSkylineNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); foreach ( KeyValuePair<BigInteger, List<double>> bucket in clusterAnalysisTopBuckets[ClusterAnalysis.EntireSkyline]) { double percent = clusterAnalysisTopBuckets[ClusterAnalysis.EntireSkyline][ bucket.Key][0]; for (var i = 1; i < producedSubsets.Count; i++) // to enable generalized average calculation { clusterAnalysisTopBuckets[ClusterAnalysis.EntireSkyline][ bucket.Key].Add(percent); } } var clusterAnalysisForMedian = new prefSQL.Evaluation.ClusterAnalysis(entireDatabaseNormalized, skylineAttributeColumns); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> entireDatabaseMedianBuckets = clusterAnalysisForMedian.GetBuckets(entireDatabaseNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedEntireDatabaseMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(entireDatabaseMedianBuckets); foreach ( KeyValuePair<BigInteger, List<IReadOnlyDictionary<long, object[]>>> s in entireDatabaseMedianBuckets.OrderByDescending(l => l.Value.Count) .ThenBy(l => l.Key).Take(5)) { double percent = (double) s.Value.Count / entireDatabaseNormalized.Count; clusterAnalysisMedianTopBuckets[ClusterAnalysis.EntireDb].Add( s.Key, new List<double>()); for (var i = 0; i < producedSubsets.Count; i++) // to enable generalized average calculation { clusterAnalysisMedianTopBuckets[ClusterAnalysis.EntireDb][ s.Key] .Add(percent); } } IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> entireSkylineMedianBuckets = clusterAnalysisForMedian.GetBuckets(entireSkylineNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedEntireSkylineMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(entireSkylineMedianBuckets); FillTopBuckets(clusterAnalysisMedianTopBuckets, ClusterAnalysis.EntireSkyline, entireSkylineMedianBuckets, entireSkylineNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); foreach ( KeyValuePair<BigInteger, List<double>> bucket in clusterAnalysisMedianTopBuckets[ ClusterAnalysis.EntireSkyline]) { double percent = clusterAnalysisMedianTopBuckets[ ClusterAnalysis.EntireSkyline][bucket.Key][0]; for (var i = 1; i < producedSubsets.Count; i++) // to enable generalized average calculation { clusterAnalysisMedianTopBuckets[ ClusterAnalysis.EntireSkyline][bucket.Key].Add(percent); } } strSQL += " SAMPLE BY RANDOM_SUBSETS COUNT " + SubsetsCount + " DIMENSION " + SubsetDimension; string strQuery; string operators; int numberOfRecords; string[] parameter; PrefSQLModel prefSqlModel = parser.GetPrefSqlModelFromPreferenceSql(strSQL); string ansiSql = parser.GetAnsiSqlFromPrefSqlModel(prefSqlModel); prefSQL.SQLParser.Helper.DetermineParameters(ansiSql, out parameter, out strQuery, out operators, out numberOfRecords); var subsetObjects = new List<long>(); var subsetTime = new List<long>(); var subsetTimeElapsed = new List<long>(); var setCoverageSecondRandom = new List<double>(); var setCoverageSample = new List<double>(); var setCoverageBestRank = new List<double>(); var setCoverageSumRank = new List<double>(); var representationErrorSecondRandom = new List<double>(); var representationErrorSample = new List<double>(); var representationErrorBestRank = new List<double>(); var representationErrorSumRank = new List<double>(); var representationErrorSumSecondRandom = new List<double>(); var representationErrorSumSample = new List<double>(); var representationErrorSumBestRank = new List<double>(); var representationErrorSumSumRank = new List<double>(); var dominatedObjectsCountSecondRandom = new List<double>(); var dominatedObjectsCountSample = new List<double>(); var dominatedObjectsCountBestRank = new List<double>(); var dominatedObjectsCountSumRank = new List<double>(); var dominatedObjectsOfBestObjectSecondRandom = new List<double>(); var dominatedObjectsOfBestObjectSample = new List<double>(); var dominatedObjectsOfBestObjectBestRank = new List<double>(); var dominatedObjectsOfBestObjectSumRank = new List<double>(); var subsetCount = 1; foreach (IEnumerable<CLRSafeHashSet<int>> subset in producedSubsets) { Console.WriteLine(strPreferenceSet + " (" + subsetCount + " / " + producedSubsets.Count + ")"); sw.Restart(); var subsetsProducer = new FixedSkylineSamplingSubsetsProducer(subset); var utility = new SkylineSamplingUtility(subsetsProducer); var skylineSample = new SkylineSampling(utility) { SubsetCount = prefSqlModel.SkylineSampleCount, SubsetDimension = prefSqlModel.SkylineSampleDimension, SelectedStrategy = parser.SkylineType }; DataTable sampleSkylineDataTable = skylineSample.GetSkylineTable(strQuery, operators); sw.Stop(); subsetObjects.Add(sampleSkylineDataTable.Rows.Count); subsetTime.Add(skylineSample.TimeMilliseconds); subsetTimeElapsed.Add(sw.ElapsedMilliseconds); IReadOnlyDictionary<long, object[]> sampleSkylineDatabase = prefSQL.SQLSkyline.Helper.GetDatabaseAccessibleByUniqueId( sampleSkylineDataTable, 0); IReadOnlyDictionary<long, object[]> sampleSkylineNormalized = prefSQL.SQLSkyline.Helper.GetDatabaseAccessibleByUniqueId( sampleSkylineDataTable, 0); SkylineSamplingHelper.NormalizeColumns(sampleSkylineNormalized, skylineAttributeColumns); IReadOnlyDictionary<long, object[]> secondRandomSampleDatabase = new Dictionary<long, object[]>(); IReadOnlyDictionary<long, object[]> secondRandomSampleNormalized = new Dictionary<long, object[]>(); IReadOnlyDictionary<long, object[]> entireSkylineDataTableBestRankDatabase = new Dictionary<long, object[]>(); IReadOnlyDictionary<long, object[]> entireSkylineDataTableSumRankDatabase = new Dictionary<long, object[]>(); IReadOnlyDictionary<long, object[]> entireSkylineDataTableBestRankNormalized = new Dictionary<long, object[]>(); IReadOnlyDictionary<long, object[]> entireSkylineDataTableSumRankNormalized = new Dictionary<long, object[]>(); if (ExcessiveTests) { secondRandomSampleDatabase = SkylineSamplingHelper.GetRandomSample(entireSkylineDatabase, sampleSkylineDataTable.Rows.Count); var secondRandomSampleNormalizedToBeCreated = new Dictionary<long, object[]>(); foreach (KeyValuePair<long, object[]> k in secondRandomSampleDatabase) { var newValue = new object[k.Value.Length]; k.Value.CopyTo(newValue, 0); secondRandomSampleNormalizedToBeCreated.Add(k.Key, newValue); } secondRandomSampleNormalized = new ReadOnlyDictionary<long, object[]>( secondRandomSampleNormalizedToBeCreated); SkylineSamplingHelper.NormalizeColumns(secondRandomSampleNormalized, skylineAttributeColumns); entireSkylineDataTableBestRankNormalized = GetEntireSkylineDataTableRankNormalized(entireSkylineDataTable.Copy(), entireDataTableSkylineValues, skylineAttributeColumns, sampleSkylineDataTable.Rows.Count, 1, out entireSkylineDataTableBestRankDatabase); entireSkylineDataTableSumRankNormalized = GetEntireSkylineDataTableRankNormalized(entireSkylineDataTable.Copy(), entireDataTableSkylineValues, skylineAttributeColumns, sampleSkylineDataTable.Rows.Count, 2, out entireSkylineDataTableSumRankDatabase); IReadOnlyDictionary<long, object[]> baseRandomSampleNormalized = SkylineSamplingHelper.GetRandomSample(entireSkylineNormalized, sampleSkylineDataTable.Rows.Count); double setCoverageCoveredBySecondRandomSample = SetCoverage.GetCoverage( baseRandomSampleNormalized, secondRandomSampleNormalized, skylineAttributeColumns) * 100.0; double setCoverageCoveredBySkylineSample = SetCoverage.GetCoverage( baseRandomSampleNormalized, sampleSkylineNormalized, skylineAttributeColumns) * 100.0; double setCoverageCoveredByEntireBestRank = SetCoverage.GetCoverage( baseRandomSampleNormalized, entireSkylineDataTableBestRankNormalized, skylineAttributeColumns) * 100.0; double setCoverageCoveredByEntireSumRank = SetCoverage.GetCoverage(baseRandomSampleNormalized, entireSkylineDataTableSumRankNormalized, skylineAttributeColumns) * 100.0; setCoverageSecondRandom.Add(setCoverageCoveredBySecondRandomSample); setCoverageSample.Add(setCoverageCoveredBySkylineSample); setCoverageBestRank.Add(setCoverageCoveredByEntireBestRank); setCoverageSumRank.Add(setCoverageCoveredByEntireSumRank); Dictionary<long, double>.ValueCollection baseRepresentationErrorSecondRandomSample = SetCoverage .GetRepresentationError( GetReducedSkyline(entireSkylineNormalized, secondRandomSampleNormalized), secondRandomSampleNormalized, skylineAttributeColumns); Dictionary<long, double>.ValueCollection baseRepresentationErrorSkylineSample = SetCoverage.GetRepresentationError( GetReducedSkyline(entireSkylineNormalized, sampleSkylineNormalized), sampleSkylineNormalized, skylineAttributeColumns); Dictionary<long, double>.ValueCollection baseRepresentationErrorEntireBestRank = SetCoverage.GetRepresentationError( GetReducedSkyline(entireSkylineNormalized, entireSkylineDataTableBestRankNormalized), entireSkylineDataTableBestRankNormalized, skylineAttributeColumns); Dictionary<long, double>.ValueCollection baseRepresentationErrorEntireSumRank = SetCoverage.GetRepresentationError( GetReducedSkyline(entireSkylineNormalized, entireSkylineDataTableSumRankNormalized), entireSkylineDataTableSumRankNormalized, skylineAttributeColumns); representationErrorSecondRandom.Add(baseRepresentationErrorSecondRandomSample.Max()*100.0); representationErrorSample.Add(baseRepresentationErrorSkylineSample.Max() * 100.0); representationErrorBestRank.Add(baseRepresentationErrorEntireBestRank.Max() * 100.0); representationErrorSumRank.Add(baseRepresentationErrorEntireSumRank.Max() * 100.0); representationErrorSumSecondRandom.Add(baseRepresentationErrorSecondRandomSample.Sum() * 100.0); representationErrorSumSample.Add(baseRepresentationErrorSkylineSample.Sum() * 100.0); representationErrorSumBestRank.Add(baseRepresentationErrorEntireBestRank.Sum() * 100.0); representationErrorSumSumRank.Add(baseRepresentationErrorEntireSumRank.Sum() * 100.0); var dominatedObjectsCountRandomSample = new DominatedObjects(entireDatabase, secondRandomSampleDatabase, skylineAttributeColumns); var dominatedObjectsCountSampleSkyline = new DominatedObjects(entireDatabase, sampleSkylineDatabase, skylineAttributeColumns); var dominatedObjectsCountEntireSkylineBestRank = new DominatedObjects(entireDatabase, entireSkylineDataTableBestRankDatabase, skylineAttributeColumns); var dominatedObjectsCountEntireSkylineSumRank = new DominatedObjects(entireDatabase, entireSkylineDataTableSumRankDatabase, skylineAttributeColumns); dominatedObjectsCountSecondRandom.Add( dominatedObjectsCountRandomSample.NumberOfDistinctDominatedObjects); dominatedObjectsCountSample.Add( dominatedObjectsCountSampleSkyline.NumberOfDistinctDominatedObjects); dominatedObjectsCountBestRank.Add( dominatedObjectsCountEntireSkylineBestRank.NumberOfDistinctDominatedObjects); dominatedObjectsCountSumRank.Add( dominatedObjectsCountEntireSkylineSumRank.NumberOfDistinctDominatedObjects); dominatedObjectsOfBestObjectSecondRandom.Add( dominatedObjectsCountRandomSample .NumberOfObjectsDominatedByEachObjectOrderedByDescCount.First().Value); dominatedObjectsOfBestObjectSample.Add( dominatedObjectsCountSampleSkyline .NumberOfObjectsDominatedByEachObjectOrderedByDescCount.First().Value); dominatedObjectsOfBestObjectBestRank.Add( dominatedObjectsCountEntireSkylineBestRank .NumberOfObjectsDominatedByEachObjectOrderedByDescCount.First().Value); dominatedObjectsOfBestObjectSumRank.Add( dominatedObjectsCountEntireSkylineSumRank .NumberOfObjectsDominatedByEachObjectOrderedByDescCount.First().Value); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> sampleBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets(sampleSkylineNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedSampleBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(sampleBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> randomBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets(secondRandomSampleNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedRandomBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(randomBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> bestRankBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets( entireSkylineDataTableBestRankNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedBestRankBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets( bestRankBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> sumRankBuckets = prefSQL.Evaluation.ClusterAnalysis.GetBuckets( entireSkylineDataTableSumRankNormalized, skylineAttributeColumns); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedSumRankBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets( sumRankBuckets); FillTopBuckets(clusterAnalysisTopBuckets, ClusterAnalysis.SampleSkyline, sampleBuckets, sampleSkylineNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisTopBuckets, ClusterAnalysis.RandomSkyline, randomBuckets, secondRandomSampleNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisTopBuckets, ClusterAnalysis.BestRank, bestRankBuckets, entireSkylineDataTableBestRankNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisTopBuckets, ClusterAnalysis.SumRank, sumRankBuckets, entireSkylineDataTableSumRankNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> sampleMedianBuckets = clusterAnalysisForMedian.GetBuckets(sampleSkylineNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedSampleMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(sampleMedianBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> randomMedianBuckets = clusterAnalysisForMedian.GetBuckets(secondRandomSampleNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedRandomMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets(randomMedianBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> bestRankMedianBuckets = clusterAnalysisForMedian.GetBuckets( entireSkylineDataTableBestRankNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedBestRankMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets( bestRankMedianBuckets); IReadOnlyDictionary<BigInteger, List<IReadOnlyDictionary<long, object[]>>> sumRankMedianBuckets = clusterAnalysisForMedian.GetBuckets( entireSkylineDataTableSumRankNormalized, skylineAttributeColumns, true); IReadOnlyDictionary<int, List<IReadOnlyDictionary<long, object[]>>> aggregatedSumRankMedianBuckets = prefSQL.Evaluation.ClusterAnalysis.GetAggregatedBuckets( sumRankMedianBuckets); FillTopBuckets(clusterAnalysisMedianTopBuckets, ClusterAnalysis.SampleSkyline, sampleMedianBuckets, sampleSkylineNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisMedianTopBuckets, ClusterAnalysis.RandomSkyline, randomMedianBuckets, secondRandomSampleNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisMedianTopBuckets, ClusterAnalysis.BestRank, bestRankMedianBuckets, entireSkylineDataTableBestRankNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); FillTopBuckets(clusterAnalysisMedianTopBuckets, ClusterAnalysis.SumRank, sumRankMedianBuckets, entireSkylineDataTableSumRankNormalized.Count, entireDatabaseNormalized.Count, entireSkylineNormalized.Count); var caEntireDbNew = new List<double>(); var caEntireSkylineNew = new List<double>(); var caSampleSkylineNew = new List<double>(); var caRandomSkylineNew = new List<double>(); var caBestRankNew = new List<double>(); var caSumRankNew = new List<double>(); for (var ii = 0; ii < skylineAttributeColumns.Length; ii++) { int entireSkyline = aggregatedEntireSkylineBuckets.ContainsKey(ii) ? aggregatedEntireSkylineBuckets[ii].Count : 0; int sampleSkyline = aggregatedSampleBuckets.ContainsKey(ii) ? aggregatedSampleBuckets[ii].Count : 0; int randomSkyline = aggregatedRandomBuckets.ContainsKey(ii) ? aggregatedRandomBuckets[ii].Count : 0; double entireSkylinePercent = (double)entireSkyline / entireSkylineNormalized.Count; double sampleSkylinePercent = (double) sampleSkyline / sampleSkylineNormalized.Count; double randomSkylinePercent = (double)randomSkyline / secondRandomSampleNormalized.Count; int entireDb = aggregatedEntireDatabaseBuckets.ContainsKey(ii) ? aggregatedEntireDatabaseBuckets[ii].Count : 0; double entireDbPercent = (double) entireDb / entireDatabaseNormalized.Count; int bestRank = aggregatedBestRankBuckets.ContainsKey(ii) ? aggregatedBestRankBuckets[ii].Count : 0; int sumRank = aggregatedSumRankBuckets.ContainsKey(ii) ? aggregatedSumRankBuckets[ii].Count : 0; double bestRankPercent = (double) bestRank / entireSkylineDataTableBestRankNormalized.Count; double sumRankPercent = (double) sumRank / entireSkylineDataTableSumRankNormalized.Count; caEntireDbNew.Add(entireDbPercent); caEntireSkylineNew.Add(entireSkylinePercent); caSampleSkylineNew.Add(sampleSkylinePercent); caRandomSkylineNew.Add(randomSkylinePercent); caBestRankNew.Add(bestRankPercent); caSumRankNew.Add(sumRankPercent); } var caMedianEntireDbNew = new List<double>(); var caMedianEntireSkylineNew = new List<double>(); var caMedianSampleSkylineNew = new List<double>(); var caMedianRandomSkylineNew = new List<double>(); var caMedianBestRankNew = new List<double>(); var caMedianSumRankNew = new List<double>(); for (var ii = 0; ii < skylineAttributeColumns.Length; ii++) { int entireSkyline = aggregatedEntireSkylineMedianBuckets.ContainsKey(ii) ? aggregatedEntireSkylineMedianBuckets[ii].Count : 0; int sampleSkyline = aggregatedSampleMedianBuckets.ContainsKey(ii) ? aggregatedSampleMedianBuckets[ii].Count : 0; int randomSkyline = aggregatedRandomMedianBuckets.ContainsKey(ii) ? aggregatedRandomMedianBuckets[ii].Count : 0; double entireSkylinePercent = (double)entireSkyline / entireSkylineNormalized.Count; double sampleSkylinePercent = (double) sampleSkyline / sampleSkylineNormalized.Count; double randomSkylinePercent = (double)randomSkyline / secondRandomSampleNormalized.Count; int entireDb = aggregatedEntireDatabaseMedianBuckets.ContainsKey(ii) ? aggregatedEntireDatabaseMedianBuckets[ii].Count : 0; double entireDbPercent = (double) entireDb / entireDatabaseNormalized.Count; int bestRank = aggregatedBestRankMedianBuckets.ContainsKey(ii) ? aggregatedBestRankMedianBuckets[ii].Count : 0; int sumRank = aggregatedSumRankMedianBuckets.ContainsKey(ii) ? aggregatedSumRankMedianBuckets[ii].Count : 0; double bestRankPercent = (double) bestRank / entireSkylineDataTableBestRankNormalized.Count; double sumRankPercent = (double) sumRank / entireSkylineDataTableSumRankNormalized.Count; caMedianEntireDbNew.Add(entireDbPercent); caMedianEntireSkylineNew.Add(entireSkylinePercent); caMedianSampleSkylineNew.Add(sampleSkylinePercent); caMedianRandomSkylineNew.Add(randomSkylinePercent); caMedianBestRankNew.Add(bestRankPercent); caMedianSumRankNew.Add(sumRankPercent); } clusterAnalysis[ClusterAnalysis.EntireDb].Add(caEntireDbNew); clusterAnalysis[ClusterAnalysis.EntireSkyline].Add( caEntireSkylineNew); clusterAnalysis[ClusterAnalysis.SampleSkyline].Add( caSampleSkylineNew); clusterAnalysis[ClusterAnalysis.RandomSkyline].Add( caRandomSkylineNew); clusterAnalysis[ClusterAnalysis.BestRank].Add( caBestRankNew); clusterAnalysis[ClusterAnalysis.SumRank].Add( caSumRankNew); clusterAnalysisMedian[ClusterAnalysis.EntireDb].Add( caMedianEntireDbNew); clusterAnalysisMedian[ClusterAnalysis.EntireSkyline].Add( caMedianEntireSkylineNew); clusterAnalysisMedian[ClusterAnalysis.SampleSkyline].Add( caMedianSampleSkylineNew); clusterAnalysisMedian[ClusterAnalysis.RandomSkyline].Add( caMedianRandomSkylineNew); clusterAnalysisMedian[ClusterAnalysis.BestRank].Add( caMedianBestRankNew); clusterAnalysisMedian[ClusterAnalysis.SumRank].Add( caMedianSumRankNew); } subsetCount++; } Dictionary<ClusterAnalysis, string> clusterAnalysisStrings = GetClusterAnalysisStrings(skylineAttributeColumns, clusterAnalysis); Dictionary<ClusterAnalysis, string> clusterAnalysisMedianStrings = GetClusterAnalysisStrings(skylineAttributeColumns, clusterAnalysisMedian); Dictionary<ClusterAnalysis, string> clusterAnalysisTopBucketsStrings = GetClusterAnalysisTopBucketsStrings(clusterAnalysisTopBuckets, ExcessiveTests); Dictionary<ClusterAnalysis, string> clusterAnalysisMedianTopBucketsStrings = GetClusterAnalysisTopBucketsStrings(clusterAnalysisMedianTopBuckets, ExcessiveTests); var time = (long) (subsetTime.Average() + .5); var objects = (long) (subsetObjects.Average() + .5); var elapsed = (long) (subsetTimeElapsed.Average() + .5); Console.WriteLine("subsetTime"); foreach (var i in subsetTime) { Console.WriteLine(i); } Console.WriteLine(""); Console.WriteLine("subsetObjects"); foreach (var i in subsetObjects) { Console.WriteLine(i); } Console.WriteLine(""); reportDimensions.Add(preferences.Count); reportSkylineSize.Add(objects); reportTimeTotal.Add(elapsed); reportTimeAlgorithm.Add(time); reportMinCorrelation.Add(minCorrelation); reportMaxCorrelation.Add(maxCorrelation); reportCardinality.Add(cardinality); var setCoverageSingle = new Dictionary<SkylineTypesSingle, List<double>> { {SkylineTypesSingle.Random, setCoverageSecondRandom}, {SkylineTypesSingle.Sample, setCoverageSample}, {SkylineTypesSingle.BestRank, setCoverageBestRank}, {SkylineTypesSingle.SumRank, setCoverageSumRank} }; var representationErrorSingle = new Dictionary<SkylineTypesSingle, List<double>> { {SkylineTypesSingle.Random, representationErrorSecondRandom}, {SkylineTypesSingle.Sample, representationErrorSample}, {SkylineTypesSingle.BestRank, representationErrorBestRank}, {SkylineTypesSingle.SumRank, representationErrorSumRank} }; var representationErrorSumSingle = new Dictionary<SkylineTypesSingle, List<double>> { {SkylineTypesSingle.Random, representationErrorSumSecondRandom}, {SkylineTypesSingle.Sample, representationErrorSumSample}, {SkylineTypesSingle.BestRank, representationErrorSumBestRank}, {SkylineTypesSingle.SumRank, representationErrorSumSumRank} }; var dominatedObjectsCountSingle = new Dictionary<SkylineTypesSingle, List<double>>() { { SkylineTypesSingle.Random, dominatedObjectsCountSecondRandom }, { SkylineTypesSingle.Sample, dominatedObjectsCountSample }, { SkylineTypesSingle.BestRank, dominatedObjectsCountBestRank }, { SkylineTypesSingle.SumRank, dominatedObjectsCountSumRank } }; var dominatedObjectsOfBestObjectSingle = new Dictionary<SkylineTypesSingle, List<double>> { { SkylineTypesSingle.Random, dominatedObjectsOfBestObjectSecondRandom }, { SkylineTypesSingle.Sample, dominatedObjectsOfBestObjectSample }, { SkylineTypesSingle.BestRank, dominatedObjectsOfBestObjectBestRank }, { SkylineTypesSingle.SumRank, dominatedObjectsOfBestObjectSumRank } }; AddToReports(_reportsLong, subsetObjects, subsetTime, _reportsDouble); if (ExcessiveTests) { AddToSetCoverage(_setCoverage, setCoverageSingle); AddToSetCoverage(_representationError, representationErrorSingle); AddToSetCoverage(_representationErrorSum, representationErrorSumSingle); AddToSetCoverage(_dominatedObjectsCount, dominatedObjectsCountSingle); AddToSetCoverage(_dominatedObjectsOfBestObject, dominatedObjectsOfBestObjectSingle); } string strLine = FormatLineString(strPreferenceSet, strTrial, preferences.Count, objects, elapsed, time, subsetTime.Min(), subsetTime.Max(), MyMathematic.GetSampleVariance(subsetTime), MyMathematic.GetSampleStdDeviation(subsetTime), Mathematic.Median(subsetTime), Mathematic.LowerQuartile(subsetTime), Mathematic.UpperQuartile(subsetTime), subsetObjects.Min(), subsetObjects.Max(), MyMathematic.GetSampleVariance(subsetObjects), MyMathematic.GetSampleStdDeviation(subsetObjects), Mathematic.Median(subsetObjects), Mathematic.LowerQuartile(subsetObjects), Mathematic.UpperQuartile(subsetObjects), setCoverageSingle, representationErrorSingle, representationErrorSumSingle, dominatedObjectsCountSingle, dominatedObjectsOfBestObjectSingle, clusterAnalysisStrings, clusterAnalysisMedianStrings, clusterAnalysisTopBucketsStrings, clusterAnalysisMedianTopBucketsStrings, minCorrelation, maxCorrelation, cardinality, numberOfMoves, numberOfComparisons); return strLine; }