예제 #1
0
        public UnweightedAntSystemFragment(Random rnd, BaseOptions options, IGraph graph)
            : base(rnd, options, graph)
        {
            for (var i = 0; i < _options.NumberOfRegions; i++)
            {
                var randomFreeVertix = FreeVertices.Shuffle(rnd).First();

                AddFreeVertexToTreil(i, randomFreeVertix);
            }
        }
예제 #2
0
        public override sealed void AddFreeVertexToTreil(int colonyIndex, Vertex vertix)
        {
            FreeVertices.Remove(vertix);

            Treil[colonyIndex].Add(vertix);
            WeightOfColonies[colonyIndex]++;

            //Log.DebugFormat($"Vertex <{vertix.Index}> add for colony <{colonyIndex}>");

            PassedVertices.Add(vertix);
        }
예제 #3
0
        public void AddFreeVertexToTreil(int colonyIndex, Vertex vertix)
        {
            FreeVertices.Remove(vertix);

            Treil[colonyIndex].Add(vertix);
            Log.DebugFormat($"Vertex i: {vertix.Index}, w: {vertix.Weight}");

            var currentWeightOfColony = WeightOfColonies[colonyIndex];

            WeightOfColonies[colonyIndex] = currentWeightOfColony + vertix.Weight;

            foreach (var passedVertex in Treil[colonyIndex])
            {
                EdgesWeightOfColonies[colonyIndex] += _graph.EdgesWeights[passedVertex.Index, vertix.Index];
            }

            PassedVertices.Add(vertix);
        }