个人 GitHub 账号下公开仓库的所有者可以登录并验证所有权,自行管理介绍,无需管理员批准。
登录并生成验证文件,在 30 分钟内将其提交到此仓库的默认分支。其他分支或分叉仓库中的文件无效。然后在下方检查文件,即可无需管理员批准直接管理项目。请保留文件以维持管理权限。
如需登录,将前往登录页面。登录后请回到此处,再次点击所选的验证按钮。
在项目文件夹中运行 /nomorevibe verify,即可验证所有权并自行管理介绍。
一分钟完成验证EasyLocal: a C++23 header-only framework for local search and metaheuristics
翻译准备中
取自仓库 README
正在加载完整 README。 以下为已保存的摘录。
EasyLocal is a C++23 header-only framework for local search and
metaheuristics. Version 4 is a complete redesign of EasyLocal++, the
object-oriented framework first described in 2003 (see
Citing EasyLocal).查看完整 README ↗EasyLocal is a C++23 header-only framework for local search and metaheuristics. Version 4 is a complete redesign of EasyLocal++, the object-oriented framework first described in 2003 (see Citing EasyLocal).
A problem is described by a few components: a solution manager, cost components, neighborhood explorers and their delta cost components. Generic runners search it (First and Best Improvement, Hill Climbing, Late Acceptance, Great Deluge, Simulated Annealing, Tabu Search, and Pareto Late Acceptance for several objectives), and solvers combine runs (LocalSearch, MultiStart, Pipeline). A program built on them gets a command line, parameter tuning with irace and, as optional components, an interactive terminal tester, a REST service and TOML configuration.
A neighborhood explorer lists the moves of a solution, one at a time:
// NeighborhoodExplorer: which moves exist and how they change a solution.
class SwapExplorer : public easylocal::neighborhood_explorer_base<TourManager, SwapCities>
{
public:
using neighborhood_explorer_base::neighborhood_explorer_base;
// Every pair of positions i < j, one move at a time: the generator hands a
// move to the runner at each co_yield and resumes when it asks for the
// next one, so the neighborhood is never stored in memory.
easylocal::generator<SwapCities> moves(const Tour& tour) const
{
const auto n = tour.order.size();
for (std::size_t i = 0; i < n; ++i)
for (std::size_t j = i + 1; j < n; ++j)
co_yield SwapCities{i, j};
}
bool is_valid(const Tour& tour, const SwapCities& move) const
{
return move.i < move.j && move.j < tour.order.size();
}
void make_move(Tour& tour, const SwapCities& move) const
{
std::swap(tour.order[move.i], tour.order[move.j]);
}
};
A runner is assembled from the algorithm and the problem's components, bound to an instance and run:
// A runner is assembled from recipes: descriptions of the services that
// are built later, by bind, when the Input is known.
auto runner =
// The algorithm and its parameters: the defaults run First Improvement
// until a local optimum, with no budget on the evaluations.
easylocal::make_runner<easylocal::runners::FirstImprovement>(
easylocal::runners::FirstImprovementParameters{})
// The SolutionManager with its cost: the parentheses make one recipe
// of the manager and the cost component attached to it.
| (easylocal::solution_manager<TourManager>()
| easylocal::component<TourLength>())
// The neighborhood: the moves the algorithm explores.
| easylocal::neighborhood<SwapExplorer>();
// bind builds TourManager, TourLength and SwapExplorer for this instance
// and returns the bound runner; run searches from the initial tour.
auto search = runner.bind(tsp);
const auto result = search.run(search.initial_solution());
The whole program, a swap-move First Improvement for the TSP, is
examples/quickstart/main.cpp.
The documentation is published at https://iolab-uniud.github.io/easylocal/:
The examples under examples/ are complete programs: an
assignment problem, the TSP, exam timetabling and the permutation flow shop,
each with a README that guides through its files.
CMAKE_OSX_DEPLOYMENT_TARGET) of 26.0 or later, for
the floating-point std::from_chars of its libc++, and CMake stops with a
message otherwise;-ffast-math (or -ffinite-math-only, MSVC's /fp:fast): the library
checks for NaN and infinite values, in the parameters, the costs and the
temperatures, and these flags let the compiler assume there are none.The core uses only the standard library. The optional components need toml++,
FTXUI or Crow, found on the system or fetched by CMake when
EASYLOCAL_FETCH_DEPENDENCIES=ON; see
Dependencies.
cmake --preset dev
cmake --build --preset dev
ctest --preset dev --output-on-failure -j
The release preset builds with optimizations. An optional component is
enabled with -DEASYLOCAL_ENABLE_CONFIG_TOML=ON, -DEASYLOCAL_ENABLE_TUI=ON
or -DEASYLOCAL_ENABLE_REST=ON.
A build tree installs to any prefix, and a CMake project then uses it through
find_package:
cmake --install build/release --prefix /path/to/prefix
find_package(EasyLocal CONFIG REQUIRED COMPONENTS Core)
target_link_libraries(my_solver PRIVATE EasyLocal::Core)
AGENTS.md describes how the repository is maintained, for people
and coding agents alike: its layout, the code style, the checks to run before a
commit, the CI and the releases. Every user-visible change goes in
CHANGELOG.md; planned evolutions are in the
roadmap.
If you use EasyLocal in your research, please cite the 2024 overview paper; the
2003 article describes the original design. CITATION.cff carries the same
information for GitHub's "Cite this repository".
@inproceedings{CeschiaDaRosDiGasperoSchaerf2024,
author = {Ceschia, Sara and Da Ros, Francesca and Di Gaspero, Luca and Schaerf, Andrea},
title = {{EasyLocal++} a 25-year Perspective on Local Search Frameworks: The Evolution of a Tool for the Design of Local Search Algorithm},
booktitle = {Proceedings of the Genetic and Evolutionary Computation Conference Companion},
series = {GECCO '24 Companion},
pages = {1658--1667},
year = {2024},
publisher = {Association for Computing Machinery},
address = {New York, NY, USA},
doi = {10.1145/3638530.3664140},
}
@article{DiGasperoSchaerf2003,
author = {Di Gaspero, Luca and Schaerf, Andrea},
title = {{EasyLocal++}: An object-oriented framework for flexible design of local search algorithms},
journal = {Software: Practice and Experience},
volume = {33},
number = {8},
pages = {733--765},
year = {2003},
doi = {10.1002/spe.524},
}
EasyLocal is developed at the University of Udine by Sara Ceschia, Francesca Da Ros, Luca Di Gaspero and Andrea Schaerf.
EasyLocal is released under the MIT License, as EasyLocal++ was. The optional components use permissively licensed dependencies: toml++ and FTXUI (MIT), Crow (BSD-3-Clause) and Asio (Boost Software License 1.0).