Add folder to manage

This commit is contained in:
2025-05-13 14:09:25 +02:00
parent 36c72491e7
commit 321e2a2f28
9 changed files with 23 additions and 56 deletions

View File

@@ -22,7 +22,6 @@ set(CMAKE_CXX_FLAGS_DEBUG " ${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage -O
# Options
# -------
option(BAYESNET_VCPKG_CONFIG "Use vcpkg version of BayesNet" ON)
option(ENABLE_TESTING "Unit testing build" OFF)
option(CODE_COVERAGE "Collect coverage from test library" OFF)
@@ -75,29 +74,18 @@ find_package(Torch CONFIG REQUIRED)
find_package(fimdlp CONFIG REQUIRED)
find_package(folding CONFIG REQUIRED)
find_package(argparse CONFIG REQUIRED)
find_package(nlohmann_json CONFIG REQUIRED)
find_package(Boost REQUIRED COMPONENTS python)
find_package(arff-files CONFIG REQUIRED)
find_package(ZLIB REQUIRED)
find_library(LIBZIP_LIBRARY NAMES zip)
# BayesNet
# if set to ON it will use the vcpkg version of BayesNet else it will use the locally installed version
if (BAYESNET_VCPKG_CONFIG)
message(STATUS "Using BayesNet vcpkg config")
find_package(bayesnet CONFIG REQUIRED)
set(BayesNet_LIBRARIES bayesnet::bayesnet)
else(BAYESNET_VCPKG_CONFIG)
message(STATUS "Using BayesNet local library config")
find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a PATHS ${Platform_SOURCE_DIR}/../lib/lib REQUIRED)
find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${Platform_SOURCE_DIR}/../lib/include)
add_library(bayesnet::bayesnet UNKNOWN IMPORTED)
set_target_properties(bayesnet::bayesnet PROPERTIES
IMPORTED_LOCATION ${bayesnet}
INTERFACE_INCLUDE_DIRECTORIES ${Bayesnet_INCLUDE_DIRS}
)
endif(BAYESNET_VCPKG_CONFIG)
message(STATUS "BayesNet_LIBRARIES=${BayesNet_LIBRARIES}")
find_library(bayesnet NAMES libbayesnet bayesnet libbayesnet.a PATHS ${Platform_SOURCE_DIR}/../lib/lib REQUIRED)
find_path(Bayesnet_INCLUDE_DIRS REQUIRED NAMES bayesnet PATHS ${Platform_SOURCE_DIR}/../lib/include)
add_library(bayesnet::bayesnet UNKNOWN IMPORTED)
set_target_properties(bayesnet::bayesnet PROPERTIES
IMPORTED_LOCATION ${bayesnet}
INTERFACE_INCLUDE_DIRECTORIES ${Bayesnet_INCLUDE_DIRS})
message(STATUS "BayesNet=${bayesnet}")
message(STATUS "BayesNet_INCLUDE_DIRS=${Bayesnet_INCLUDE_DIRS}")
# PyClassifiers

View File

@@ -1,6 +1,6 @@
SHELL := /bin/bash
.DEFAULT_GOAL := help
.PHONY: init clean coverage setup help build test clean debug release buildr buildd install dependency testp testb clang-uml debug_local release_local example
.PHONY: init clean coverage setup help build test clean debug release buildr buildd install dependency testp testb clang-uml example
f_release = build_Release
f_debug = build_Debug
@@ -80,28 +80,15 @@ debug: ## Build a debug version of the project with BayesNet from vcpkg
@echo ">>> Building Debug Platform...";
@if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi
@mkdir $(f_debug);
@cmake -S . -B $(f_debug) -DBAYESNET_VCPKG_CONFIG=ON -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@echo ">>> Done";
debug_local: ## Build a debug version of the project with BayesNet local
@echo ">>> Building Debug Platform...";
@if [ -d ./$(f_debug) ]; then rm -rf ./$(f_debug); fi
@mkdir $(f_debug);
@cmake -S . -B $(f_debug) -DBAYESNET_VCPKG_CONFIG=OFF -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@cmake -S . -B $(f_debug) -D CMAKE_BUILD_TYPE=Debug -D ENABLE_TESTING=ON -D CODE_COVERAGE=ON -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@echo ">>> Done";
release: ## Build a Release version of the project with BayesNet from vcpkg
@echo ">>> Building Release Platform...";
@if [ -d ./$(f_release) ]; then rm -rf ./$(f_release); fi
@mkdir $(f_release);
@cmake -S . -B $(f_release) -DBAYESNET_VCPKG_CONFIG=ON -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@cmake -S . -B $(f_release) -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@echo ">>> Done";
release_local: ## Build a Release version of the project with BayesNet local
@echo ">>> Building Release Platform...";
@if [ -d ./$(f_release) ]; then rm -rf ./$(f_release); fi
@mkdir $(f_release);
@cmake -S . -B $(f_release) -DBAYESNET_VCPKG_CONFIG=OFF -D CMAKE_BUILD_TYPE=Release -D CMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE=${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake
@echo ">>> Done";
opt = ""
test: ## Run tests (opt="-s") to verbose output the tests, (opt="-c='Test Maximum Spanning Tree'") to run only that section

View File

@@ -57,7 +57,7 @@ add_executable(b_main commands/b_main.cpp ${main_sources}
experimental_clfs/XA1DE.cpp
experimental_clfs/ExpClf.cpp
)
target_link_libraries(b_main "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy)
target_link_libraries(b_main PRIVATE nlohmann_json::nlohmann_json "${PyClassifiers}" bayesnet::bayesnet fimdlp ${Python3_LIBRARIES} "${TORCH_LIBRARIES}" Boost::python Boost::numpy)
# b_manage
set(manage_sources ManageScreen.cpp OptionsMenu.cpp ResultsManager.cpp)

View File

@@ -2,6 +2,7 @@
#include <sys/ioctl.h>
#include <utility>
#include <unistd.h>
#include "common/Paths.h"
#include <argparse/argparse.hpp>
#include "manage/ManageScreen.h"
#include <signal.h>
@@ -13,6 +14,7 @@ void manageArguments(argparse::ArgumentParser& program, int argc, char** argv)
{
program.add_argument("-m", "--model").default_value("any").help("Filter results of the selected model)");
program.add_argument("-s", "--score").default_value("any").help("Filter results of the score name supplied");
program.add_argument("--folder").help("Results folder to use").default_value(platform::Paths::results());
program.add_argument("--platform").default_value("any").help("Filter results of the selected platform");
program.add_argument("--complete").help("Show only results with all datasets").default_value(false).implicit_value(true);
program.add_argument("--partial").help("Show only partial results").default_value(false).implicit_value(true);
@@ -116,6 +118,7 @@ int main(int argc, char** argv)
auto program = argparse::ArgumentParser("b_manage", { platform_project_version.begin(), platform_project_version.end() });
manageArguments(program, argc, argv);
std::string model = program.get<std::string>("model");
std::string path = program.get<std::string>("folder");
std::string score = program.get<std::string>("score");
std::string platform = program.get<std::string>("platform");
bool complete = program.get<bool>("complete");
@@ -125,7 +128,7 @@ int main(int argc, char** argv)
partial = false;
signal(SIGWINCH, handleResize);
auto [rows, cols] = numRowsCols();
manager = new platform::ManageScreen(rows, cols, model, score, platform, complete, partial, compare);
manager = new platform::ManageScreen(path, rows, cols, model, score, platform, complete, partial, compare);
manager->doMenu();
auto fileName = manager->getExcelFileName();
delete manager;

View File

@@ -18,8 +18,8 @@ namespace platform {
const std::string STATUS_OK = "Ok.";
const std::string STATUS_COLOR = Colors::GREEN();
ManageScreen::ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) :
rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(model, score, platform, complete, partial))
ManageScreen::ManageScreen(const std::string path, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare) :
rows{ rows }, cols{ cols }, complete{ complete }, partial{ partial }, compare{ compare }, didExcel(false), results(ResultsManager(path, model, score, platform, complete, partial))
{
results.load();
openExcel = false;

View File

@@ -15,7 +15,7 @@ namespace platform {
};
class ManageScreen {
public:
ManageScreen(int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare);
ManageScreen(const std::string path, int rows, int cols, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial, bool compare);
~ManageScreen() = default;
void doMenu();
void updateSize(int rows, int cols);

View File

@@ -1,10 +1,9 @@
#include <algorithm>
#include "common/Paths.h"
#include "ResultsManager.h"
namespace platform {
ResultsManager::ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial) :
path(Paths::results()), model(model), scoreName(score), platform(platform), complete(complete), partial(partial), maxModel(0), maxTitle(0)
ResultsManager::ResultsManager(const std::string& path_, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial) :
path(path_), model(model), scoreName(score), platform(platform), complete(complete), partial(partial), maxModel(0), maxTitle(0)
{
}
void ResultsManager::load()

View File

@@ -18,7 +18,7 @@ namespace platform {
};
class ResultsManager {
public:
ResultsManager(const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial);
ResultsManager(const std::string& path_, const std::string& model, const std::string& score, const std::string& platform, bool complete, bool partial);
void load(); // Loads the list of results
void sortResults(SortField field, SortType type); // Sorts the list of results
void sortDate(SortType type);

View File

@@ -7,9 +7,7 @@
"fimdlp",
"libtorch-bin",
"folding",
"bayesnet",
"argparse",
"libxlsxwriter"
"argparse"
],
"overrides": [
{
@@ -24,10 +22,6 @@
"name": "libtorch-bin",
"version": "2.7.0"
},
{
"name": "bayesnet",
"version": "1.1.1"
},
{
"name": "folding",
"version": "1.1.1"
@@ -36,10 +30,6 @@
"name": "argpase",
"version": "3.2"
},
{
"name": "libxlsxwriter",
"version": "1.2.2"
},
{
"name": "nlohmann-json",
"version": "3.11.3"