az13js / cpp-genetic-algorithm Goto Github PK
View Code? Open in Web Editor NEWC++ 遗传算法 ( C++ Genetic Algorithm ):使用遗传算法求解 De jong 函数 f2,源码方法和属性有中文注释,命名和文件组织方式统一,使用面向对象实现,封装和调用上基本遵循遗传算法的逻辑
License: MIT License
C++ 遗传算法 ( C++ Genetic Algorithm ):使用遗传算法求解 De jong 函数 f2,源码方法和属性有中文注释,命名和文件组织方式统一,使用面向对象实现,封装和调用上基本遵循遗传算法的逻辑
License: MIT License
I successfully compiled and ran the genetic algorithm program on Windows. Here's what I did:
Create an "include" folder inside the "main.cpp" folder.
Move the "GeneticAlgorithm" file into the "include" folder.
Modify the "CMakeLists.txt" file with the necessary changes (details omitted).
Add a "run_exe.bat" file that can be double-clicked to run the program.
Please note that I've omitted the specific details of the changes you made to the "CMakeLists.txt" file as you mentioned "xxx" in your message.
cmakelist.txt
cmake_minimum_required(VERSION 3.10)
project(main VERSION 0.1)
set(CMAKE_EXE_LINKER_FLAGS "-static")
set(CMAKE_CXX_STANDARD_REQUIRED True)
SET(CMAKE_CXX_FLAGS "-std=c++17 -O2")
get_filename_component(main_path "${CMAKE_CURRENT_SOURCE_DIR}" ABSOLUTE)
include_directories(SYSTEM ${main_path}/include)
file(GLOB_RECURSE CPP_FILES ${main_path}/include/*.cpp)
get_property(current_search_paths DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
message("进入搜索")
foreach(search_path IN LISTS current_search_paths)
message("Include directory: ${search_path}")
endforeach()
add_executable(main main.cpp ${CPP_FILES})
run_exe.bat
@echo off
REM 开始计时
set start_time=%time%
chcp 65001
rem 删除build文件夹
rmdir /s /q build
rem 创建build文件夹
mkdir build
cd ./build
cmake .. -G "MinGW Makefiles"
mingw32-make -j20
REM 结束计时
set end_time=%time%
REM 计算耗费的时间
set /a hours=%end_time:~0,2%-%start_time:~0,2%
set /a minutes=%end_time:~3,2%-%start_time:~3,2%
set /a seconds=%end_time:~6,2%-%start_time:~6,2%
REM 处理借位
if %seconds% LSS 0 (
set /a seconds=60+%seconds%
set /a minutes-=1
)
if %minutes% LSS 0 (
set /a minutes=60+%minutes%
set /a hours-=1
)
REM 输出结果
echo 脚本执行耗时:%hours%小时%minutes%分钟%seconds%秒
copy main.cpp ..
main
echo "编译完毕"
pause
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.