diff --git a/.gitignore b/.gitignore
index 4c2e7458..d1a38deb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,11 @@ cmake-build-*/
#mac
.DS_Store
+
+#savedata/ #issues with xml save location
+
+savedata/GPAgent/*.xml
+#AgentData_*.xml
+
+
+site
diff --git a/.gitmodules b/.gitmodules
index 55d6c6d9..8544886a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -4,3 +4,6 @@
[submodule "third_party/SFML"]
path = third_party/SFML
url = https://github.com/SFML/SFML.git
+[submodule "third_party/tinyxml2"]
+ path = third_party/tinyxml2
+ url = https://github.com/leethomason/tinyxml2.git
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 748132fd..5bba2f19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -6,27 +6,27 @@ project(CSE_491)
# For now, default to building both the main app and tests
set(BUILD_MAIN 1)
set(BUILD_TESTS 1)
-if("${CMAKE_BUILD_TYPE}" STREQUAL "Test")
- set(BUILD_MAIN 0)
- set(BUILD_TESTS 1)
-endif()
+if ("${CMAKE_BUILD_TYPE}" STREQUAL "Test")
+ set(BUILD_MAIN 0)
+ set(BUILD_TESTS 1)
+endif ()
# Create a function to make .cmake files simpler
function(add_source_to_target TARGET_NAME SOURCE_PATH)
- message(STATUS "Loading source: ${SOURCE_PATH}")
- target_sources(${TARGET_NAME}
- PRIVATE ${CMAKE_SOURCE_DIR}/${SOURCE_PATH}
- )
+ message(STATUS "Loading source: ${SOURCE_PATH}")
+ target_sources(${TARGET_NAME}
+ PRIVATE ${CMAKE_SOURCE_DIR}/${SOURCE_PATH}
+ )
endfunction()
# Set the necessary C++ flags, some of which are configuration-specific
set(CMAKE_CXX_STANDARD 20)
-set(CMAKE_CXX_FLAGS "-Wall -Wextra -Wcast-align -Winfinite-recursion -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -pedantic")
+set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wcast-align -Winfinite-recursion -Wnon-virtual-dtor -Wnull-dereference -Woverloaded-virtual -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_MINSIZEREL "-DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O2 -g")
-
+set(CMAKE_CXX_FLAGS_COVERAGE "-O2 -g -fcoverage-mapping -fprofile-instr-generate -fprofile-arcs")
# Place all executables in the executable directory
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/executable)
@@ -34,64 +34,154 @@ set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/executable)
# Move assets to build directory
file(COPY ./assets DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+#option(BUILD_CLANG_LLVM "Build with clang for LLVM" OFF)
+option(SANITIZE_MEMORY "Build with sanitizers for GP" OFF)
+if (SANITIZE_MEMORY)
+
+ set(BUILD_MAIN 0)
+ set(BUILD_TESTS 0)
+
+ set(CMAKE_CXX_COMPILER "/opt/homebrew/opt/llvm/bin/clang++")
+
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory")
+ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=memory")
+
+ set(XML_SRC_DIR third_party/tinyxml2)
+ set(XML_BUILD_DIR xml_build)
+ add_subdirectory(${XML_SRC_DIR} ${XML_BUILD_DIR})
+
+ #added the executable
+ add_executable(gp_train_main source/gp_train_main.cpp)
+
+ #linking the targets
+ target_sources(gp_train_main PRIVATE source/core/Entity.cpp)
+ target_include_directories(gp_train_main
+ PRIVATE ${CMAKE_SOURCE_DIR}/source/core
+ ${CMAKE_SOURCE_DIR}/source/Agents
+ )
+ target_link_libraries(gp_train_main
+ PRIVATE tinyxml2
+ PRIVATE pthread
+ )
+
+
+endif ()
+
+
+
+
+
+# Build the gp_train_main executable, if requested without SFML and Catch2
+option(BUILD_GP_ONLY "Build only gp_main.cpp" OFF)
+if (BUILD_GP_ONLY)
+ set(BUILD_MAIN 0)
+ set(BUILD_TESTS 0)
+
+ # Configure all of tinyxml2
+ set(XML_SRC_DIR third_party/tinyxml2)
+ set(XML_BUILD_DIR xml_build)
+ add_subdirectory(${XML_SRC_DIR} ${XML_BUILD_DIR})
+
+ #added the executable
+ add_executable(gp_train_main source/gp_train_main.cpp)
+
+ #linking the targets
+ target_sources(gp_train_main PRIVATE source/core/Entity.cpp)
+ target_include_directories(gp_train_main
+ PRIVATE ${CMAKE_SOURCE_DIR}/source/core
+ ${CMAKE_SOURCE_DIR}/source/Agents
+ )
+ target_link_libraries(gp_train_main
+ PRIVATE tinyxml2
+ PRIVATE pthread
+ )
+
+endif ()
+
+
# Build the main application executables, if requested
-if(${BUILD_MAIN})
-
- # Configure all of SFML
- set(SFML_SRC_DIR third_party/SFML)
- set(SFML_BUILD_DIR sfml_build)
- add_subdirectory(${SFML_SRC_DIR} ${SFML_BUILD_DIR})
-
-
- # Find all the main files for the various applications
- # Currently this means any *.cpp file in the root of source
- file(GLOB EXE_SOURCES CONFIGURE_DEPENDS RELATIVE ${CMAKE_SOURCE_DIR}/source source/*.cpp)
- message(STATUS "List of main files to build: ${EXE_SOURCES}")
-
- # Loop through each executable and build it!
- foreach(EXE_SOURCE ${EXE_SOURCES})
- # Rip the .cpp off the end of the string
- string(REPLACE ".cpp" "" EXE_NAME ${EXE_SOURCE})
- # Create list of source files (currently just the one .cpp file)
- # Create executable and link to includes / libraries
- add_executable(${EXE_NAME} ${CMAKE_SOURCE_DIR}/source/${EXE_SOURCE} ${CMAKE_SOURCE_DIR}/source/core/Entity.cpp)
- target_include_directories(${EXE_NAME}
- PRIVATE ${CMAKE_SOURCE_DIR}/source
- )
- target_link_libraries(${EXE_NAME}
- PRIVATE sfml-window sfml-audio sfml-graphics sfml-system sfml-network
- )
- if(EXISTS ${CMAKE_SOURCE_DIR}/source/${EXE_NAME}.cmake)
- message(STATUS "Loading ${EXE_NAME}.cmake")
- include(${CMAKE_SOURCE_DIR}/source/${EXE_NAME}.cmake)
- else()
- message(WARNING "Cannot find ${EXE_NAME}.cmake")
- endif()
- endforeach()
-endif()
+if (${BUILD_MAIN})
+# line to set santizers
+# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=[sanitizer]")
+# can be set to address, undefined, thread, memory, or leak
-# Build the test executables, if requested
-if(${BUILD_TESTS})
-
- # Configure Catch
- set(CATCH_SRC_DIR third_party/Catch2)
- set(CATCH_BUILD_DIR catch_build)
- add_subdirectory(${CATCH_SRC_DIR} ${CATCH_BUILD_DIR})
-
- # Configure only the networking portion of SFML
- if(NOT ${BUILD_MAIN})
- set(SFML_BUILD_WINDOW FALSE)
- set(SFML_BUILD_GRAPHICS FALSE)
- set(SFML_BUILD_AUDIO FALSE)
+ # Configure all of SFML
set(SFML_SRC_DIR third_party/SFML)
set(SFML_BUILD_DIR sfml_build)
add_subdirectory(${SFML_SRC_DIR} ${SFML_BUILD_DIR})
- endif()
- # Setup CTest
- include(CTest)
- enable_testing()
- # Tunnel into test directory CMake infrastructure
- add_subdirectory(tests)
-endif()
+ #configure the xml library
+ set(XML_SRC_DIR third_party/tinyxml2)
+ set(XML_BUILD_DIR xml_build)
+ add_subdirectory(${XML_SRC_DIR} ${XML_BUILD_DIR})
+
+
+ # Find all the main files for the various applications
+ # Currently this means any *.cpp file in the root of source
+ file(GLOB EXE_SOURCES CONFIGURE_DEPENDS RELATIVE ${CMAKE_SOURCE_DIR}/source source/*.cpp)
+ message(STATUS "List of main files to build: ${EXE_SOURCES}")
+
+
+
+ # Loop through each executable and build it!
+ foreach (EXE_SOURCE ${EXE_SOURCES})
+ # Rip the .cpp off the end of the string
+ string(REPLACE ".cpp" "" EXE_NAME ${EXE_SOURCE})
+ # Create list of source files (currently just the one .cpp file)
+ # Create executable and link to includes / libraries
+ add_executable(${EXE_NAME} ${CMAKE_SOURCE_DIR}/source/${EXE_SOURCE} ${CMAKE_SOURCE_DIR}/source/core/Entity.cpp)
+ target_include_directories(${EXE_NAME}
+ PRIVATE ${CMAKE_SOURCE_DIR}/source
+ )
+ target_link_libraries(${EXE_NAME}
+ PRIVATE sfml-window sfml-audio sfml-graphics sfml-system sfml-network
+ )
+
+ target_link_libraries(${EXE_NAME}
+ PRIVATE tinyxml2
+ )
+
+ if (EXISTS ${CMAKE_SOURCE_DIR}/source/${EXE_NAME}.cmake)
+ message(STATUS "Loading ${EXE_NAME}.cmake")
+ include(${CMAKE_SOURCE_DIR}/source/${EXE_NAME}.cmake)
+ else ()
+ message(WARNING "Cannot find ${EXE_NAME}.cmake")
+ endif ()
+ endforeach ()
+endif ()
+
+# Build the test executables, if requested
+if (${BUILD_TESTS})
+
+ # Configure Catch
+ set(CATCH_SRC_DIR third_party/Catch2)
+ set(CATCH_BUILD_DIR catch_build)
+ add_subdirectory(${CATCH_SRC_DIR} ${CATCH_BUILD_DIR})
+
+
+ # Configure only the networking portion of SFML
+ if (NOT ${BUILD_MAIN})
+ set(SFML_BUILD_WINDOW FALSE)
+ set(SFML_BUILD_GRAPHICS FALSE)
+ set(SFML_BUILD_AUDIO FALSE)
+ set(SFML_SRC_DIR third_party/SFML)
+ set(SFML_BUILD_DIR sfml_build)
+ add_subdirectory(${SFML_SRC_DIR} ${SFML_BUILD_DIR})
+
+ set(XML_SRC_DIR third_party/tinyxml2)
+ set(XML_BUILD_DIR xml_build)
+ add_subdirectory(${XML_SRC_DIR} ${XML_BUILD_DIR})
+
+
+ endif ()
+
+
+ # Setup CTest
+ include(CTest)
+ enable_testing()
+
+ # Tunnel into test directory CMake infrastructure
+ add_subdirectory(tests)
+endif ()
diff --git a/assets/grids/default_maze2.grid b/assets/grids/default_maze2.grid
new file mode 100644
index 00000000..2ef68706
--- /dev/null
+++ b/assets/grids/default_maze2.grid
@@ -0,0 +1,29 @@
+ # # # #
+# ### # ########## # ########## # ######### #
+# # # # # # # # # # # #
+# # ### ## # ### # ############ ##### ### # #
+# # # # # # # # # # #
+# ##### # # # ### # ###### ###### ##### ### #
+# # # # # # # # # # #
+##### # ###### # ###### # ## # ###### ####### # ## #
+# # # # ## # # # #
+# ############## ##### # # # ###### # ######### #
+# # # # # # # # # #
+############### # ### ###### # # #### # # ##### # #
+# # # # # # # # # # #
+# ############### ##### # # ######## ##### # # #
+# # # # # # # #
+# #################### ########### # ######### #
+# # # # #
+# # # ################### ############# ########## #
+# # # # #
+# ################ ############### ####### #
+# # # # # # #
+# # # # # ##################################### # #
+# # # # # # # # #
+# # # # # # ################################### # #
+# # # # # # # #
+# # ################################ # #
+# # # # # # # # # #
+# # # # # # # ############################### # #
+ # # # # # # # # # #
diff --git a/assets/grids/empty_maze.grid b/assets/grids/empty_maze.grid
new file mode 100644
index 00000000..5b833eab
--- /dev/null
+++ b/assets/grids/empty_maze.grid
@@ -0,0 +1,9 @@
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
+ *
diff --git a/docs/Group_7.md b/docs/Group_7.md
index e69de29b..8c167417 100644
--- a/docs/Group_7.md
+++ b/docs/Group_7.md
@@ -0,0 +1,85 @@
+# Group 7 : Genetic Programming Agents
+-- --
+authors: Aman, Simon, Rajmeet, Jason
+
+
+
+
+
+(Img: Rajmeet, Simon, Jason, Aman)
+
+## Introduction
+
+## GP Agent Base Class
+
+## LGP Agent
+
+## CGP Agent
+
+## GP Loop
+
+
+## It runs on my machine
+we have used cmake to ensure that our code compiles on all platforms. but....
+we have tested our code on the following machines/architectures:
+- Windows 11
+- Windows 10
+- Ubuntu 20.04
+- HPCC Cluster Centos7
+- MacOS Sonoma (ARM)
+- mlcollard/linux-dev (Docker Container)
+
+Tested in the following IDEs:
+- CLion
+- VSCode
+
+Tested on the following compilers:
+- gcc 9.3.0
+- Apple clang 12.0.0
+- LLVM clang 11.0.0
+
+### Profiled with and optimized with:
+- clion profiler
+
/
+
+
+
+- Xcode instruments
+
+
+
+- intel vtune
+
+
+
+- very sleepy
+Didnt deserve a screenshot. /s
+
+- code coverage in clion
+
+
+
+### Sanitized with:
+
+- clang sanitizer Memory
+- valgrind
+- gcc sanitizer Memory
+- gcc sanitizer address
+ - Used to find and fix memory UB in the code.
+
+
+
+## Other Contributions
+
+### EasyLogging
+Created a logging class that is can be used to log debug messages in debug mode. Teams can be specified to log with different levels of verbosity. This is useful for debugging and profiling.
+
+### CMake
+Initial cmake setup for the project. This is useful for cross platform compilation and testing.
+
+### serializationUsingTinyXML2
+Created and tested a serialization class that can be used to serialize and deserialize objects to and from xml files. This is useful for saving and loading the state of the GP agents.
+Implemented serialization pattern using tinyxml2 library.
+
+### mkdocs documentation
+Created and tested a mkdocs documentation for the project. This is useful for creating a website for the project.
\ No newline at end of file
diff --git a/docs/assets/GP_Group7/CodeCoverage_Clion.png b/docs/assets/GP_Group7/CodeCoverage_Clion.png
new file mode 100644
index 00000000..ffbebb6e
Binary files /dev/null and b/docs/assets/GP_Group7/CodeCoverage_Clion.png differ
diff --git a/docs/assets/GP_Group7/Group7Photo.jpeg b/docs/assets/GP_Group7/Group7Photo.jpeg
new file mode 100644
index 00000000..b934a44a
Binary files /dev/null and b/docs/assets/GP_Group7/Group7Photo.jpeg differ
diff --git a/docs/assets/GP_Group7/ProfilerGP_Clion.png b/docs/assets/GP_Group7/ProfilerGP_Clion.png
new file mode 100644
index 00000000..d14f7764
Binary files /dev/null and b/docs/assets/GP_Group7/ProfilerGP_Clion.png differ
diff --git a/docs/assets/GP_Group7/ProfilerGP_IntelVtune.png b/docs/assets/GP_Group7/ProfilerGP_IntelVtune.png
new file mode 100644
index 00000000..8e0e267b
Binary files /dev/null and b/docs/assets/GP_Group7/ProfilerGP_IntelVtune.png differ
diff --git a/docs/assets/GP_Group7/ProfilerGP_Xcode.png b/docs/assets/GP_Group7/ProfilerGP_Xcode.png
new file mode 100644
index 00000000..071f2a26
Binary files /dev/null and b/docs/assets/GP_Group7/ProfilerGP_Xcode.png differ
diff --git a/docs/assets/GP_Group7/UB_Behavior.png b/docs/assets/GP_Group7/UB_Behavior.png
new file mode 100644
index 00000000..32a618cd
Binary files /dev/null and b/docs/assets/GP_Group7/UB_Behavior.png differ
diff --git a/mkdocs.yml b/mkdocs.yml
new file mode 100644
index 00000000..362e93f8
--- /dev/null
+++ b/mkdocs.yml
@@ -0,0 +1,34 @@
+site_name: "CSE 491 Documentation"
+site_description: "Documentation for CSE 491 Group 7 GP Agent"
+
+theme:
+ name: material
+ palette:
+ primary: green
+ accent: green
+
+plugins:
+ - search
+ - mkdoxy:
+ projects:
+ Core Project: # name of project must be alphanumeric + numbers (without spaces)
+ src-dirs: ./source/core # path to source code (support multiple paths separated by space) => INPUT
+ full-doc: True # if you want to generate full documentation
+
+ doxy-cfg: # standard doxygen configuration (key: value)
+ FILE_PATTERNS: "*.cpp *.h*" # specify file patterns to filter out
+ RECURSIVE: True # recursive search in source directories
+ HIDE_UNDOC_MEMBERS: YES
+ HIDE_SCOPE_NAMES: YES
+ EXTRACT_ALL: NO
+
+ GP Agents:
+ src-dirs: ./source/Agents/GP
+ full-doc: True
+
+ doxy-cfg:
+ FILE_PATTERNS: "*.cpp *.h*"
+ RECURSIVE: True
+ HIDE_UNDOC_MEMBERS: YES
+ HIDE_SCOPE_NAMES: YES
+ EXTRACT_ALL: NO
diff --git a/savedata/GPAgent/Z_gp_folder_save.push b/savedata/GPAgent/Z_gp_folder_save.push
new file mode 100644
index 00000000..0b90e2b8
--- /dev/null
+++ b/savedata/GPAgent/Z_gp_folder_save.push
@@ -0,0 +1 @@
+sup
\ No newline at end of file
diff --git a/source/Agents/GP/CGPAgent.hpp b/source/Agents/GP/CGPAgent.hpp
new file mode 100644
index 00000000..3e33ae50
--- /dev/null
+++ b/source/Agents/GP/CGPAgent.hpp
@@ -0,0 +1,120 @@
+/**
+ * This file is part of the Fall 2023, CSE 491 course project.
+ * @brief An Agent based on genetic programming.
+ * @note Status: PROPOSAL
+ **/
+
+#pragma once
+
+#include
+#include
+#include