/// <summary>
        /// Runs the specialized generation algorithm.
        /// Propagetes constraints, searches for solutions and constructs timetables.
        /// </summary>
        /// <param name="constraints">The constraints.</param>
        /// <param name="constraintPropagator">The constraint propagator.</param>
        /// <param name="bestChoiceSearcher">The best choice searcher.</param>
        /// <returns>The timetables.</returns>
        public void runSpecializedGenerationAlgorithm(List <Constraint> constraints, IConstraintPropagator constraintPropagator,
                                                      IBestChoiceSearcher bestChoiceSearcher, List <Timetable> timetables)
        {
            // start time
            Stopwatch watch = new Stopwatch();

            watch.Start();

            // Propagate constraints with specific constraintPropagator
            PropagationResult propagationResult = constraintPropagator.runPropagationAlgorithm(constraints, GenerationAlgorithmDSAUtil.MODULO_DEFAULT);
            // Search for the solution with specific bestChoiceSearcher
            List <Solution> solutions = runSearchAlgorithm(bestChoiceSearcher, propagationResult);

            // finish time
            watch.Stop();
            TimeSpan runningTime = watch.Elapsed;

            // crete note for generated solutions
            String note = constraintPropagator.getDescription() + ", " + bestChoiceSearcher.getDescription();

            // Construct timetables from solutions generated above.
            runConstructionTimetableAlgorithm(solutions, propagationResult.TrainLinesMap, timetables, stepCount, note, runningTime);
        }
        /// <summary>
        /// Generates the timetables.
        /// </summary>
        public void generateTimetables(int numberOftimetables)
        {
            // initialize the algorithm
            List <Constraint> constraints;

            runInitializeAlgorithm(out constraints);

            // propagator with set creator will be choosen in this sequence
            IConstraintPropagator[] propagators = new IConstraintPropagator[]
            {
                new BisectionPropagator(new SameTransferTime()),
                new BisectionPropagator(new AlfaTTransferTime()),
                new SimplePropagator(new FullDiscreteSet()),
                new SimplePropagator(new FullDiscreteSet()),
            };

            // best searcher will be choosen in this sequence
            IBestChoiceSearcher[] creators = new IBestChoiceSearcher[]
            {
                new DeterministicSearcher(),
                new DeterministicSearcher(),
                new DeterministicSearcher(),
                new ProbableSearcher()
            };

            // new timetables
            this.timetables.Clear();
            List <Timetable> newTimetables = this.timetables;

            // shift for percentage complete
            double shift = 1 / (double)creators.Length;

            //
            percentageComplete = 0;

            Exception lastException = null;

            // each predefined combination do
            for (int i = 0, c = creators.Length; i < c; ++i)
            {
                try
                {
                    // step count
                    stepCount = 0;
                    // generation for this combination
                    runSpecializedGenerationAlgorithm(
                        constraints,
                        propagators[i],
                        creators[i],
                        newTimetables
                        );
                    // percentage is completed so far
                    percentageComplete += shift;
                    // if cancellation
                    if (IsCancelled)
                    {
                        break;
                    }
                } catch (Exception exception) {
                    lastException = exception;
                }
            }

            if (lastException != null)
            {
                throw lastException;
            }
        }