fix clang 10 compatibility
- random_shuffle is replaced by shuffle - get rid of EO stuff in eoPop, superseeded by stdlib random - get rid of bind2nd and use lambdas
This commit is contained in:
parent
949b5818a2
commit
18fec047ad
5 changed files with 15 additions and 9 deletions
|
|
@ -71,5 +71,5 @@ endif()
|
|||
|
||||
add_executable(fastga fastga.cpp)
|
||||
# target_link_libraries(fastga ${PARADISEO_LIBRARIES} ${IOH_LIBRARY} stdc++fs)
|
||||
target_link_libraries(fastga ${PARADISEO_LIBRARIES} stdc++fs fmt)
|
||||
target_link_libraries(fastga ${PARADISEO_LIBRARIES} fmt)
|
||||
|
||||
|
|
|
|||
|
|
@ -519,8 +519,8 @@ int main(int argc, char* argv[])
|
|||
ioh::trigger::OnImprovement on_improvement;
|
||||
ioh::watch::Evaluations evaluations;
|
||||
ioh::watch::TransformedYBest transformed_y_best;
|
||||
std::vector<std::reference_wrapper<ioh::logger::Trigger >> t = {std::ref(on_improvement)};
|
||||
std::vector<std::reference_wrapper<ioh::logger::Property>> w = {std::ref(evaluations),std::ref(transformed_y_best)};
|
||||
std::vector<std::reference_wrapper<ioh::logger::Trigger >> t = {on_improvement};
|
||||
std::vector<std::reference_wrapper<ioh::logger::Property>> w = {evaluations,transformed_y_best};
|
||||
csv_logger = std::make_shared<ioh::logger::FlatFile>(
|
||||
// {std::ref(on_improvement)},
|
||||
// {std::ref(evaluations),std::ref(transformed_y_best)},
|
||||
|
|
|
|||
|
|
@ -196,7 +196,7 @@ class eoInitPermutation: public eoInit<EOT> // FIXME inherit from eoInitWithDim
|
|||
for(unsigned idx=0;idx <chrom.size();idx++)
|
||||
chrom[idx]=idx+startFrom;
|
||||
|
||||
std::random_shuffle(chrom.begin(), chrom.end(),gen);
|
||||
std::shuffle(chrom.begin(), chrom.end(),gen);
|
||||
chrom.invalidate();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ Authors:
|
|||
#ifndef _EOPOP_H_
|
||||
#define _EOPOP_H_
|
||||
|
||||
#include <random>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
#include <iterator> // needed for GCC 3.2
|
||||
|
|
@ -182,8 +183,10 @@ class eoPop: public std::vector<EOT>, public eoObject, public eoPersistent
|
|||
*/
|
||||
void shuffle(void)
|
||||
{
|
||||
UF_random_generator<unsigned int> gen;
|
||||
std::random_shuffle(begin(), end(), gen);
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
//UF_random_generator<unsigned int> gen; // FIXME refactor
|
||||
std::shuffle(begin(), end(), gen);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -194,8 +197,10 @@ class eoPop: public std::vector<EOT>, public eoObject, public eoPersistent
|
|||
|
||||
std::transform(begin(), end(), result.begin(), Ref());
|
||||
|
||||
UF_random_generator<unsigned int> gen;
|
||||
std::random_shuffle(result.begin(), result.end(), gen);
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
//UF_random_generator<unsigned int> gen; // FIXME refactor
|
||||
std::shuffle(result.begin(), result.end(), gen);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -114,7 +114,8 @@ public:
|
|||
{
|
||||
resize(bits.size());
|
||||
std::transform(bits.begin(), bits.end(), begin(),
|
||||
std::bind2nd(std::equal_to<char>(), '1'));
|
||||
//std::bind2nd(std::equal_to<char>(), '1'));
|
||||
[](char bit){return bit == '1';} );
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue