Ejemplo n.º 1
0
 public Search(DrawingBoard drawingBoard, SearchParameter Input, int method)
 {
     SearchInfo      = Input;
     DrawingBoard    = drawingBoard;
     Input.AllCities = new List <City>();
     this.method     = method;
 }
Ejemplo n.º 2
0
        public override List <State> ChildStates(State parentState)
        {
            List <Int16> unvisitedCities = FilterUnvisitedCities(parentState.path, SearchInfo.AllCities);
            List <State> childStates     = new List <State>();

            if (unvisitedCities.Count == 0)
            {
                return(ReturnBottomChild(parentState, childStates));
            }
            else
            {
                foreach (Int16 c in unvisitedCities)
                {
                    State child = (State)State.DeepClone(parentState);
                    child.AddCityToPath(SearchInfo.AllCities[c]);
                    if (SearchInfo.Visualize)
                    {
                        DrawingBoard.DrawPath(child, SearchInfo.AllCities);
                        Thread.Sleep(500);
                    }
                    child.Cost += City.TravelCostBetweenCities(SearchInfo.AllCities[child.path[child.path.Count - 2]], SearchInfo.AllCities[c]);
                    List <State> tmp = ChildStates(child);
                    foreach (State s in tmp)
                    {
                        childStates.Add(s);
                    }
                }
                return(childStates);
            }
        }
Ejemplo n.º 3
0
 public TSPWindow(DrawingBoard drawingBoard)
 {
     InitializeComponent();
     TSPWindow.drawingBoard        = drawingBoard;
     algorithmComboBox.DataSource  = Enum.GetValues(typeof(Search.Algorithm));
     drawingBoard.Visible          = true;
     returnToStartCheckBox.Checked = true;
     isMutatingCheckBox.Checked    = true;
     this.FormBorderStyle          = FormBorderStyle.FixedSingle;
     splitContainer1.Panel2.Controls.Add(drawingBoard);
     ShowOrHideGeneticSettings(false);
     drawingBoard.Show();
     InitHandlers();
 }
Ejemplo n.º 4
0
 public TSPAlgorithm(SearchParameter searchInfo, DrawingBoard drawingBoard)
 {
     SearchInfo   = searchInfo;
     DrawingBoard = drawingBoard;
 }
Ejemplo n.º 5
0
 public BruteForceDFS_TSPAlgorithm(SearchParameter searchInfo, DrawingBoard drawingBoard) : base(searchInfo, drawingBoard)
 {
 }
Ejemplo n.º 6
0
 private static void StartDrawingBoard()
 {
     drawingBoard = new DrawingBoard();
     tspWindow    = new TSPWindow(drawingBoard);
     Application.Run(tspWindow);
 }