public void Initialize(int degreeNum) { particles = new Particle[particleNum]; randGen = new Random(); evaluations = new float[particleNum]; for (int i = 0; i < particles.Length; ++i) { particles[i] = new Particle(); particles[i].degreeNum = degreeNum; particles[i].Initialize(); for (int j = 0; j < particles[i].degreePositions.Length; ++j) { particles[i].degreePositions[j] = ( float )randGen.Next(-180, 180); } } globalBestParticle = new Particle(); globalBestParticle.Initialize(); for (int j = 0; j < globalBestParticle.degreePositions.Length; ++j) { globalBestParticle.degreePositions[j] = ( float )randGen.Next(-180, 180); } }
public void Initialize(int degreeNum) { globalBestEvaluation = 1000000f; //InitializeWeightByRelatedWork(); //allWeight, c1, c2, weightを書き換える allWeight = 0.92f; particles = new Particle[particleNum]; randGen = new Random(); evaluations = new float[particleNum]; weights = new float[degreeNum]; maxDegrees = new float[degreeNum]; minDegrees = new float[degreeNum]; prevFrame = new Particle(); prevFrame.degreeNum = degreeNum; prevFrame.Initialize(); for (int i = 0; i < particles.Length; ++i) { particles[i] = new Particle(); particles[i].degreeNum = degreeNum; particles[i].Initialize(); for (int j = 0; j < particles[i].degreePositions.Length; ++j) { particles[i].degreePositions[j] = ( float )randGen.Next(-180, 180); } } globalBestParticle = new Particle(); globalBestParticle.Initialize(); for (int j = 0; j < globalBestParticle.degreePositions.Length; ++j) { globalBestParticle.degreePositions[j] = ( float )randGen.Next(-180, 180); } SetBodyParams(); }
public void Initialize( int degreeNum ) { globalBestEvaluation = 1000000f; //InitializeWeightByRelatedWork(); //allWeight, c1, c2, weightを書き換える allWeight = 0.92f; particles = new Particle[ particleNum ]; randGen = new Random(); evaluations = new float[ particleNum ]; weights = new float[ degreeNum ]; maxDegrees = new float[ degreeNum ]; minDegrees = new float[ degreeNum ]; prevFrame = new Particle(); prevFrame.degreeNum = degreeNum; prevFrame.Initialize(); for( int i = 0; i < particles.Length; ++i ) { particles[ i ] = new Particle(); particles[ i ].degreeNum = degreeNum; particles[ i ].Initialize(); for( int j = 0; j < particles[i].degreePositions.Length; ++j ) { particles[ i ].degreePositions[ j ] = ( float )randGen.Next( -180, 180 ); } } globalBestParticle = new Particle(); globalBestParticle.Initialize(); for( int j = 0; j < globalBestParticle.degreePositions.Length; ++j ) { globalBestParticle.degreePositions[ j ] = ( float )randGen.Next( -180, 180 ); } SetBodyParams(); }