private void AppendStep(StepItemViewModel step)
        {
            System.Threading.Thread.CurrentThread.CurrentCulture   = System.Globalization.CultureInfo.InvariantCulture;
            System.Threading.Thread.CurrentThread.CurrentUICulture = System.Globalization.CultureInfo.InvariantCulture;

            var str = string.Format("{{{0}}}",
                                    string.Join(", ", _currentStep.Data.Select(res => string.Format("{{{0}}}", string.Join(",", res.coords)))));

            File.AppendAllText(stepsFilePath, str + Environment.NewLine);
        }
        private StepItemViewModel NextStep(int stepsCount)
        {
            var result   = _population.StepForward(stepsCount);
            var nextStep = new StepItemViewModel {
                Name         = String.Format("Step {0} Population count: {1}", (Steps.Items.Count + 1), _population.Count()),
                Data         = result,
                BestSolution = result.OrderBy(p => p.coords[2]).First().ToString()
            };

            return(nextStep);
        }
Esempio n. 3
0
        private StepItemViewModel NextStep(int stepsCount)
        {
            var result   = _population.StepForward(stepsCount);
            var nextStep = new StepItemViewModel {
                Name         = string.Format("Step {0} Population count: {1}", (Steps.Items.Count + 1), _population.Count()),
                BestSolution = string.Join(" ", result.Select(c => c.number + 1)),
                SumDistance  = CountSumDistance(result)
            };

            return(nextStep);
        }