==============================================================================
| 131 | |
| 132 | //============================================================================== |
| 133 | void testZDT1Generic(MultiObjectiveSolver& solver) |
| 134 | { |
| 135 | auto pFunc1 = std::make_shared<Func1>(); |
| 136 | auto pFunc2 = std::make_shared<Func2>(); |
| 137 | |
| 138 | std::vector<FunctionPtr> pFuncs; |
| 139 | pFuncs.push_back(pFunc1); |
| 140 | pFuncs.push_back(pFunc2); |
| 141 | |
| 142 | #if DART_BUILD_MODE_RELEASE |
| 143 | std::size_t numSolutions = 50; |
| 144 | #else |
| 145 | std::size_t numSolutions = 10; |
| 146 | #endif |
| 147 | #if DART_BUILD_MODE_RELEASE |
| 148 | std::size_t iterationNum = 1000; |
| 149 | #else |
| 150 | std::size_t iterationNum = 200; |
| 151 | #endif |
| 152 | |
| 153 | auto problem |
| 154 | = std::make_shared<optimizer::GenericMultiObjectiveProblem>(dimension); |
| 155 | problem->setObjectiveFunctions(pFuncs); |
| 156 | problem->setLowerBounds(lowerLimits); |
| 157 | problem->setUpperBounds(upperLimits); |
| 158 | |
| 159 | solver.setProblem(problem); |
| 160 | solver.setPopulationSize(numSolutions); |
| 161 | solver.setNumPopulations(100); |
| 162 | solver.setNumIterationsPerEvolution(iterationNum); |
| 163 | solver.solve(100); |
| 164 | |
| 165 | EXPECT_TRUE(solver.getPopulation(0).getSize() == numSolutions); |
| 166 | EXPECT_TRUE(solver.getPopulation(1).getSize() == numSolutions); |
| 167 | EXPECT_TRUE(solver.getNumPopulations() == 100); |
| 168 | } |
| 169 | |
| 170 | //============================================================================== |
| 171 | TEST(ZDT1, Basic) |
no test coverage detected