![]() |
ノート/EPMRを見る〜C++3https://pepper.is.sci.toho-u.ac.jp:443/pepper/index.php?%A5%CE%A1%BC%A5%C8%2FEPMR%A4%F2%B8%AB%A4%EB%A1%C1%A3%C3%A1%DC%A1%DC%A3%B3 |
![]() |
ノート
訪問数 2338 最終更新 2008-02-03 (日) 15:18:47
T* members;つまり、T*型(Tへのポインタ型)の変数である。
template < class T > class EvolutionaryOptimizer : public IterativeOptimizer< T > {で持ってくる。つまり、class EvolutionaryOptimizerのインスタンスを作った時に、 その中で与えられるTである。
Epmr.cpp(1348): return new EvolutionaryOptimizer< Solution >( populationSize,CreateGlobalOptimizerメソッドの戻り値として (これ以外にインスタンスを作っているところは無さそうだ)
Solution.h(80): class Solution {クラスであり、コンストラクタSolution、デストラクタ~Solution、その他メソッドがある。
int targetID; double solK; double solB; std::vector< RigidBody > subSolutions;となっており、最後のvector< RigidBody> subSolutionsは、要素がRigidBody型のベクトルを定義している。そこで
Solution.h(28): class RigidBody {クラスであり、内部の(変数)領域は、33-36行目にある
Quat4d orientation; Vector3d position; int modelID; int segmentID;となっており、それぞれの型は
Quat4_.h(342): typedef Quat4<double> Quat4d;であり、同ファイル31-32行目に
template<class T> class Quat4 : public Tuple4<T> {
Vector3.h(192): typedef Vector3<double> Vector3d;であり、同一ファイル31-32行目に
template<class T> class Vector3 : public Tuple3<T>
T* members; 但しTはSolution型
solution( 0 ), nMembers( populationSize ), members( 0 ), scores( 0 )
delete[] members;
if ( members == 0 ) { members = new T[ nMembers ];
creator->Create( members, members + nMembers );Createは、creatorがRandomSolutionCreatorを指す(Epmr.cpp(1327); CreateGlobalOptimizerの中)ので、
*solution = members[ sortedIndices[ 0 ] ];つまりmembersは今まで得られたSolutionメンバの表になっていて、そこからsortedIndeces[0]番目を選んでsolutionとする。
scores[ sortedIndices[ i ] ] = scorer->Score( members[ sortedIndices[ i ] ] );
mutator->Mutate( &members[ sortedIndices[ i ] ], firstIndex, this );
return members[ sortedIndices[ rank ] ];