106 archive & BOOST_SERIALIZATION_NVP(
m_parents );
107 archive & BOOST_SERIALIZATION_NVP( m_mu );
108 archive & BOOST_SERIALIZATION_NVP(
m_best );
110 archive & BOOST_SERIALIZATION_NVP( m_selection );
111 archive & BOOST_SERIALIZATION_NVP( m_crossover );
112 archive & BOOST_SERIALIZATION_NVP( m_mutator );
113 archive & BOOST_SERIALIZATION_NVP( m_crossoverProbability );
116 archive & BOOST_SERIALIZATION_NVP(
m_parents );
117 archive & BOOST_SERIALIZATION_NVP( m_mu );
118 archive & BOOST_SERIALIZATION_NVP(
m_best );
120 archive & BOOST_SERIALIZATION_NVP( m_selection );
121 archive & BOOST_SERIALIZATION_NVP( m_crossover );
122 archive & BOOST_SERIALIZATION_NVP( m_mutator );
123 archive & BOOST_SERIALIZATION_NVP( m_crossoverProbability );
135 std::vector<SearchPointType>
const& initialSearchPoints
138 std::vector<RealVector> values(initialSearchPoints.size());
139 for(std::size_t i = 0; i != initialSearchPoints.size(); ++i){
141 values[i] = function.
eval(initialSearchPoints[i]);
145 RealVector lowerBounds(dim, -1E20);
146 RealVector upperBounds(dim, 1E20);
149 ConstraintHandler
const& handler =
static_cast<ConstraintHandler const&
>(function.
getConstraintHandler());
151 lowerBounds = handler.
lower();
152 upperBounds = handler.upper();
156 "Algorithm does only allow box constraints"
178 std::vector<SearchPointType>
const& initialSearchPoints,
179 std::vector<ResultType>
const& functionValues,
180 RealVector
const& lowerBounds,
181 RealVector
const& upperBounds,
185 double crossover_prob
191 m_crossoverProbability = crossover_prob;
195 std::size_t numPoints = 0;
196 if(initialSearchPoints.size()<=
mu){
197 numPoints = initialSearchPoints.size();
198 for(std::size_t i = 0; i != numPoints; ++i){
199 m_parents[i].searchPoint() = initialSearchPoints[i];
200 m_parents[i].penalizedFitness() = functionValues[i];
201 m_parents[i].unpenalizedFitness() = functionValues[i];
205 for(std::size_t i = numPoints; i !=
mu; ++i){
206 std::size_t index =
random::discrete(*mpe_rng, std::size_t(0),initialSearchPoints.size()-1);
207 m_parents[i].searchPoint() = initialSearchPoints[index];
208 m_parents[i].penalizedFitness() = functionValues[index];
209 m_parents[i].unpenalizedFitness() = functionValues[index];
212 for(std::size_t i = 0; i !=
mu; ++i){
218 m_crossover.
init(lowerBounds,upperBounds);
219 m_mutator.
init(lowerBounds,upperBounds);