Exemplo n.º 1
0
        public HybridAlgorithm(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            greedySearch     = new GreedySearch(graph, agentManager);
            geneticAlgorithm = new GeneticAlgorithm(graph, agentManager);

            initParamsWindow(new HybridAlgorithmParams(this));
        }
Exemplo n.º 2
0
        public AntColonyOptimization(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            currentIteration            = 1;
            actualDrawingMode           = DRAWING_MODE.MORE_AGENT_CIRCLES;
            moreAgentCirclesToHighlight = new List <List <Edge> >();
            antManager = new AntManager(agentManager.Agents[0].StartPosition, agentManager.Agents.Count, graph);

            initParamsWindow(new AntColonyOptimizationParams(this));
        }
Exemplo n.º 3
0
        public GeneticAlgorithm(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            startCity         = agentManager.Agents[0].StartPosition;
            numberOfCities    = graph.Vertices.Count;
            numberOfSalesmen  = agentManager.Agents.Count;
            actualGeneration  = 1;
            actualDrawingMode = DRAWING_MODE.MORE_AGENT_CIRCLES;

            initParamsWindow(new GeneticAlgorithmParams(this));
        }
Exemplo n.º 4
0
        public GreedySearch(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            OverallBest                 = new List <List <int> >();
            CurrentBest                 = new List <List <int> >();
            startVertex                 = agentManager.Agents[0].StartPosition;
            actualDrawingMode           = DRAWING_MODE.MORE_AGENT_CIRCLES;
            moreAgentCirclesToHighlight = new List <List <Edge> >();
            runCounter = 0;

            initParamsWindow(new GreedySearchParams(this));
        }
Exemplo n.º 5
0
        public HeldKarpAlgorithm(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            depot = agentManager.Agents[0].StartPosition;
            minimumDistanceToNode = new Dictionary <int, Dictionary <string, double> >();
            result = -1;
            moreAgentCirclesToHighlight = new List <List <Edge> >();
            actualDrawingMode           = DRAWING_MODE.MORE_AGENT_CIRCLES;
            nodesExceptDepot            = "";

            initParamsWindow(new HeldKarpParams(this));
        }
Exemplo n.º 6
0
        private void GameLoadedEvent(object sender, EventArgs e)
        {
            this.graph = new CompleteGraph(Game1.locations);
            this.graph.Populate();
            this.InitializeObjectLists();
            ChecklistMenu.ObjectLists = this.objectLists;
            Func <int> crt = this.CountRemainingTasks;

            this.checklistButton = new OpenChecklistButton(() => ChecklistMenu.Open(this.config), crt, this.config);
            Game1.onScreenMenus.Insert(0, this.checklistButton); // So that click is registered with priority
            this.doneLoading = true;
        }
Exemplo n.º 7
0
        public BruteForce(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
        {
            solutionEdges = new List <List <Edge> >();
            List <List <Vertex> > solutionInOrder = MultiTravel(AgentManager.Agents[0].StartPosition, AgentManager.Agents.Count, graph.Vertices.Count, graph.Vertices, 1, graph.Vertices.Count - 1);

            actualDrawingMode = DRAWING_MODE.MORE_AGENT_CIRCLES;

            foreach (var item in solutionInOrder)
            {
                List <Edge> actualEdges = new List <Edge>();
                for (int i = 0; i < item.Count - 1; i++)
                {
                    actualEdges.Add(graph.Edges.First(edge => (edge.StartVertex.Id == item[i].Id && edge.EndVertex.Id == item[i + 1].Id) || (edge.StartVertex.Id == item[i + 1].Id && edge.EndVertex.Id == item[i].Id)));
                }
                moreAgentCirclesToHighlight.Add(actualEdges);
                solutionEdges.Add(actualEdges);
            }
        }
Exemplo n.º 8
0
 public RandomSearch(CompleteGraph graph, AgentManager agentManager) : base(graph, agentManager)
 {
 }