30#ifndef SHARK_ALGORITHMS_DIRECT_SEARCH_TYPED_INDIVIDUAL_H
31#define SHARK_ALGORITHMS_DIRECT_SEARCH_TYPED_INDIVIDUAL_H
34#include <boost/range/adaptor/transformed.hpp>
60template<
typename Po
intType,
class FitnessTypeT,
class Chromosome = RealVector >
71 return individual1.
rank() < individual2.
rank();
148 template<
typename Archive>
149 void serialize(Archive & archive,
const unsigned int version) {
154 archive & BOOST_SERIALIZATION_NVP(
m_rank);
155 archive & BOOST_SERIALIZATION_NVP(
m_selected);
182 struct IndividualPenalizedFitnessFunctor{
183 template<
class Indiv
idual>
187 template<
class Indiv
idual>
193 struct IndividualUnpenalizedFitnessFunctor{
194 template<
class Indiv
idual>
196 return ind.unpenalizedFitness();
198 template<
class Indiv
idual>
200 return ind.unpenalizedFitness();
204 struct IndividualSearchPointFunctor{
205 template<
class Indiv
idual>
207 return ind.unpenalizedFitness();
209 template<
class Indiv
idual>
211 return ind.searchPoint();
215 struct IndividualRankFunctor{
216 template<
class Indiv
idual>
217 unsigned int& operator()(Individual& ind)
const{
220 template<
class Indiv
idual>
221 unsigned int operator()(Individual
const& ind)
const{
227template<
class Indiv
idualRange>
229 boost::adaptors::transform(range,detail::IndividualPenalizedFitnessFunctor())
231 return boost::adaptors::transform(range,detail::IndividualPenalizedFitnessFunctor());
234template<
class Indiv
idualRange>
236 boost::adaptors::transform(range,detail::IndividualUnpenalizedFitnessFunctor())
238 return boost::adaptors::transform(range,detail::IndividualUnpenalizedFitnessFunctor());
241template<
class Indiv
idualRange>
242auto ranks(IndividualRange& range) ->
decltype(
243 boost::adaptors::transform(range,detail::IndividualRankFunctor())
245 return boost::adaptors::transform(range,detail::IndividualRankFunctor());
249template<
class Indiv
idualRange>
251 boost::adaptors::transform(range,detail::IndividualSearchPointFunctor())
253 return boost::adaptors::transform(range,detail::IndividualSearchPointFunctor());