示例#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);
        }
        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);
        }