32 #ifndef SHARK_ALGORITHMS_DIRECT_SEARCH_MOCMA 33 #define SHARK_ALGORITHMS_DIRECT_SEARCH_MOCMA 54 template<
typename Indicator=HypervolumeIndicator>
64 m_individualSuccessThreshold = 0.44;
78 std::size_t
mu()
const{
91 return m_initialSigma;
94 return m_initialSigma;
98 return m_notionOfSuccess;
101 return m_notionOfSuccess;
104 archive >> BOOST_SERIALIZATION_NVP(
m_parents);
105 archive >> BOOST_SERIALIZATION_NVP(m_mu);
106 archive >> BOOST_SERIALIZATION_NVP(
m_best);
108 archive >> BOOST_SERIALIZATION_NVP(m_selection);
109 archive >> BOOST_SERIALIZATION_NVP(m_notionOfSuccess);
110 archive >> BOOST_SERIALIZATION_NVP(m_individualSuccessThreshold);
111 archive >> BOOST_SERIALIZATION_NVP(m_initialSigma);
114 archive << BOOST_SERIALIZATION_NVP(
m_parents);
115 archive << BOOST_SERIALIZATION_NVP(m_mu);
116 archive << BOOST_SERIALIZATION_NVP(
m_best);
118 archive << BOOST_SERIALIZATION_NVP(m_selection);
119 archive << BOOST_SERIALIZATION_NVP(m_notionOfSuccess);
120 archive << BOOST_SERIALIZATION_NVP(m_individualSuccessThreshold);
121 archive << BOOST_SERIALIZATION_NVP(m_initialSigma);
133 std::vector<SearchPointType>
const& initialSearchPoints
136 std::vector<RealVector> values(initialSearchPoints.size());
137 for(std::size_t i = 0; i != initialSearchPoints.size(); ++i){
138 SHARK_RUNTIME_CHECK(
function.isFeasible(initialSearchPoints[i]),
"Starting point(s) not feasible");
139 values[i] =
function.eval(initialSearchPoints[i]);
152 penalizingEvaluator(
function, offspring.begin(), offspring.end() );
157 return m_selection.indicator();
160 return m_selection.indicator();
167 std::vector<SearchPointType>
const& initialSearchPoints,
168 std::vector<ResultType>
const& functionValues,
178 std::size_t noVariables = initialSearchPoints[0].size();
181 std::size_t numPoints = 0;
182 if(initialSearchPoints.size()<=
mu){
183 numPoints = initialSearchPoints.size();
184 for(std::size_t i = 0; i != numPoints; ++i){
186 m_parents[i].searchPoint() = initialSearchPoints[i];
187 m_parents[i].penalizedFitness() = functionValues[i];
188 m_parents[i].unpenalizedFitness() = functionValues[i];
192 for(std::size_t i = numPoints; i !=
mu; ++i){
193 std::size_t index =
random::discrete(*mpe_rng,std::size_t(0),initialSearchPoints.size()-1);
195 m_parents[i].searchPoint() = initialSearchPoints[index];
196 m_parents[i].penalizedFitness() = functionValues[index];
197 m_parents[i].unpenalizedFitness() = functionValues[index];
200 for(std::size_t i = 0; i !=
mu; ++i){
205 indicator().init(functionValues.front().size(),
mu,*mpe_rng);
209 std::vector<IndividualType> offspring(
mu());
210 for(std::size_t i = 0; i !=
mu(); ++i){
211 std::size_t parentId = i;
213 offspring[i].mutate(*mpe_rng);
214 offspring[i].parent() = parentId;
224 for (std::size_t i = 0; i <
mu(); i++) {
237 m_parents[i].updateAsParent(offspringSuccess);
241 std::partition(
m_parents.begin(),
m_parents.end(),[](IndividualType
const& ind){
return ind.selected();});
245 for (std::size_t i = 0; i <
mu(); i++) {
259 double m_individualSuccessThreshold;
260 double m_initialSigma;
261 random::rng_type* mpe_rng;