コード例 #1
0
 //Ha alguma garantia de que essas particulas aleatorias sejam circuitos hamiltonianos?
 public static TSPParticle RandomGenerate(TSPParticleSwarm containingSwarm, TravellingSalesmanMap Map)
 {
     TSPParticle newParticle = new TSPParticle(containingSwarm, Map);
     newParticle.Velocity = TSPVelocity.RandomGenerate(Map);
     newParticle.Position = new TSPPosition(Aleatoriety.GetRandomIntegerSequencePermutation(1, Map.CityCount).ToList());
     newParticle.EvaluateSelf();
     return newParticle;
 }
コード例 #2
0
        //Ha alguma garantia de que essas particulas aleatorias sejam circuitos hamiltonianos?

        public static TSPParticle RandomGenerate(TSPParticleSwarm containingSwarm, TravellingSalesmanMap Map)
        {
            TSPParticle newParticle = new TSPParticle(containingSwarm, Map);

            newParticle.Velocity = TSPVelocity.RandomGenerate(Map);
            newParticle.Position = new TSPPosition(Aleatoriety.GetRandomIntegerSequencePermutation(1, Map.CityCount).ToList());
            newParticle.EvaluateSelf();
            return(newParticle);
        }