-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
610 additions
and
154 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,18 +95,21 @@ set(libHeadersList | |
"${CMAKE_CURRENT_SOURCE_DIR}/include/solver.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/options.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/print.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/macros.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/variable_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/variable_candidates_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/value_heuristic.hpp") | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/macros.hpp") | ||
|
||
set(libHeadersAlgorithmsList | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/variable_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/variable_candidates_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/value_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/error_projection_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/adaptive_search_variable_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/adaptive_search_variable_candidates_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/adaptive_search_value_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/adaptive_search_error_projection_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/antidote_search_variable_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/antidote_search_variable_candidates_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/antidote_search_value_heuristic.hpp") | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/antidote_search_value_heuristic.hpp" | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/algorithms/culprit_search_error_projection_heuristic.hpp") | ||
|
||
set(libHeadersGlobalConstraintsList | ||
"${CMAKE_CURRENT_SOURCE_DIR}/include/global_constraints/all_different.hpp" | ||
|
@@ -119,8 +122,7 @@ set(libExternalHeadersList | |
# add the targets | ||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/lib) | ||
|
||
# add the library | ||
add_library(ghost SHARED | ||
set(toAddInLibs | ||
src/variable.cpp | ||
src/constraint.cpp | ||
src/objective.cpp | ||
|
@@ -132,42 +134,25 @@ add_library(ghost SHARED | |
src/algorithms/adaptive_search_variable_heuristic.cpp | ||
src/algorithms/adaptive_search_variable_candidates_heuristic.cpp | ||
src/algorithms/adaptive_search_value_heuristic.cpp | ||
src/algorithms/adaptive_search_error_projection_heuristic.cpp | ||
src/algorithms/antidote_search_variable_heuristic.cpp | ||
src/algorithms/antidote_search_variable_candidates_heuristic.cpp | ||
src/algorithms/antidote_search_value_heuristic.cpp | ||
src/algorithms/culprit_search_error_projection_heuristic.cpp | ||
src/global_constraints/all_different.cpp | ||
src/global_constraints/fix_value.cpp | ||
src/global_constraints/linear_equation.cpp | ||
"${libHeadersList}" | ||
"${libHeadersAlgorithmsList}" | ||
"${libHeadersGlobalConstraintsList}") | ||
src/global_constraints/linear_equation.cpp) | ||
|
||
# add the library | ||
add_library(ghost SHARED | ||
"${toAddInLibs}") | ||
|
||
add_library(ghost_static STATIC | ||
src/variable.cpp | ||
src/constraint.cpp | ||
src/objective.cpp | ||
src/auxiliary_data.cpp | ||
src/model.cpp | ||
src/model_builder.cpp | ||
src/options.cpp | ||
src/print.cpp | ||
src/algorithms/adaptive_search_variable_heuristic.cpp | ||
src/algorithms/adaptive_search_variable_candidates_heuristic.cpp | ||
src/algorithms/adaptive_search_value_heuristic.cpp | ||
src/algorithms/antidote_search_variable_heuristic.cpp | ||
src/algorithms/antidote_search_variable_candidates_heuristic.cpp | ||
src/algorithms/antidote_search_value_heuristic.cpp | ||
src/global_constraints/all_different.cpp | ||
src/global_constraints/fix_value.cpp | ||
src/global_constraints/linear_equation.cpp | ||
"${libHeadersList}" | ||
"${libHeadersAlgorithmsList}" | ||
"${libHeadersGlobalConstraintsList}") | ||
"${toAddInLibs}") | ||
|
||
target_include_directories(ghost PUBLIC | ||
$<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/thirdparty/> | ||
$<INSTALL_INTERFACE:include/ghost/thirdparty> | ||
) | ||
$<INSTALL_INTERFACE:include/ghost/thirdparty>) | ||
|
||
# add the install targets | ||
if(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32bits | ||
|
@@ -187,8 +172,8 @@ include (InstallRequiredSystemLibraries) | |
set (CPACK_PACKAGE_NAME "GHOST") | ||
set (CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") | ||
set (CPACK_PACKAGE_VERSION_MAJOR "2") | ||
set (CPACK_PACKAGE_VERSION_MINOR "3") | ||
set (CPACK_PACKAGE_VERSION_PATCH "1") | ||
set (CPACK_PACKAGE_VERSION_MINOR "4") | ||
set (CPACK_PACKAGE_VERSION_PATCH "0") | ||
set (CPACK_PACKAGE_CONTACT "[email protected]") | ||
set (CPACK_DEBIAN_FILE_NAME DEB-DEFAULT) | ||
include (CPack) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
55 changes: 55 additions & 0 deletions
55
include/algorithms/adaptive_search_error_projection_heuristic.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
/* | ||
* GHOST (General meta-Heuristic Optimization Solving Tool) is a C++ framework | ||
* designed to help developers to model and implement optimization problem | ||
* solving. It contains a meta-heuristic solver aiming to solve any kind of | ||
* combinatorial and optimization real-time problems represented by a CSP/COP/EFSP/EFOP. | ||
* | ||
* First developped to solve game-related optimization problems, GHOST can be used for | ||
* any kind of applications where solving combinatorial and optimization problems. In | ||
* particular, it had been designed to be able to solve not-too-complex problem instances | ||
* within some milliseconds, making it very suitable for highly reactive or embedded systems. | ||
* Please visit https://github.com/richoux/GHOST for further information. | ||
* | ||
* Copyright (C) 2014-2022 Florian Richoux | ||
* | ||
* This file is part of GHOST. | ||
* GHOST is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* GHOST is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with GHOST. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "error_projection_heuristic.hpp" | ||
|
||
namespace ghost | ||
{ | ||
namespace algorithms | ||
{ | ||
class AdaptiveSearchErrorProjection : public ErrorProjection | ||
{ | ||
public: | ||
AdaptiveSearchErrorProjection(); | ||
|
||
void compute_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
const std::vector<std::shared_ptr<Constraint>>& constraints ) override; | ||
|
||
void update_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
std::shared_ptr<Constraint> constraint, | ||
double delta ) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
63 changes: 63 additions & 0 deletions
63
include/algorithms/culprit_search_error_projection_heuristic.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* GHOST (General meta-Heuristic Optimization Solving Tool) is a C++ framework | ||
* designed to help developers to model and implement optimization problem | ||
* solving. It contains a meta-heuristic solver aiming to solve any kind of | ||
* combinatorial and optimization real-time problems represented by a CSP/COP/EFSP/EFOP. | ||
* | ||
* First developped to solve game-related optimization problems, GHOST can be used for | ||
* any kind of applications where solving combinatorial and optimization problems. In | ||
* particular, it had been designed to be able to solve not-too-complex problem instances | ||
* within some milliseconds, making it very suitable for highly reactive or embedded systems. | ||
* Please visit https://github.com/richoux/GHOST for further information. | ||
* | ||
* Copyright (C) 2014-2022 Florian Richoux | ||
* | ||
* This file is part of GHOST. | ||
* GHOST is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* GHOST is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with GHOST. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include "error_projection_heuristic.hpp" | ||
|
||
namespace ghost | ||
{ | ||
namespace algorithms | ||
{ | ||
class CulpritSearchErrorProjection : public ErrorProjection | ||
{ | ||
std::vector<std::vector<double>> _error_variables_by_constraints; | ||
|
||
void compute_variable_errors_on_constraint( const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
std::shared_ptr<Constraint> constraint ); | ||
|
||
public: | ||
CulpritSearchErrorProjection(); | ||
|
||
void initialize_data_structures() override; | ||
|
||
void compute_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
const std::vector<std::shared_ptr<Constraint>>& constraints ) override; | ||
|
||
void update_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
std::shared_ptr<Constraint> constraint, | ||
double delta ) override; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/* | ||
* GHOST (General meta-Heuristic Optimization Solving Tool) is a C++ framework | ||
* designed to help developers to model and implement optimization problem | ||
* solving. It contains a meta-heuristic solver aiming to solve any kind of | ||
* combinatorial and optimization real-time problems represented by a CSP/COP/EFSP/EFOP. | ||
* | ||
* First developped to solve game-related optimization problems, GHOST can be used for | ||
* any kind of applications where solving combinatorial and optimization problems. In | ||
* particular, it had been designed to be able to solve not-too-complex problem instances | ||
* within some milliseconds, making it very suitable for highly reactive or embedded systems. | ||
* Please visit https://github.com/richoux/GHOST for further information. | ||
* | ||
* Copyright (C) 2014-2022 Florian Richoux | ||
* | ||
* This file is part of GHOST. | ||
* GHOST is free software: you can redistribute it and/or | ||
* modify it under the terms of the GNU General Public License as published | ||
* by the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* GHOST is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* You should have received a copy of the GNU General Public License | ||
* along with GHOST. If not, see http://www.gnu.org/licenses/. | ||
*/ | ||
|
||
#pragma once | ||
|
||
#include <vector> | ||
#include <memory> | ||
|
||
#include "../constraint.hpp" | ||
#include "../variable.hpp" | ||
|
||
namespace ghost | ||
{ | ||
namespace algorithms | ||
{ | ||
class ErrorProjection | ||
{ | ||
protected: | ||
std::string name; | ||
int number_variables; | ||
int number_constraints; | ||
|
||
public: | ||
ErrorProjection( std::string&& name ) | ||
: name( std::move( name ) ) | ||
{ } | ||
|
||
inline std::string get_name() const { return name; } | ||
inline void set_number_variables( int num ) { number_variables = num ; } | ||
inline void set_number_constraints( int num ) { number_constraints = num ; } | ||
|
||
virtual void initialize_data_structures() {}; | ||
|
||
virtual void compute_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
const std::vector<std::shared_ptr<Constraint>>& constraints ) = 0; | ||
|
||
virtual void update_variable_errors( std::vector<double>& error_variables, | ||
const std::vector<Variable>& variables, | ||
const std::vector<std::vector<int>>& matrix_var_ctr, | ||
std::shared_ptr<Constraint> constraint, | ||
double delta ) = 0; | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.