51int main(
int argc,
char ** argv ) {
53 std::size_t frontSize = 10;
54 std::size_t numDimensions = 10;
55 std::size_t numTrials = 10;
56 std::size_t recordingInterval = 20;
57 std::size_t numIterations = 20*recordingInterval;
60 typedef boost::shared_ptr<MultiObjectiveFunction> Function;
61 std::vector<Function > functions;
62 functions.push_back(Function(
new ZDT1(numDimensions)));
63 functions.push_back(Function(
new ZDT2(numDimensions)));
64 functions.push_back(Function(
new ZDT3(numDimensions)));
65 functions.push_back(Function(
new ZDT6(numDimensions)));
67 RealMatrix meanVolumes(functions.size(), numIterations/recordingInterval+1,0.0);
68 for(std::size_t f = 0; f != functions.size(); ++f){
69 for(std::size_t trial = 0; trial != numTrials; ++trial){
71 std::cout<<
"\r" <<functions[f]->name() <<
": "<<trial<<
"/"<<numTrials<<std::flush;
74 mocma.
mu() = frontSize;
76 mocma.
init( *functions[f] );
82 for(std::size_t i = 1; i <= numIterations; ++i){
83 mocma.
step(*functions[f]);
84 if(i % recordingInterval == 0){
90 meanVolumes /= numTrials;
92 std::cout<<
"\r# Iteration ";
93 for(std::size_t f = 0; f != functions.size(); ++f)
94 std::cout<<functions[f]->name()<<
" ";
97 std::cout.precision( 7 );
98 for(std::size_t i = 0; i != meanVolumes.size2();++i){
99 std::cout<< i*recordingInterval<<
" ";
100 for(std::size_t f = 0; f != functions.size(); ++f){
101 std::cout<<meanVolumes(f,i)<<
" ";