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(); }
void setParamToBodyParts( Particle ptc ) { for( int i = 0; i < bodyParts.Count; ++i ) { SetParamToParts( bodyParts[ i ], ptc.degreePositions[ 3 * i ], ptc.degreePositions[ 3 * i + 1 ], ptc.degreePositions[ 3 * i + 2 ] ); } }
/// <summary> /// 最大値設定と最小値設定の間違いをなくすためのメソッド /// </summary> /// <param name="particle"></param> /// <param name="index"></param> /// <param name="value1"></param> /// <param name="value2"></param> public void SetMaxMinDegree( Particle particle, int index, float value1, float value2 ) { particle.maxDegree[ index ] = Math.Max( value1, value2 ); particle.minDegree[ index ] = Math.Min( value1, value2 ); }