public Cloud GetCloud() { IEnumerable <string> words = TextReader.Read(Configuration.Path); foreach (var filter in TagFilters) { words = filter.Manipulate(words); } var statisic = StatisticsGenerator.GetStatistics(words) .OrderByDescending(x => x.Coefficient) .Take(Configuration.NumberOfWordsInTheCloud) .ToArray(); var allWords = new List <Word>(); var dFont = Configuration.MaxFontSize - Configuration.MinFontSize; var minStat = statisic.Min(x => x.Coefficient); var maxStat = statisic.Max(x => x.Coefficient); var dCoef = maxStat - minStat; var d = dFont / dCoef; foreach (var tagStat in statisic) { //однозначное отображение коэффициаета на интервал шрифтов var fontSize = Configuration.MinFontSize + tagStat.Coefficient * d; var width = fontSize * tagStat.Value.Length; var height = fontSize; var rect = CloudLayouter.PutNextRectangle(new Size((int)(width), (int)(height))); allWords.Add(new Word(tagStat.Value, (int)fontSize, rect)); } return(new Cloud(allWords)); }
public DistributedBruteForceManager(KeySearcher keySearcher, KeyPattern.KeyPattern keyPattern, KeySearcherSettings settings, KeyQualityHelper keyQualityHelper, P2PQuickWatchPresentation quickWatch, KeyPoolTreePresentation keyPoolTreePresentation) { this.keySearcher = keySearcher; this.settings = settings; this.keyQualityHelper = keyQualityHelper; this.quickWatch = quickWatch; _keyPoolTreePresentation = keyPoolTreePresentation; // TODO when setting is still default (21), it is only displayed as 21 - but the settings-instance contains 0 for that key! if (settings.ChunkSize == 0) { settings.ChunkSize = 21; } StopWatch = new Stopwatch(); status = new StatusContainer(keySearcher); status.IsCurrentProgressIndeterminate = true; keyGenerator = new StorageKeyGenerator(keySearcher, settings); patternPool = new KeyPatternPool(keyPattern, new BigInteger(Math.Pow(2, settings.ChunkSize))); StatisticsGenerator = new StatisticsGenerator(status, quickWatch, keySearcher, settings, this); quickWatch.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(UpdateStatusContainerInQuickWatch)); _keyPoolTreePresentation.PatternPool = patternPool; _keyPoolTreePresentation.KeyQualityHelper = keyQualityHelper; _keyPoolTreePresentation.KeyGenerator = keyGenerator; _keyPoolTreePresentation.StatusContainer = status; }
public AboutOptionsPage() { InitializeComponent(); //linkLabel1.Links.Add(0, linkLabel1.Text.Length); lblVersion.Text = "v" + VS80AddIn.ADD_IN_VERSION; m_statsGenerator = new StatisticsGenerator(this); m_statsGenerator.Completed += new EventHandler(m_statsGenerator_Completed); richTextBox1.Rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fswiss\fcharset0 Arial;}} {\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\qc\f0\par\fs36 Android/VS\par \fs20 Visual Studio 2005 integration for AndroMDA \par \par (c)2007 AndroMDA - http://www.andromda.org/\par \par \b Primary Development\par \b0 Chris Micali <*****@*****.**>\par \par \b SchemaExport Code\par \b0 Naresh Bhatia\par Eric Crutchfield\par \par \b Testing and Feedback\b0\par Kapil Viren Ahuja\par Manish Agrawal\par Vaneet Kaur\par Karthick Pachiappan\par \b\par }"; }
//HELPERS protected override void write(StatisticsGenerator statisticsGenerator, string name, object value) { string line = string.Format(format, Timer.CurrentTime, statisticsGenerator.Identificator, name, value); line = line.Replace(' ', '.'); file.WriteLine(line); }
public TestHarness(ICheckableStream stream, StatisticsGenerator generator, int frameSize1, int frameSize2) { _stream = stream; _generator = generator; _frameSize1 = frameSize1; _frameSize2 = frameSize2; }
public void T26() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(78, Math.Round(actual.CashExpectancy, 2)); }
public void T25() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(0.73, Math.Round(actual.WinProbability, 2)); }
public void T24() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(427.33, Math.Round(actual.AverageUnrealisedProfitCash, 2)); }
public void T13() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(250.91, Math.Round(actual.AveragePointsWin, 2)); }
public void T6() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(1170, actual.CashTotal); }
public void T4() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(2, actual.LongestLosingStreak); }
public void T20() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(2.00, Math.Round(actual.AverageRiskRewardRatio, 2)); }
public void T18() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(510.67, Math.Round(actual.AverageMaximumFavourableExcursion, 2)); }
public void T17() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(39, Math.Round(actual.AverageMaximumAdverseExcursion, 2)); }
public void T16() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(0.78, Math.Round(actual.AverageDrawdown, 2)); }
public void T15() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(1.63, Math.Round(actual.ProfitFactor, 2)); }
public void T14() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(-293.75, Math.Round(actual.AveragePointsLoss, 2)); }
public void T10() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(-850, actual.BiggestCashLoss); }
public void T28() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(0.12, Math.Round(actual.Gain, 2)); }
public void T21() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(2.11, Math.Round(actual.AverageResultInR, 2)); }
public void T5() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(1585, actual.PointsTotal); }
public void T22() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(8.46, Math.Round(actual.AverageRealisedProfitPercentage, 2)); }
public void T7() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(260, actual.BiggestPointsWin); }
public void T12() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(-462.5, Math.Round(actual.AverageCashLoss, 2)); }
public void T2() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(4, actual.Loses); }
public void T1() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(11, actual.Wins); }
public void T23() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(326.67, Math.Round(actual.AverageUnrealisedProfitPoints, 2)); }
public void T11() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(274.55, Math.Round(actual.AverageCashWin, 2)); }
public void T27() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(105.67, Math.Round(actual.PointsExpectancy, 2)); }
public void T9() { // Arrange var actual = StatisticsGenerator.GetStatistics(_testTrades, 10000); // Assert Assert.Equal(-425, actual.BiggestPointsLoss); }
// // For statistical analysis only count the number of occurrences of each intrisic property. // private void CountIntrisicProperties(StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats) { foreach (GeometryTutorLib.ConcreteAST.GroundedClause clause in figure) { figureStats.totalImplicitFacts++; if (clause is GeometryTutorLib.ConcreteAST.Point) figureStats.numPoints++; else if (clause is GeometryTutorLib.ConcreteAST.InMiddle) figureStats.numInMiddle++; else if (clause is GeometryTutorLib.ConcreteAST.Segment) figureStats.numSegments++; else if (clause is GeometryTutorLib.ConcreteAST.Intersection) figureStats.numIntersections++; else if (clause is GeometryTutorLib.ConcreteAST.Triangle) figureStats.numTriangles++; else if (clause is GeometryTutorLib.ConcreteAST.Angle) figureStats.numAngles++; else if (clause is GeometryTutorLib.ConcreteAST.Quadrilateral) figureStats.numQuadrilaterals++; else if (clause is GeometryTutorLib.ConcreteAST.Circle) figureStats.numCircles++; else { Debug.WriteLine("Did not count " + clause); figureStats.totalImplicitFacts--; } } }
// // Given the problems with at least one assumption, construct ALL such combinations to form (I, G). // private void CalculateKnonStrictCardinalities(GeometryTutorLib.ProblemAnalyzer.InterestingProblemCalculator interestingCalculator, List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats) { // K-G container: index 0 is 1-G, index 1 is 2-G, etc. List<List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>> KmgProblems = new List<List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>>(); // // Create the new set of multigoal problems each with 1 goal: 1-G // List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> mgProblems = new List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>(); foreach (GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> problem in problems) { GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation> new1GProblem = new GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>(); new1GProblem.AddProblem(problem); mgProblems.Add(new1GProblem); } // Add the 1-G problems to the K-G problem set. KmgProblems.Add(mgProblems); // Construct all of the remaining CalculateKnonStrictCardinalities(KmgProblems, problems, ProofProblemFigureStatisticsAggregator.MAX_K); // // Now that we have 1, 2, ..., MAX_K -G multigoal problems, we must filter them. // That is, are the problems strictly interesting? // // Filtered K-G container: index 0 is 1-G, index 1 is 2-G, etc. List<List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>> filteredKmgProblems = new List<List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>>(); foreach (List<GeometryTutorLib.ProblemAnalyzer.MultiGoalProblem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> originalKgProblems in KmgProblems) { filteredKmgProblems.Add(interestingCalculator.DetermineStrictlyInterestingMultiGoalProblems(originalKgProblems)); } // Calculate the final numbers: counts of the k-G Strictly interesting problems. StringBuilder str = new StringBuilder(); for (int k = 1; k <= ProofProblemFigureStatisticsAggregator.MAX_K; k++) { figureStats.kGcardinalities[k] = filteredKmgProblems[k - 1].Count; str.AppendLine(k + "-G: " + figureStats.kGcardinalities[k]); } Debug.WriteLine(str); if (GeometryTutorLib.Utilities.PROBLEM_GEN_DEBUG) { Debug.WriteLine(str); } }
private void AppendToFiles(StatisticsGenerator.ShadedAreaFigureStatisticsAggregator figureStats) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\impFacts.txt", true)) { file.WriteLine(figureStats.totalImplicitFacts); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\expFacts.txt", true)) { file.WriteLine(figureStats.totalExplicitFacts); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\atomData.txt", true)) { file.WriteLine(figureStats.numAtomicRegions); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\numInteresting.txt", true)) { file.WriteLine(numInteresting); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\numShapes.txt", true)) { file.WriteLine(figureStats.numShapes); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\numRootShapes.txt", true)) { file.WriteLine(figureStats.numRootShapes); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\implicitTiming.txt", true)) { file.WriteLine(ImplicitTiming); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\geoTutorTiming.txt", true)) { file.WriteLine(DeductionTiming); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\solverTiming.txt", true)) { file.WriteLine(SolverTiming); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\length.txt", true)) { file.WriteLine(figureStats.length); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\width.txt", true)) { file.WriteLine(figureStats.width); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\areaFacts.txt", true)) { file.WriteLine(figureStats.numAreaFacts); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\geometricFacts.txt", true)) { file.WriteLine(figureStats.numGeometricFacts); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\numDeductions.txt", true)) { file.WriteLine(figureStats.numDeductions); } }
private void GeneratePaperQuery(List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats) { List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> sat = new List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>>(); int query = 0; int query2 = 0; int query3 = 0; int query4 = 0; foreach (GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> problem in problems) { bool WRITE_PROBLEMS = true; int width = problem.GetWidth(); int steps = problem.GetNumDeductiveSteps(); int depth = problem.GetLength(); if (6 <= steps && steps <= 10 && 4 <= width && width <= 8) { query++; if (WRITE_PROBLEMS) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\singleProblemQuery.txt", true)) { file.WriteLine(problem.ConstructProblemAndSolution(graph)); } } } //if (3 <= steps && steps <= 7 && graph.vertices[problem.goal].data is ConcreteAST.CongruentTriangles) //{ // query2++; // if (WRITE_PROBLEMS) // { // using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\queryProblems.txt", true)) // { // file.WriteLine(problem.ConstructProblemAndSolution(graph)); // } // } //} //if (steps >= 10 && graph.vertices[problem.goal].data is ConcreteAST.CongruentTriangles) //{ // query4++; //} //if (steps == 6 && depth == 4 && width == 5 && graph.vertices[problem.goal].data is ConcreteAST.CongruentTriangles) //{ // query3++; //} } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\teacherQuery.txt", true)) { file.WriteLine(query); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\queryStudent2.txt", true)) { file.WriteLine(query2); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\queryStudent3.txt", true)) { file.WriteLine(query3); } using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"C:\Users\ctalvin\Desktop\output\queryStudent4.txt", true)) { file.WriteLine(query4); } }
private void GenerateStrictIsomorphicStatistics(List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats) { // // Determine number of problems based on DIFFICULTY of the problems (easy, medium difficult, extreme) based on the number of deductions // // Construct the partitions: // 25% Easy // 50% Medium // 75% Difficult // 100% Extreme // GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector difficultyQuery = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDeductiveBasedIsomorphismQueryVector(GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructDifficultyPartitionBounds()); GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace difficultyBasedPartitions = new GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace(graph, difficultyQuery); difficultyBasedPartitions.ConstructPartitions(problems); figureStats.strictDifficultyPartitionSummary = difficultyBasedPartitions.GetDifficultyPartitionSummary(); // // Determine number of interesting problems based percentage of givens covered. // // Construct the partitions: // 0-2 Easy // 3-5 Medium // 6-10 Difficult // 10+ Extreme // GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector interestingQuery = GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingnessIsomorphismQueryVector(GeometryTutorLib.ProblemAnalyzer.QueryFeatureVector.ConstructInterestingPartitionBounds()); GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace interestingBasedPartitions = new GeometryTutorLib.ProblemAnalyzer.PartitionedProblemSpace(graph, interestingQuery); interestingBasedPartitions.ConstructPartitions(problems); figureStats.strictInterestingPartitionSummary = interestingBasedPartitions.GetInterestingPartitionSummary(); }
private void GenerateStrictAverages(List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats) { figureStats.totalStrictInterestingProblems = problems.Count; int totalWidth = 0; int totalLength = 0; int totalDeductiveSteps = 0; foreach (GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation> problem in problems) { totalWidth += problem.GetWidth(); totalLength += problem.GetLength(); totalDeductiveSteps += problem.GetNumDeductiveSteps(); } figureStats.strictAverageProblemWidth = ((double)(totalWidth)) / problems.Count; figureStats.strictAverageProblemLength = ((double)(totalLength)) / problems.Count; figureStats.strictAverageProblemDeductiveSteps = ((double)(totalDeductiveSteps)) / problems.Count; }
// // We may analyze the interesting problems constructing various partitions and queries // private void GenerateStatistics(List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> problems, StatisticsGenerator.ProofProblemFigureStatisticsAggregator figureStats, List<GeometryTutorLib.ProblemAnalyzer.Problem<GeometryTutorLib.Hypergraph.EdgeAnnotation>> strictlyInteresting) { GenerateAverages(problems, figureStats); GenerateIsomorphicStatistics(problems, figureStats); GenerateStrictAverages(strictlyInteresting, figureStats); GenerateStrictIsomorphicStatistics(strictlyInteresting, figureStats); GeneratePaperQuery(strictlyInteresting, figureStats); }