安装必要依赖
安装boost
依赖boost版本大于1.68
boost官网下载
安装boost
安装包解压缩后
./bootstrap --buildtype=complete install
安装TBB
Intel TBB库+CMake+Ubuntu配置流程
安装pagmo
参考pagmo并行全局多目标优化算法库的安装编译与使用
官方教程
install pagmo2
cmake工程测试
CMakeLists.txt:
# The name of our project.
project(sample_project)
# Look for an installation of pagmo in the system.
find_package(Pagmo REQUIRED)
# Create an executable, and link it to the Pagmo::pagmo imported target.
# This ensures that, in the compilation of 'getting_started', pagmo's include
# dirs are added to the include path of the compiler and that pagmo's
# dependencies are transitively linked to 'getting_started'.
add_executable(getting_started getting_started.cpp)
target_link_libraries(getting_started Pagmo::pagmo)
getting_started.cpp:
#include <iostream>
#include <pagmo/algorithm.hpp>
#include <pagmo/algorithms/sade.hpp>
#include <pagmo/archipelago.hpp>
#include <pagmo/problem.hpp>
#include <pagmo/problems/schwefel.hpp>
using namespace pagmo;
int main()
{
problem prob{schwefel(30)};
algorithm algo{sade(100)};
archipelago archi{16u, algo, prob, 20u};
archi.evolve(10);
archi.wait_check();
for (const auto &isl : archi) {
std::cout << isl.get_population().champion_f()[0] << '\n';
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)