30 #ifndef SHARK_ALGORITHMS_DIRECT_SEARCH_STEADYSTATEMOCMA 31 #define SHARK_ALGORITHMS_DIRECT_SEARCH_STEADYSTATEMOCMA 51 template<
typename Indicator=HypervolumeIndicator>
61 m_individualSuccessThreshold = 0.44;
72 return "SteadyStateMOCMA";
75 std::size_t
mu()
const{
87 return m_initialSigma;
90 return m_initialSigma;
94 return m_notionOfSuccess;
97 return m_notionOfSuccess;
101 return m_selection.indicator();
104 return m_selection.indicator();
108 archive >> BOOST_SERIALIZATION_NVP(
m_parents);
109 archive >> BOOST_SERIALIZATION_NVP(m_mu);
110 archive >> BOOST_SERIALIZATION_NVP(
m_best);
112 archive >> BOOST_SERIALIZATION_NVP(m_selection);
113 archive >> BOOST_SERIALIZATION_NVP(m_notionOfSuccess);
114 archive >> BOOST_SERIALIZATION_NVP(m_individualSuccessThreshold);
115 archive >> BOOST_SERIALIZATION_NVP(m_initialSigma);
118 archive << BOOST_SERIALIZATION_NVP(
m_parents);
119 archive << BOOST_SERIALIZATION_NVP(m_mu);
120 archive << BOOST_SERIALIZATION_NVP(
m_best);
122 archive << BOOST_SERIALIZATION_NVP(m_selection);
123 archive << BOOST_SERIALIZATION_NVP(m_notionOfSuccess);
124 archive << BOOST_SERIALIZATION_NVP(m_individualSuccessThreshold);
125 archive << BOOST_SERIALIZATION_NVP(m_initialSigma);
137 std::vector<SearchPointType>
const& initialSearchPoints
140 std::vector<RealVector> values(initialSearchPoints.size());
141 for(std::size_t i = 0; i != initialSearchPoints.size(); ++i){
142 SHARK_RUNTIME_CHECK(
function.isFeasible(initialSearchPoints[i]),
"Starting point(s) not feasible");
143 values[i] =
function.eval(initialSearchPoints[i]);
156 penalizingEvaluator(
function, offspring.begin(), offspring.end() );
164 std::vector<SearchPointType>
const& initialSearchPoints,
165 std::vector<ResultType>
const& functionValues,
176 std::size_t noVariables = initialSearchPoints[0].size();
179 std::size_t numPoints = 0;
180 if(initialSearchPoints.size()<=
mu){
181 numPoints = initialSearchPoints.size();
182 for(std::size_t i = 0; i != numPoints; ++i){
184 m_parents[i].searchPoint() = initialSearchPoints[i];
185 m_parents[i].penalizedFitness() = functionValues[i];
186 m_parents[i].unpenalizedFitness() = functionValues[i];
190 for(std::size_t i = numPoints; i !=
mu; ++i){
191 std::size_t index =
random::discrete(*mpe_rng, std::size_t(0),initialSearchPoints.size()-1);
193 m_parents[i].searchPoint() = initialSearchPoints[index];
194 m_parents[i].penalizedFitness() = functionValues[index];
195 m_parents[i].unpenalizedFitness() = functionValues[index];
198 for(std::size_t i = 0; i !=
mu; ++i){
202 indicator().init(functionValues.front().size(),
mu,*mpe_rng);
204 sortRankOneToFront();
209 std::size_t maxIdx = 0;
210 for (; maxIdx <
m_parents.size(); maxIdx++) {
215 std::size_t parentId =
random::discrete(*mpe_rng, std::size_t(0), maxIdx-1);
216 std::vector<IndividualType> offspring;
217 offspring.push_back(
m_parents[parentId]);
218 offspring[0].mutate(*mpe_rng);
219 offspring[0].parent() = parentId;
227 IndividualType& offspring =
m_parents.back();
243 for(std::size_t i = 0; i !=
mu(); ++i){
253 sortRankOneToFront();
263 double m_individualSuccessThreshold;
264 double m_initialSigma;
267 void sortRankOneToFront(){
268 std::size_t start = 0;
269 std::size_t end =
mu()-1;
271 if(m_parents[start].rank() == 1){
273 }
else if(m_parents[end].rank() != 1){
276 swap(m_parents[start],m_parents[end]);
282 random::rng_type* mpe_rng;