├── docs ├── conf.py ├── CMakeLists.txt └── Doxyfile ├── .gitignore ├── test ├── source │ ├── main.cpp │ └── solver.cpp └── CMakeLists.txt ├── results ├── Ablation-LSMD.png ├── Results-SDVRP.png ├── Results-SDVRP.xlsx └── Ablation-operators.png ├── data ├── SDVRP-instances-description.pdf ├── SET-1 │ ├── SD1.txt │ ├── SD2.txt │ ├── SD3.txt │ ├── SD4.txt │ ├── SD5.txt │ ├── SD6.txt │ ├── SD7.txt │ ├── SD9.txt │ ├── SD8.txt │ ├── SD10.txt │ ├── SD12.txt │ ├── SD11.txt │ ├── SD13.txt │ ├── SD14.txt │ ├── SD16.txt │ └── SD15.txt ├── SET-4 │ ├── eil22.sd │ ├── eil23.sd │ ├── eil30.sd │ ├── eil33.sd │ ├── eil51.sd │ ├── eilA76.sd │ ├── eilB76.sd │ ├── eilC76.sd │ ├── eilD76.sd │ ├── eilA101.sd │ └── eilB101.sd ├── SET-2 │ ├── S51D1.sd │ ├── S51D2.sd │ ├── S51D5.sd │ ├── S51D3.sd │ ├── S51D4.sd │ ├── S51D6.sd │ ├── S76D1.sd │ ├── S76D2.sd │ ├── S76D3.sd │ ├── S76D4.sd │ ├── S101D1.sd │ ├── S101D2.sd │ ├── S101D3.sd │ └── S101D5.sd └── SET-3 │ ├── p01_110.cri │ ├── p01_00.cri │ ├── p01_1030.cri │ ├── p01_1050.cri │ ├── p01_3070.cri │ ├── p01_1090.cri │ ├── p01_7090.cri │ ├── p02_110.cri │ ├── p02_00.cri │ ├── p02_1030.cri │ ├── p02_1050.cri │ ├── p02_3070.cri │ ├── p02_1090.cri │ ├── p02_7090.cri │ ├── p03_00.cri │ ├── p03_110.cri │ ├── p03_1030.cri │ ├── p03_1050.cri │ ├── p03_1090.cri │ ├── p03_3070.cri │ ├── p03_7090.cri │ ├── p11_00.cri │ ├── p11_110.cri │ ├── p11_1030.cri │ ├── p11_1050.cri │ ├── p11_1090.cri │ ├── p11_3070.cri │ ├── p11_7090.cri │ ├── p04_00.cri │ ├── p04_110.cri │ ├── p04_1030.cri │ ├── p04_1050.cri │ ├── p04_1090.cri │ ├── p04_3070.cri │ ├── p04_7090.cri │ ├── p05_110.cri │ ├── p10_110.cri │ ├── p05_00.cri │ ├── p10_00.cri │ ├── p05_1030.cri │ ├── p05_1050.cri │ ├── p10_1030.cri │ ├── p10_1050.cri │ ├── p05_1090.cri │ ├── p05_3070.cri │ ├── p10_1090.cri │ ├── p10_3070.cri │ ├── p05_7090.cri │ └── p10_7090.cri ├── AUTHORS ├── src ├── construction.h ├── repair.h ├── split_reinsertion.h ├── inter_operator │ ├── route_head_guard.h │ ├── base_cache.h │ └── relocate.cpp ├── delta.h ├── acceptance_rule.cpp ├── route_context.h ├── route_context.cpp ├── distance_matrix_optimizer.cpp ├── utils.h ├── sorter.cpp ├── random.h ├── cache.h ├── repair.cpp ├── split_reinsertion.cpp └── intra_operator │ └── exchange.cpp ├── .gitmodules ├── .clang-format ├── all └── CMakeLists.txt ├── include └── alkaidsd │ ├── instance.h │ ├── solver.h │ ├── distance_matrix_optimizer.h │ ├── intra_operator.h │ ├── config.h │ ├── acceptance_rule.h │ └── sorter.h ├── standalone └── CMakeLists.txt ├── cmake ├── CPM.cmake └── tools.cmake ├── LICENSE ├── .cmake-format ├── CMakeLists.txt └── example-config.ini /docs/conf.py: -------------------------------------------------------------------------------- 1 | DOXYFILE = 'Doxyfile' 2 | 3 | LINKS_NAVBAR1 = [] 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /build* 2 | /.vscode 3 | /cpm_modules 4 | .DS_Store 5 | cmake-build-*/ 6 | -------------------------------------------------------------------------------- /test/source/main.cpp: -------------------------------------------------------------------------------- 1 | #define DOCTEST_CONFIG_IMPLEMENT_WITH_MAIN 2 | 3 | #include 4 | -------------------------------------------------------------------------------- /results/Ablation-LSMD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HUST-Smart/Alkaid-SDVRP/HEAD/results/Ablation-LSMD.png -------------------------------------------------------------------------------- /results/Results-SDVRP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HUST-Smart/Alkaid-SDVRP/HEAD/results/Results-SDVRP.png -------------------------------------------------------------------------------- /results/Results-SDVRP.xlsx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HUST-Smart/Alkaid-SDVRP/HEAD/results/Results-SDVRP.xlsx -------------------------------------------------------------------------------- /results/Ablation-operators.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HUST-Smart/Alkaid-SDVRP/HEAD/results/Ablation-operators.png -------------------------------------------------------------------------------- /data/SDVRP-instances-description.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/HUST-Smart/Alkaid-SDVRP/HEAD/data/SDVRP-instances-description.pdf -------------------------------------------------------------------------------- /data/SET-1/SD1.txt: -------------------------------------------------------------------------------- 1 | 8 100 2 | 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 0 1000 6 | -1000 0 7 | -0 -1000 8 | 2000 0 9 | 0 2000 10 | -2000 0 11 | -0 -2000 12 | 13 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Weibo Lin 2 | Zhu He 3 | Shibiao Jiang 4 | Fuda Ma 5 | Zhouxing Su 6 | Zhipeng Lü 7 | -------------------------------------------------------------------------------- /src/construction.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | #include "random.h" 9 | 10 | namespace alkaidsd { 11 | AlkaidSolution Construct(const Instance &instance, Random &random); 12 | } // namespace alkaidsd 13 | -------------------------------------------------------------------------------- /src/repair.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "route_context.h" 7 | 8 | namespace alkaidsd { 9 | void Repair(const Instance &instance, Node route_index, AlkaidSolution &solution, RouteContext &context); 10 | } // namespace alkaidsd 11 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "cvrp/CVRPController"] 2 | path = cvrp/CVRPController 3 | url = https://github.com/laser-ufpb/CVRPController.git 4 | [submodule "irp/dimacs-irp-verifier"] 5 | path = irp/dimacs-irp-verifier 6 | url = https://github.com/sbeyer/dimacs-irp-verifier.git 7 | [submodule "carp/HGS-CARP"] 8 | path = carp/HGS-CARP 9 | url = https://github.com/vidalt/HGS-CARP.git 10 | -------------------------------------------------------------------------------- /data/SET-1/SD2.txt: -------------------------------------------------------------------------------- 1 | 16 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 0 1000 6 | -1000 0 7 | -0 -1000 8 | 2000 0 9 | 0 2000 10 | -2000 0 11 | -0 -2000 12 | 3000 0 13 | 0 3000 14 | -3000 0 15 | -0 -3000 16 | 4000 0 17 | 0 4000 18 | -4000 0 19 | -1 -4000 20 | 21 | 22 | -------------------------------------------------------------------------------- /data/SET-1/SD3.txt: -------------------------------------------------------------------------------- 1 | 16 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 707 707 6 | 0 1000 7 | -707 707 8 | -1000 0 9 | -707 -707 10 | -0 -1000 11 | 707 -707 12 | 2000 0 13 | 1414 1414 14 | 0 2000 15 | -1414 1414 16 | -2000 0 17 | -1414 -1414 18 | -0 -2000 19 | 1414 -1414 20 | 21 | -------------------------------------------------------------------------------- /data/SET-4/eil22.sd: -------------------------------------------------------------------------------- 1 | 21 6000 2 | 1100 700 800 1400 2100 400 800 100 500 600 1200 1300 1300 300 900 2100 1000 900 2500 1800 700 3 | 145 215 4 | 151 264 5 | 159 261 6 | 130 254 7 | 128 252 8 | 163 247 9 | 146 246 10 | 161 242 11 | 142 239 12 | 163 236 13 | 148 232 14 | 128 231 15 | 156 217 16 | 129 214 17 | 146 208 18 | 164 208 19 | 141 206 20 | 147 193 21 | 164 193 22 | 129 189 23 | 155 185 24 | 139 182 25 | -------------------------------------------------------------------------------- /data/SET-4/eil23.sd: -------------------------------------------------------------------------------- 1 | 22 4500 2 | 125 84 60 500 300 175 350 150 1100 4100 225 300 250 500 150 100 250 120 600 500 175 75 3 | 266 235 4 | 295 272 5 | 301 258 6 | 309 260 7 | 217 274 8 | 218 278 9 | 282 267 10 | 242 249 11 | 230 262 12 | 249 268 13 | 256 267 14 | 265 257 15 | 267 242 16 | 259 265 17 | 315 233 18 | 329 252 19 | 318 252 20 | 329 224 21 | 267 213 22 | 275 192 23 | 303 201 24 | 208 217 25 | 326 181 26 | -------------------------------------------------------------------------------- /src/split_reinsertion.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "random.h" 7 | #include "route_context.h" 8 | 9 | namespace alkaidsd { 10 | void SplitReinsertion(const Instance &instance, Node customer, int demand, double blink_rate, 11 | AlkaidSolution &solution, RouteContext &context, Random &random); 12 | 13 | } // namespace alkaidsd 14 | -------------------------------------------------------------------------------- /.clang-format: -------------------------------------------------------------------------------- 1 | --- 2 | BasedOnStyle: Google 3 | AccessModifierOffset: '-2' 4 | AlignTrailingComments: 'true' 5 | AllowAllParametersOfDeclarationOnNextLine: 'false' 6 | AlwaysBreakTemplateDeclarations: 'No' 7 | BreakBeforeBraces: Attach 8 | ColumnLimit: '100' 9 | ConstructorInitializerAllOnOneLineOrOnePerLine: 'true' 10 | IncludeBlocks: Regroup 11 | IndentPPDirectives: AfterHash 12 | IndentWidth: '2' 13 | NamespaceIndentation: All 14 | BreakBeforeBinaryOperators: All 15 | BreakBeforeTernaryOperators: 'true' 16 | ... 17 | -------------------------------------------------------------------------------- /data/SET-4/eil30.sd: -------------------------------------------------------------------------------- 1 | 29 4500 2 | 300 3100 125 100 200 150 150 450 300 100 950 125 150 150 550 150 100 150 400 300 1500 100 300 500 800 300 100 150 1000 3 | 162 354 4 | 218 382 5 | 218 358 6 | 201 370 7 | 214 371 8 | 224 370 9 | 210 382 10 | 104 354 11 | 126 338 12 | 119 340 13 | 129 349 14 | 126 347 15 | 125 346 16 | 116 355 17 | 126 335 18 | 125 355 19 | 119 357 20 | 115 341 21 | 153 351 22 | 175 363 23 | 180 360 24 | 159 331 25 | 188 357 26 | 152 349 27 | 215 389 28 | 212 394 29 | 188 393 30 | 207 406 31 | 184 410 32 | 207 392 33 | -------------------------------------------------------------------------------- /data/SET-1/SD4.txt: -------------------------------------------------------------------------------- 1 | 24 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 866 500 6 | 500 866 7 | 0 1000 8 | -500 866 9 | -866 500 10 | -1000 0 11 | -866 -500 12 | -500 -866 13 | -0 -1000 14 | 500 -866 15 | 866 -500 16 | 2000 0 17 | 1732 1000 18 | 1000 1732 19 | 0 2000 20 | -1000 1732 21 | -1732 1000 22 | -2000 0 23 | -1732 -1000 24 | -1000 -1732 25 | -0 -2000 26 | 1000 -1732 27 | 1732 -1000 28 | 29 | 30 | -------------------------------------------------------------------------------- /all/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # this script adds all subprojects to a single build to allow IDEs understand the full project 2 | # structure. 3 | 4 | cmake_minimum_required(VERSION 3.14...3.22) 5 | 6 | project(BuildAll LANGUAGES CXX) 7 | 8 | include(../cmake/tools.cmake) 9 | 10 | # needed to generate test target 11 | enable_testing() 12 | 13 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../standalone ${CMAKE_BINARY_DIR}/standalone) 14 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../test ${CMAKE_BINARY_DIR}/test) 15 | add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/../documentation ${CMAKE_BINARY_DIR}/documentation) 16 | -------------------------------------------------------------------------------- /data/SET-4/eil33.sd: -------------------------------------------------------------------------------- 1 | 32 8000 2 | 700 400 400 1200 40 80 2000 900 600 750 1500 150 250 1600 450 700 550 650 200 400 300 1300 700 750 1400 4000 600 1000 500 2500 1700 1100 3 | 292 495 4 | 298 427 5 | 309 445 6 | 307 464 7 | 336 475 8 | 320 439 9 | 321 437 10 | 322 437 11 | 323 433 12 | 324 433 13 | 323 429 14 | 314 435 15 | 311 442 16 | 304 427 17 | 293 421 18 | 296 418 19 | 261 384 20 | 297 410 21 | 315 407 22 | 314 406 23 | 321 391 24 | 321 398 25 | 314 394 26 | 313 378 27 | 304 382 28 | 295 402 29 | 283 406 30 | 279 399 31 | 271 401 32 | 264 414 33 | 277 439 34 | 290 434 35 | 319 433 36 | -------------------------------------------------------------------------------- /src/inter_operator/route_head_guard.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include "../route_context.h" 6 | 7 | namespace alkaidsd { 8 | struct RouteHeadGuard { 9 | AlkaidSolution &solution; 10 | RouteContext &context; 11 | Node route_index; 12 | RouteHeadGuard(AlkaidSolution &solution, RouteContext &context, Node route_index) 13 | : solution(solution), context(context), route_index(route_index) { 14 | solution.SetSuccessor(0, context.Head(route_index)); 15 | } 16 | ~RouteHeadGuard() { context.SetHead(route_index, solution.Successor(0)); } 17 | }; 18 | } // namespace alkaidsd 19 | -------------------------------------------------------------------------------- /data/SET-1/SD5.txt: -------------------------------------------------------------------------------- 1 | 32 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 707 707 6 | 0 1000 7 | -707 707 8 | -1000 0 9 | -707 -707 10 | -0 -1000 11 | 707 -707 12 | 2000 0 13 | 1414 1414 14 | 0 2000 15 | -1414 1414 16 | -2000 0 17 | -1414 -1414 18 | -0 -2000 19 | 1414 -1414 20 | 3000 0 21 | 2121 2121 22 | 0 3000 23 | -2121 2121 24 | -3000 0 25 | -2122 -2121 26 | -0 -3000 27 | 2121 -2122 28 | 4000 0 29 | 2828 2828 30 | 0 4000 31 | -2828 2829 32 | -4000 0 33 | -2829 -2828 34 | -1 -4000 35 | 2828 -2829 36 | -------------------------------------------------------------------------------- /data/SET-1/SD6.txt: -------------------------------------------------------------------------------- 1 | 32 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 924 383 6 | 707 707 7 | 383 924 8 | 0 1000 9 | -383 924 10 | -707 707 11 | -924 383 12 | -1000 0 13 | -924 -383 14 | -707 -707 15 | -383 -924 16 | -0 -1000 17 | 383 -924 18 | 707 -707 19 | 924 -383 20 | 2000 0 21 | 1848 765 22 | 1414 1414 23 | 765 1848 24 | 0 2000 25 | -765 1848 26 | -1414 1414 27 | -1848 766 28 | -2000 0 29 | -1848 -765 30 | -1414 -1414 31 | -766 -1848 32 | -0 -2000 33 | 765 -1848 34 | 1414 -1414 35 | 1848 -766 36 | -------------------------------------------------------------------------------- /data/SET-2/S51D1.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 3 4 5 14 2 5 5 9 2 10 5 4 2 14 4 5 3 15 4 10 3 14 2 13 3 10 3 15 4 4 5 15 4 5 8 15 5 10 10 13 6 14 13 11 8 15 15 10 9 15 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | -------------------------------------------------------------------------------- /data/SET-3/p01_110.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 13 6 4 9 14 13 8 2 4 1 13 6 8 8 11 5 2 8 13 9 2 10 10 9 12 11 1 12 3 2 13 13 13 4 13 8 12 8 8 13 3 2 10 11 14 5 8 7 13 10 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /data/SET-3/p01_00.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 7 30 16 9 21 15 19 23 11 5 19 29 23 21 10 15 3 41 9 28 8 8 16 10 28 7 15 14 6 19 11 12 23 26 17 6 9 15 14 7 27 13 11 16 10 5 25 17 18 10 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /include/alkaidsd/instance.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | namespace alkaidsd { 6 | /** 7 | * @brief Represents a node in the instance. 8 | */ 9 | using Node = short; 10 | 11 | /** 12 | * @brief Struct that defines the problem instance. 13 | */ 14 | struct Instance { 15 | Node num_customers; /**< The number of customers, including the depot. */ 16 | int capacity; /**< The capacity of the vehicles. */ 17 | std::vector demands; /**< The demands of each customer, including the depot. */ 18 | std::vector> 19 | distance_matrix; /**< The distance matrix between customers, including the depot. */ 20 | }; 21 | } // namespace alkaidsd 22 | -------------------------------------------------------------------------------- /data/SET-4/eil51.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 7 30 16 9 21 15 19 23 11 5 19 29 23 21 10 15 3 41 9 28 8 8 16 10 28 7 15 14 6 19 11 12 23 26 17 6 9 15 14 7 27 13 11 16 10 5 25 17 18 10 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | -------------------------------------------------------------------------------- /data/SET-3/p01_1030.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 43 28 23 33 45 43 31 19 22 17 41 28 30 32 38 25 18 32 43 33 19 36 36 34 41 39 17 40 20 19 43 41 42 22 43 31 40 31 31 42 22 18 36 37 44 25 31 29 43 35 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /data/SET-3/p01_1050.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 70 41 30 51 74 71 47 23 29 18 67 41 45 49 60 35 21 48 70 50 22 56 57 53 66 62 18 65 25 22 70 67 69 29 70 46 65 46 47 69 28 20 56 58 72 34 47 43 70 55 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /data/SET-2/S51D2.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 33 23 46 28 21 21 47 22 24 20 46 17 37 19 41 18 45 18 32 21 47 18 20 23 43 18 24 23 33 18 37 23 19 18 45 22 25 18 47 20 36 18 43 17 43 19 33 19 47 20 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 55 | -------------------------------------------------------------------------------- /data/SET-3/p01_3070.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 102 73 62 83 106 103 79 55 61 50 99 73 77 81 92 67 53 80 102 82 54 88 89 85 98 94 50 97 57 54 102 99 101 61 102 78 97 78 79 101 60 52 88 90 104 66 79 75 102 87 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /data/SET-2/S51D5.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 59 69 56 108 49 94 54 96 53 109 53 78 59 111 52 53 62 99 52 69 64 78 52 93 63 51 52 108 60 70 52 111 56 91 54 100 49 104 55 79 55 111 58 51 66 111 61 71 78 106 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | -------------------------------------------------------------------------------- /data/SET-2/S51D3.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 20 27 30 71 20 31 31 51 20 56 31 25 20 74 29 32 20 79 25 54 21 72 18 70 23 52 21 78 25 26 32 79 28 33 43 76 32 57 56 69 37 72 68 61 43 79 76 53 51 78 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 55 | 56 | -------------------------------------------------------------------------------- /data/SET-3/p01_1090.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 125 66 45 87 132 126 79 30 42 20 119 67 75 82 105 54 27 81 125 85 29 96 99 90 117 109 20 115 35 29 124 118 122 43 124 77 115 77 78 122 40 24 97 101 128 52 79 71 124 95 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /standalone/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14...3.22) 2 | 3 | project(AlkaidSDStandalone LANGUAGES CXX) 4 | 5 | # --- Import tools ---- 6 | 7 | include(../cmake/tools.cmake) 8 | 9 | # ---- Dependencies ---- 10 | 11 | include(../cmake/CPM.cmake) 12 | 13 | CPMAddPackage("gh:CLIUtils/CLI11@2.3.2") 14 | 15 | CPMAddPackage(NAME AlkaidSD SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 16 | 17 | # ---- Create standalone executable ---- 18 | 19 | file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) 20 | 21 | add_executable(${PROJECT_NAME} ${sources}) 22 | 23 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 OUTPUT_NAME "AlkaidSD") 24 | 25 | target_link_libraries(${PROJECT_NAME} AlkaidSD::AlkaidSD CLI11::CLI11) 26 | -------------------------------------------------------------------------------- /data/SET-2/S51D4.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 43 43 25 143 35 89 27 131 23 122 30 94 25 139 34 42 45 143 40 45 69 137 48 93 94 124 58 127 118 108 70 142 136 92 84 141 143 77 100 127 136 63 117 106 112 52 131 81 70 43 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | -------------------------------------------------------------------------------- /data/SET-3/p01_7090.cri: -------------------------------------------------------------------------------- 1 | 50 160 2 | 139 124 119 129 141 139 127 115 118 113 137 124 126 128 134 121 114 128 139 129 115 132 132 130 137 135 113 136 116 115 139 137 138 118 139 127 136 127 127 138 118 114 132 133 140 121 127 125 139 131 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 -------------------------------------------------------------------------------- /data/SET-2/S51D6.sd: -------------------------------------------------------------------------------- 1 | 50 160 2 | 118 118 114 143 116 130 114 140 113 138 115 131 114 142 116 118 119 143 118 119 125 142 120 131 131 139 122 139 137 135 125 143 142 131 129 143 143 127 133 139 142 123 137 134 136 121 140 128 125 118 3 | 30 40 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 55 | -------------------------------------------------------------------------------- /data/SET-1/SD7.txt: -------------------------------------------------------------------------------- 1 | 40 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 0 1000 6 | -1000 0 7 | -0 -1000 8 | 2000 0 9 | 0 2000 10 | -2000 0 11 | -0 -2000 12 | 3000 0 13 | 0 3000 14 | -3000 0 15 | -0 -3000 16 | 4000 0 17 | 0 4000 18 | -4000 0 19 | -1 -4000 20 | 5000 0 21 | 0 5000 22 | -5000 0 23 | -1 -5000 24 | 6000 0 25 | 0 6000 26 | -6000 1 27 | -1 -6000 28 | 7000 0 29 | 0 7000 30 | -7000 1 31 | -1 -7000 32 | 8000 0 33 | 0 8000 34 | -8000 1 35 | -1 -8000 36 | 9000 0 37 | 0 9000 38 | -9000 1 39 | -1 -9000 40 | 10000 0 41 | 0 10000 42 | -10000 1 43 | -1 -10000 44 | -------------------------------------------------------------------------------- /data/SET-1/SD9.txt: -------------------------------------------------------------------------------- 1 | 48 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 866 500 6 | 500 866 7 | 0 1000 8 | -500 866 9 | -866 500 10 | -1000 0 11 | -866 -500 12 | -500 -866 13 | -0 -1000 14 | 500 -866 15 | 866 -500 16 | 2000 0 17 | 1732 1000 18 | 1000 1732 19 | 0 2000 20 | -1000 1732 21 | -1732 1000 22 | -2000 0 23 | -1732 -1000 24 | -1000 -1732 25 | -0 -2000 26 | 1000 -1732 27 | 1732 -1000 28 | 3000 0 29 | 2598 1500 30 | 1500 2598 31 | 0 3000 32 | -1500 2598 33 | -2598 1500 34 | -3000 0 35 | -2598 -1500 36 | -1500 -2598 37 | -0 -3000 38 | 1500 -2598 39 | 2598 -1500 40 | 4000 0 41 | 3464 2000 42 | 2000 3464 43 | 0 4000 44 | -2000 3464 45 | -3464 2000 46 | -4000 0 47 | -3464 -2000 48 | -2000 -3464 49 | -1 -4000 50 | 1999 -3464 51 | 3464 -2001 52 | -------------------------------------------------------------------------------- /data/SET-3/p02_110.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 12 6 3 8 12 12 7 2 3 1 11 6 7 7 10 4 2 7 12 8 2 9 9 8 11 10 1 11 2 2 12 11 11 3 12 7 11 7 7 11 3 1 9 9 12 4 7 6 11 9 9 9 1 12 10 10 5 10 6 5 12 4 5 4 5 7 12 2 13 12 13 12 11 13 1 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /cmake/CPM.cmake: -------------------------------------------------------------------------------- 1 | # SPDX-License-Identifier: MIT 2 | # 3 | # SPDX-FileCopyrightText: Copyright (c) 2019-2023 Lars Melchior and contributors 4 | 5 | set(CPM_DOWNLOAD_VERSION 0.38.5) 6 | set(CPM_HASH_SUM "192aa0ccdc57dfe75bd9e4b176bf7fb5692fd2b3e3f7b09c74856fc39572b31c") 7 | 8 | if(CPM_SOURCE_CACHE) 9 | set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 10 | elseif(DEFINED ENV{CPM_SOURCE_CACHE}) 11 | set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 12 | else() 13 | set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake") 14 | endif() 15 | 16 | # Expand relative path. This is important if the provided path contains a tilde (~) 17 | get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE) 18 | 19 | file(DOWNLOAD 20 | https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake 21 | ${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM} 22 | ) 23 | 24 | include(${CPM_DOWNLOAD_LOCATION}) 25 | -------------------------------------------------------------------------------- /include/alkaidsd/solver.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | 7 | namespace alkaidsd { 8 | template class Solver { 9 | public: 10 | /// @brief Main function for solving the problem instance. 11 | /// @param config The configuration. 12 | /// @param instance The problem instance. 13 | /// @return The solution to the problem instance. 14 | virtual SolutionType Solve(const ConfigType &config, const InstanceType &instance) = 0; 15 | }; 16 | 17 | class AlkaidSolver : public Solver { 18 | public: 19 | /// @brief Main function for solving the problem instance. 20 | /// @param config The configuration. 21 | /// @param instance The problem instance. 22 | /// @return The solution to the problem instance. 23 | AlkaidSolution Solve(const AlkaidConfig &config, const Instance &instance) override; 24 | }; 25 | } // namespace alkaidsd 26 | -------------------------------------------------------------------------------- /data/SET-2/S76D1.sd: -------------------------------------------------------------------------------- 1 | 75 160 2 | 9 5 15 7 4 4 15 4 5 3 15 2 11 3 13 3 15 3 9 4 15 3 4 5 13 2 5 5 9 2 11 5 3 2 14 4 6 3 15 3 10 3 14 2 14 3 9 3 15 4 3 5 15 4 6 8 15 5 11 11 13 6 14 13 11 8 15 15 10 9 15 15 8 11 13 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | 80 | -------------------------------------------------------------------------------- /data/SET-1/SD8.txt: -------------------------------------------------------------------------------- 1 | 48 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 0 1000 6 | -1000 0 7 | -0 -1000 8 | 2000 0 9 | 0 2000 10 | -2000 0 11 | -0 -2000 12 | 3000 0 13 | 0 3000 14 | -3000 0 15 | -0 -3000 16 | 4000 0 17 | 0 4000 18 | -4000 0 19 | -1 -4000 20 | 5000 0 21 | 0 5000 22 | -5000 0 23 | -1 -5000 24 | 6000 0 25 | 0 6000 26 | -6000 1 27 | -1 -6000 28 | 7000 0 29 | 0 7000 30 | -7000 1 31 | -1 -7000 32 | 8000 0 33 | 0 8000 34 | -8000 1 35 | -1 -8000 36 | 9000 0 37 | 0 9000 38 | -9000 1 39 | -1 -9000 40 | 10000 0 41 | 0 10000 42 | -10000 1 43 | -1 -10000 44 | 11000 0 45 | 1 11000 46 | -11000 1 47 | -2 -11000 48 | 12000 0 49 | 1 12000 50 | -12000 1 51 | -2 -12000 -------------------------------------------------------------------------------- /data/SET-3/p02_00.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 22 12 19 22 16 7 26 14 21 24 13 15 18 11 28 9 37 30 10 8 11 3 1 6 10 20 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /data/SET-4/eilA76.sd: -------------------------------------------------------------------------------- 1 | 75 140 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 22 12 19 22 16 7 26 14 21 24 13 15 18 11 28 9 37 30 10 8 11 3 1 6 10 20 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | -------------------------------------------------------------------------------- /data/SET-4/eilB76.sd: -------------------------------------------------------------------------------- 1 | 75 100 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 22 12 19 22 16 7 26 14 21 24 13 15 18 11 28 9 37 30 10 8 11 3 1 6 10 20 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | -------------------------------------------------------------------------------- /data/SET-4/eilC76.sd: -------------------------------------------------------------------------------- 1 | 75 180 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 22 12 19 22 16 7 26 14 21 24 13 15 18 11 28 9 37 30 10 8 11 3 1 6 10 20 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | -------------------------------------------------------------------------------- /data/SET-4/eilD76.sd: -------------------------------------------------------------------------------- 1 | 75 220 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 22 12 19 22 16 7 26 14 21 24 13 15 18 11 28 9 37 30 10 8 11 3 1 6 10 20 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | -------------------------------------------------------------------------------- /data/SET-3/p02_1030.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 37 25 20 29 39 38 27 17 19 14 36 25 27 28 33 22 16 28 37 29 16 31 32 30 36 34 14 35 18 16 37 36 37 20 37 27 35 27 27 37 19 15 31 32 38 21 27 26 37 31 32 32 16 39 34 34 22 33 25 23 38 21 22 22 23 27 37 16 41 38 40 39 37 41 15 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /data/SET-3/p02_1050.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 61 36 26 45 64 62 41 20 25 15 59 36 40 43 53 30 18 42 61 44 19 49 50 46 58 55 15 57 22 19 61 58 60 26 61 40 57 41 41 60 24 17 49 51 63 29 41 38 61 48 51 50 18 65 55 54 31 53 36 32 63 28 31 30 33 40 61 19 69 62 67 64 61 69 16 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /data/SET-3/p02_3070.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 89 64 54 73 92 90 69 48 53 43 87 64 68 71 81 58 46 70 89 72 47 77 78 74 86 83 43 85 50 47 89 86 88 54 89 68 85 69 69 88 52 45 77 79 91 57 69 66 89 76 79 78 46 93 83 82 59 81 64 60 91 56 59 58 61 68 89 47 97 90 95 92 89 97 44 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /src/delta.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "random.h" 4 | 5 | namespace alkaidsd { 6 | template struct Delta { 7 | T value; 8 | int counter; 9 | 10 | Delta() : value(T()), counter(-1) {} 11 | 12 | Delta(T value, int counter) : value(value), counter(counter) {} 13 | 14 | bool Update(T new_value, Random &random) { 15 | if (new_value < value) { 16 | value = new_value; 17 | counter = 1; 18 | return true; 19 | } else if (new_value == value && counter != -1) { 20 | ++counter; 21 | return random.NextInt(1, counter) == 1; 22 | } 23 | return false; 24 | } 25 | 26 | bool Update(const Delta &delta, Random &random) { 27 | if (delta.value < value) { 28 | value = delta.value; 29 | counter = delta.counter; 30 | return true; 31 | } else if (delta.value == value && counter != -1) { 32 | counter += delta.counter; 33 | return random.NextInt(1, counter) <= delta.counter; 34 | } 35 | return false; 36 | } 37 | }; 38 | } // namespace alkaidsd 39 | -------------------------------------------------------------------------------- /data/SET-2/S76D2.sd: -------------------------------------------------------------------------------- 1 | 75 160 2 | 44 22 22 18 47 20 34 18 44 17 42 19 35 18 46 20 22 23 47 22 23 29 46 24 35 35 43 26 43 41 39 29 47 46 35 33 47 47 31 37 43 46 27 41 38 40 25 44 32 29 23 47 26 16 21 47 20 29 20 45 16 40 19 38 19 47 18 28 22 46 18 16 23 40 18 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | 80 | -------------------------------------------------------------------------------- /data/SET-2/S76D3.sd: -------------------------------------------------------------------------------- 1 | 75 160 2 | 27 37 24 76 17 62 22 64 21 77 21 46 27 79 20 21 30 67 20 37 32 46 20 61 31 19 20 76 28 38 20 79 24 59 22 68 17 72 23 47 23 79 26 19 34 79 29 39 46 74 33 61 59 67 38 75 70 59 45 79 78 51 52 77 79 44 61 68 73 37 69 57 58 32 75 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | 80 | -------------------------------------------------------------------------------- /data/SET-3/p02_1090.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 109 58 39 76 115 110 69 26 37 17 104 58 66 72 92 47 23 71 109 75 25 84 87 79 102 96 17 100 30 25 109 103 106 38 108 67 101 68 68 107 35 21 84 88 112 45 69 62 108 83 88 87 22 116 97 95 48 92 59 51 113 43 49 47 53 67 109 24 124 110 120 114 108 125 19 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 Weibo Lin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /data/SET-2/S76D4.sd: -------------------------------------------------------------------------------- 1 | 75 160 2 | 86 46 139 65 36 39 143 41 51 33 138 22 102 29 118 25 135 26 82 37 143 25 35 44 124 24 50 47 84 24 100 47 31 24 133 42 52 25 143 33 96 27 126 20 126 31 86 28 141 35 32 49 143 41 55 73 135 49 101 98 121 60 131 121 105 72 143 138 89 87 139 143 74 103 124 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 79 | 80 | -------------------------------------------------------------------------------- /docs/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14...3.22) 2 | 3 | project(AlkaidSDDocs) 4 | 5 | # ---- Dependencies ---- 6 | 7 | include(../cmake/CPM.cmake) 8 | 9 | CPMAddPackage("gh:mosra/m.css#0c8966de0dfb0fe7654314d251592aa4f6e1ab65") 10 | CPMAddPackage(NAME AlkaidSD SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 11 | 12 | # ---- Doxygen variables ---- 13 | 14 | # set Doxyfile variables 15 | set(DOXYGEN_PROJECT_NAME AlkaidSD) 16 | set(DOXYGEN_PROJECT_VERSION ${AlkaidSD_VERSION}) 17 | set(DOXYGEN_PROJECT_ROOT "${CMAKE_CURRENT_LIST_DIR}/..") 18 | set(DOXYGEN_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/doxygen") 19 | 20 | configure_file(${CMAKE_CURRENT_LIST_DIR}/Doxyfile ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile) 21 | 22 | configure_file(${CMAKE_CURRENT_LIST_DIR}/conf.py ${CMAKE_CURRENT_BINARY_DIR}/conf.py) 23 | 24 | add_custom_target( 25 | GenerateDocs 26 | ${CMAKE_COMMAND} -E make_directory "${DOXYGEN_OUTPUT_DIRECTORY}" 27 | COMMAND "${m.css_SOURCE_DIR}/documentation/doxygen.py" "${CMAKE_CURRENT_BINARY_DIR}/conf.py" 28 | COMMAND echo "Docs written to: ${DOXYGEN_OUTPUT_DIRECTORY}" 29 | WORKING_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}" 30 | ) 31 | -------------------------------------------------------------------------------- /data/SET-3/p02_7090.cri: -------------------------------------------------------------------------------- 1 | 75 140 2 | 121 109 104 113 123 122 111 101 103 98 120 109 111 112 117 106 100 112 121 113 100 115 116 114 120 118 98 119 102 100 121 120 121 104 121 111 119 111 111 121 103 99 115 116 122 105 111 110 121 115 116 116 100 123 118 118 106 117 109 107 122 105 106 106 107 111 121 100 125 122 124 123 121 125 99 3 | 40 40 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 15 56 54 | 29 39 55 | 54 38 56 | 55 57 57 | 67 41 58 | 10 70 59 | 6 25 60 | 65 27 61 | 40 60 62 | 70 64 63 | 64 4 64 | 36 6 65 | 30 20 66 | 20 30 67 | 15 5 68 | 50 70 69 | 57 72 70 | 45 42 71 | 38 33 72 | 50 4 73 | 66 8 74 | 59 5 75 | 35 60 76 | 27 24 77 | 40 20 78 | 40 37 -------------------------------------------------------------------------------- /docs/Doxyfile: -------------------------------------------------------------------------------- 1 | # Configuration for Doxygen for use with CMake 2 | # Only options that deviate from the default are included 3 | # To create a new Doxyfile containing all available options, call `doxygen -g` 4 | 5 | # Get Project name and version from CMake 6 | PROJECT_NAME = @DOXYGEN_PROJECT_NAME@ 7 | PROJECT_NUMBER = @DOXYGEN_PROJECT_VERSION@ 8 | 9 | # Add sources 10 | INPUT = @DOXYGEN_PROJECT_ROOT@/README.md @DOXYGEN_PROJECT_ROOT@/include @DOXYGEN_PROJECT_ROOT@/documentation/pages 11 | EXTRACT_ALL = YES 12 | RECURSIVE = YES 13 | OUTPUT_DIRECTORY = @DOXYGEN_OUTPUT_DIRECTORY@ 14 | 15 | # Use the README as a main page 16 | USE_MDFILE_AS_MAINPAGE = @DOXYGEN_PROJECT_ROOT@/README.md 17 | 18 | # set relative include paths 19 | FULL_PATH_NAMES = YES 20 | STRIP_FROM_PATH = @DOXYGEN_PROJECT_ROOT@/include @DOXYGEN_PROJECT_ROOT@ 21 | 22 | # We use m.css to generate the html documentation, so we only need XML output 23 | GENERATE_XML = YES 24 | GENERATE_HTML = NO 25 | GENERATE_LATEX = NO 26 | XML_PROGRAMLISTING = NO 27 | CREATE_SUBDIRS = NO 28 | 29 | # Include all directories, files and namespaces in the documentation 30 | # Disable to include only explicitly documented objects 31 | M_SHOW_UNDOCUMENTED = YES 32 | -------------------------------------------------------------------------------- /include/alkaidsd/distance_matrix_optimizer.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace alkaidsd { 9 | /** 10 | * @brief Optimizes the distance matrix by Floyd-Warshall algorithm. 11 | * 12 | * This class takes a distance matrix as input and provides methods to restore the optimized 13 | * solution. 14 | * 15 | * The optimization is done by Floyd-Warshall algorithm. 16 | */ 17 | class DistanceMatrixOptimizer { 18 | public: 19 | /** 20 | * @brief Constructs a DistanceMatrixOptimizer object with a given distance matrix. 21 | * 22 | * @param distance_matrix The distance matrix to be optimized. 23 | */ 24 | explicit DistanceMatrixOptimizer(std::vector>& distance_matrix); 25 | 26 | /** 27 | * @brief Restores the optimized solution to the original solution. 28 | * 29 | * @param solution The solution to be restored. 30 | */ 31 | void Restore(AlkaidSolution& solution) const; 32 | 33 | private: 34 | void Restore(AlkaidSolution& solution, Node i, Node j) const; 35 | 36 | std::vector> original_; 37 | std::vector> previous_node_indices_; 38 | }; 39 | } // namespace alkaidsd 40 | -------------------------------------------------------------------------------- /src/acceptance_rule.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "random.h" 6 | 7 | namespace alkaidsd::acceptance_rule { 8 | bool HillClimbing::Accept(int old_value, int new_value, [[maybe_unused]] Random &random) { 9 | return new_value < old_value; 10 | } 11 | 12 | bool HillClimbingWithEqual::Accept(int old_value, int new_value, 13 | [[maybe_unused]] Random &random) { 14 | return new_value <= old_value; 15 | } 16 | 17 | bool LateAcceptanceHillClimbing::Accept(int old_value, int new_value, 18 | [[maybe_unused]] Random &random) { 19 | bool accepted = false; 20 | if (new_value <= old_value || new_value < values_[position_]) { 21 | old_value = new_value; 22 | accepted = true; 23 | } 24 | if (old_value < values_[position_]) { 25 | values_[position_] = old_value; 26 | } 27 | position_ = (position_ + 1) % length_; 28 | return accepted; 29 | } 30 | 31 | bool SimulatedAnnealing::Accept(int old_value, int new_value, Random &random) { 32 | bool accepted = new_value <= old_value 33 | || random.NextFloat() < exp((old_value - new_value) / temperature_); 34 | temperature_ *= decay_; 35 | return accepted; 36 | } 37 | } // namespace alkaidsd::acceptance_rule 38 | -------------------------------------------------------------------------------- /test/source/solver.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | #include 6 | 7 | TEST_CASE("Large demand") { 8 | using namespace alkaidsd; 9 | 10 | Config config; 11 | config.time_limit = 1; 12 | config.blink_rate = 0.01; 13 | config.inter_operators.push_back(std::make_unique()); 14 | config.inter_operators.push_back(std::make_unique()); 15 | config.intra_operators.push_back(std::make_unique()); 16 | config.acceptance_rule = []() { return std::make_unique(); }; 17 | config.ruin_method = std::make_unique(std::vector{1}); 18 | config.sorter.AddSortFunction(std::make_unique(), 1); 19 | 20 | Problem problem; 21 | problem.num_customers = 2; 22 | problem.capacity = 1; 23 | problem.demands = std::vector{0, 100}; 24 | problem.distance_matrix = {{0, 1}, {1, 0}}; 25 | 26 | auto solution = Solve(config, problem); 27 | CHECK(solution.NodeIndices().size() == 100); 28 | CHECK(solution.CalcObjective(problem) == 200); 29 | } 30 | 31 | TEST_CASE("AlkaidSD version") { 32 | static_assert(std::string_view(ALKAIDSD_VERSION) == std::string_view("1.0")); 33 | CHECK(std::string(ALKAIDSD_VERSION) == std::string("1.0")); 34 | } 35 | -------------------------------------------------------------------------------- /data/SET-1/SD10.txt: -------------------------------------------------------------------------------- 1 | 64 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 924 383 6 | 707 707 7 | 383 924 8 | 0 1000 9 | -383 924 10 | -707 707 11 | -924 383 12 | -1000 0 13 | -924 -383 14 | -707 -707 15 | -383 -924 16 | -0 -1000 17 | 383 -924 18 | 707 -707 19 | 924 -383 20 | 2000 0 21 | 1848 765 22 | 1414 1414 23 | 765 1848 24 | 0 2000 25 | -765 1848 26 | -1414 1414 27 | -1848 766 28 | -2000 0 29 | -1848 -765 30 | -1414 -1414 31 | -766 -1848 32 | -0 -2000 33 | 765 -1848 34 | 1414 -1414 35 | 1848 -766 36 | 3000 0 37 | 2772 1148 38 | 2121 2121 39 | 1148 2772 40 | 0 3000 41 | -1148 2772 42 | -2121 2121 43 | -2772 1148 44 | -3000 0 45 | -2772 -1148 46 | -2122 -2121 47 | -1148 -2771 48 | -0 -3000 49 | 1148 -2772 50 | 2121 -2122 51 | 2771 -1149 52 | 4000 0 53 | 3696 1531 54 | 2828 2828 55 | 1531 3695 56 | 0 4000 57 | -1531 3696 58 | -2828 2829 59 | -3695 1531 60 | -4000 0 61 | -3696 -1530 62 | -2829 -2828 63 | -1531 -3695 64 | -1 -4000 65 | 1530 -3696 66 | 2828 -2829 67 | 3695 -1531 -------------------------------------------------------------------------------- /src/route_context.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace alkaidsd { 9 | class RouteContext { 10 | public: 11 | Node Head(Node route_index) const { return routes_[route_index].head; } 12 | Node Tail(Node route_index) const { return routes_[route_index].tail; } 13 | int Load(Node route_index) const { return routes_[route_index].load; } 14 | int PreLoad(Node node_index) const { return pre_loads_[node_index]; } 15 | void SetHead(Node route_index, Node head) { routes_[route_index].head = head; } 16 | void AddLoad(Node route_index, int load) { routes_[route_index].load += load; } 17 | Node NumRoutes() const { return routes_.size(); } 18 | void SetNumRoutes(Node num_routes) { routes_.resize(num_routes); } 19 | void AddRoute(Node head, Node tail, int load) { 20 | routes_.emplace_back(RouteData{head, tail, load}); 21 | } 22 | void CalcRouteContext(const AlkaidSolution &solution); 23 | void UpdateRouteContext(const AlkaidSolution &solution, Node route_index, Node predecessor); 24 | void MoveRouteContext(Node dest_route_index, Node src_route_index); 25 | 26 | private: 27 | struct RouteData { 28 | Node head; 29 | Node tail; 30 | int load; 31 | }; 32 | std::vector routes_; 33 | std::vector pre_loads_; 34 | }; 35 | } // namespace alkaidsd 36 | -------------------------------------------------------------------------------- /src/route_context.cpp: -------------------------------------------------------------------------------- 1 | #include "route_context.h" 2 | 3 | namespace alkaidsd { 4 | void RouteContext::CalcRouteContext(const AlkaidSolution &solution) { 5 | routes_.clear(); 6 | for (Node node_index : solution.NodeIndices()) { 7 | if (solution.Predecessor(node_index) == 0) { 8 | AddRoute(node_index, node_index, 0); 9 | } 10 | } 11 | pre_loads_.resize(solution.MaxNodeIndex() + 1); 12 | for (Node route_index = 0; route_index < NumRoutes(); ++route_index) { 13 | UpdateRouteContext(solution, route_index, 0); 14 | } 15 | } 16 | 17 | void RouteContext::UpdateRouteContext(const AlkaidSolution &solution, Node route_index, 18 | Node predecessor) { 19 | pre_loads_.resize(solution.MaxNodeIndex() + 1); 20 | int load = pre_loads_[predecessor]; 21 | Node node_index = predecessor ? solution.Successor(predecessor) : Head(route_index); 22 | while (node_index) { 23 | load += solution.Load(node_index); 24 | pre_loads_[node_index] = load; 25 | predecessor = node_index; 26 | node_index = solution.Successor(node_index); 27 | } 28 | routes_[route_index].tail = predecessor; 29 | routes_[route_index].load = load; 30 | } 31 | 32 | void RouteContext::MoveRouteContext(Node dest_route_index, Node src_route_index) { 33 | routes_[dest_route_index] = routes_[src_route_index]; 34 | } 35 | } // namespace alkaidsd 36 | -------------------------------------------------------------------------------- /.cmake-format: -------------------------------------------------------------------------------- 1 | format: 2 | tab_size: 2 3 | line_width: 100 4 | dangle_parens: true 5 | 6 | parse: 7 | additional_commands: 8 | cpmaddpackage: 9 | pargs: 10 | nargs: '*' 11 | flags: [] 12 | spelling: CPMAddPackage 13 | kwargs: &cpmaddpackagekwargs 14 | NAME: 1 15 | FORCE: 1 16 | VERSION: 1 17 | GIT_TAG: 1 18 | DOWNLOAD_ONLY: 1 19 | GITHUB_REPOSITORY: 1 20 | GITLAB_REPOSITORY: 1 21 | GIT_REPOSITORY: 1 22 | SVN_REPOSITORY: 1 23 | SVN_REVISION: 1 24 | SOURCE_DIR: 1 25 | DOWNLOAD_COMMAND: 1 26 | FIND_PACKAGE_ARGUMENTS: 1 27 | NO_CACHE: 1 28 | GIT_SHALLOW: 1 29 | URL: 1 30 | URL_HASH: 1 31 | URL_MD5: 1 32 | DOWNLOAD_NAME: 1 33 | DOWNLOAD_NO_EXTRACT: 1 34 | HTTP_USERNAME: 1 35 | HTTP_PASSWORD: 1 36 | OPTIONS: + 37 | cpmfindpackage: 38 | pargs: 39 | nargs: '*' 40 | flags: [] 41 | spelling: CPMFindPackage 42 | kwargs: *cpmaddpackagekwargs 43 | packageproject: 44 | pargs: 45 | nargs: '*' 46 | flags: [] 47 | spelling: packageProject 48 | kwargs: 49 | NAME: 1 50 | VERSION: 1 51 | NAMESPACE: 1 52 | INCLUDE_DIR: 1 53 | INCLUDE_DESTINATION: 1 54 | BINARY_DIR: 1 55 | COMPATIBILITY: 1 56 | VERSION_HEADER: 1 57 | DEPENDENCIES: + 58 | -------------------------------------------------------------------------------- /data/SET-2/S101D1.sd: -------------------------------------------------------------------------------- 1 | 100 160 2 | 3 4 5 14 2 5 5 9 2 10 5 4 2 14 4 5 3 15 4 10 3 14 2 13 3 10 3 15 4 4 5 15 4 5 8 15 5 10 10 13 6 14 13 11 8 15 15 10 9 15 15 8 11 14 15 7 13 11 12 5 14 8 7 4 15 6 2 4 15 3 8 3 14 2 13 3 11 3 15 3 7 4 15 2 2 5 12 2 8 5 6 2 13 5 2 2 15 4 8 3 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-3/p03_00.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p03_110.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 17 9 6 12 18 17 10 3 5 2 16 9 10 11 14 7 3 11 17 11 3 13 13 12 16 15 2 15 4 3 17 16 16 5 17 10 16 10 10 16 5 3 13 14 17 7 10 9 17 13 13 13 3 18 15 15 7 14 9 8 17 6 7 7 8 10 17 3 19 17 19 18 17 19 2 7 12 15 12 16 13 7 14 13 19 16 19 16 17 4 16 12 5 18 14 16 15 9 15 3 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-4/eilA101.sd: -------------------------------------------------------------------------------- 1 | 100 200 2 | 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-4/eilB101.sd: -------------------------------------------------------------------------------- 1 | 100 112 2 | 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-2/S101D2.sd: -------------------------------------------------------------------------------- 1 | 100 160 2 | 38 18 31 24 26 18 41 23 18 18 47 21 30 18 46 18 40 19 39 16 45 20 27 21 47 21 18 27 47 23 31 33 44 25 41 39 40 28 46 44 36 31 47 47 32 35 45 47 28 39 40 42 26 43 34 33 23 46 28 20 21 47 22 25 20 46 17 37 19 41 18 45 18 32 21 47 18 20 23 43 18 24 23 32 18 37 23 19 18 45 22 25 18 47 20 36 18 43 17 43 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-2/S101D3.sd: -------------------------------------------------------------------------------- 1 | 100 160 2 | 21 33 79 29 37 45 75 33 60 58 68 38 74 69 60 44 79 77 52 52 77 79 44 60 69 74 38 68 58 59 33 75 45 36 29 79 33 22 25 78 22 49 23 71 17 70 21 57 24 79 20 35 29 75 20 22 31 59 20 48 31 34 20 69 30 24 20 79 26 48 21 76 21 66 22 60 18 76 24 35 28 79 27 24 40 77 31 50 52 71 35 68 64 64 41 78 74 55 48 79 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-3/p03_1030.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 54 35 29 42 56 54 39 24 28 21 52 35 38 40 48 31 23 40 54 41 24 45 46 43 51 49 21 51 26 24 54 52 53 28 53 39 51 39 39 53 27 22 45 46 55 31 39 37 53 44 46 46 23 56 49 49 32 48 36 33 55 30 32 31 34 39 54 23 59 54 57 55 53 59 22 33 43 48 42 52 46 31 47 45 59 51 59 52 54 24 52 43 27 57 47 51 50 37 50 24 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p03_1050.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 88 51 38 64 92 88 59 28 36 22 84 51 57 61 76 43 26 60 88 63 28 70 72 66 83 78 22 82 32 28 88 84 86 37 87 58 82 58 58 86 35 25 70 73 90 42 59 54 87 69 73 72 26 93 79 78 44 76 52 47 90 41 45 43 48 58 88 27 98 89 95 91 87 99 24 46 66 77 65 84 72 42 74 71 98 82 98 84 88 29 85 66 34 95 74 83 81 54 81 28 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-2/S101D5.sd: -------------------------------------------------------------------------------- 1 | 100 160 2 | 52 59 62 103 52 63 63 83 52 88 63 57 52 106 61 64 52 111 57 86 53 104 50 102 55 84 53 110 57 58 64 111 60 65 75 108 64 89 88 101 69 104 100 93 75 111 108 85 83 110 111 77 91 102 107 71 99 91 94 65 106 79 72 61 111 67 50 58 111 56 77 55 105 48 99 54 91 55 111 53 71 60 109 52 50 63 94 52 77 64 70 52 98 62 52 52 110 59 77 53 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 104 | -------------------------------------------------------------------------------- /data/SET-3/p03_1090.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 156 83 56 109 165 157 99 37 53 25 149 83 94 103 132 67 33 101 156 107 36 121 124 113 147 137 25 144 44 36 156 148 152 54 155 96 144 97 97 153 50 30 121 126 160 65 99 89 155 119 126 125 32 167 139 136 69 132 84 74 161 62 70 67 76 96 156 34 177 158 171 163 154 179 28 72 113 135 111 148 125 65 129 122 177 144 177 149 156 39 150 112 49 170 129 146 143 88 142 36 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p03_3070.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 128 91 78 104 132 128 99 68 76 62 124 91 97 101 116 83 66 100 128 103 68 110 112 106 123 118 62 122 72 68 128 124 126 77 127 98 122 98 98 126 75 65 110 113 130 82 99 94 127 109 113 112 66 133 119 118 84 116 92 87 130 81 85 83 88 98 128 67 138 129 135 131 127 139 64 86 106 117 105 124 112 82 114 111 138 122 138 124 128 69 125 106 74 135 114 123 121 94 121 68 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p03_7090.cri: -------------------------------------------------------------------------------- 1 | 100 200 2 | 174 155 149 162 176 174 159 144 148 141 172 155 158 160 168 151 143 160 174 161 144 165 166 163 171 169 141 171 146 144 174 172 173 148 173 159 171 159 159 173 147 142 165 166 175 151 159 157 173 164 166 166 143 176 169 169 152 168 156 153 175 150 152 151 154 159 174 143 179 174 177 175 173 179 142 153 163 168 162 172 166 151 167 165 179 171 179 172 174 144 172 163 147 177 167 171 170 157 170 144 3 | 35 35 4 | 41 49 5 | 35 17 6 | 55 45 7 | 55 20 8 | 15 30 9 | 25 30 10 | 20 50 11 | 10 43 12 | 55 60 13 | 30 60 14 | 20 65 15 | 50 35 16 | 30 25 17 | 15 10 18 | 30 5 19 | 10 20 20 | 5 30 21 | 20 40 22 | 15 60 23 | 45 65 24 | 45 20 25 | 45 10 26 | 55 5 27 | 65 35 28 | 65 20 29 | 45 30 30 | 35 40 31 | 41 37 32 | 64 42 33 | 40 60 34 | 31 52 35 | 35 69 36 | 53 52 37 | 65 55 38 | 63 65 39 | 2 60 40 | 20 20 41 | 5 5 42 | 60 12 43 | 40 25 44 | 42 7 45 | 24 12 46 | 23 3 47 | 11 14 48 | 6 38 49 | 2 48 50 | 8 56 51 | 13 52 52 | 6 68 53 | 47 47 54 | 49 58 55 | 27 43 56 | 37 31 57 | 57 29 58 | 63 23 59 | 53 12 60 | 32 12 61 | 36 26 62 | 21 24 63 | 17 34 64 | 12 24 65 | 24 58 66 | 27 69 67 | 15 77 68 | 62 77 69 | 49 73 70 | 67 5 71 | 56 39 72 | 37 47 73 | 37 56 74 | 57 68 75 | 47 16 76 | 44 17 77 | 46 13 78 | 49 11 79 | 49 42 80 | 53 43 81 | 61 52 82 | 57 48 83 | 56 37 84 | 55 54 85 | 15 47 86 | 14 37 87 | 11 31 88 | 16 22 89 | 4 18 90 | 28 18 91 | 26 52 92 | 26 35 93 | 31 67 94 | 15 19 95 | 22 22 96 | 18 24 97 | 26 27 98 | 25 24 99 | 22 27 100 | 25 21 101 | 19 21 102 | 20 26 103 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p11_00.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 25 7 13 6 14 5 11 19 5 15 15 17 13 12 18 13 18 12 17 4 7 12 13 8 16 15 6 5 9 11 10 3 7 2 4 4 18 14 12 17 20 14 16 10 9 11 7 13 5 4 21 13 11 12 14 10 8 16 19 5 17 7 16 14 17 13 17 13 14 16 7 13 9 11 35 5 28 7 3 10 7 12 11 10 8 11 21 4 15 16 4 16 7 10 9 11 17 12 11 7 9 11 12 7 8 6 5 12 13 7 7 8 11 13 11 10 7 4 20 13 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /data/SET-3/p11_110.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 17 9 6 12 18 17 10 3 5 2 16 9 10 11 14 7 3 11 17 11 3 13 13 12 16 15 2 15 4 3 17 16 16 5 17 10 16 10 10 16 5 3 13 14 17 7 10 9 17 13 13 13 3 18 15 15 7 14 9 8 17 6 7 7 8 10 17 3 19 17 19 18 17 19 2 7 12 15 12 16 13 7 14 13 19 16 19 16 17 4 16 12 5 18 14 16 15 9 15 3 14 16 15 19 9 6 3 12 7 18 18 13 2 7 14 9 8 16 15 18 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /data/SET-3/p11_1030.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 54 35 29 42 56 54 39 24 28 21 52 35 38 40 48 31 23 40 54 41 24 45 46 43 51 49 21 51 26 24 54 52 53 28 53 39 51 39 39 53 27 22 45 46 55 31 39 37 53 44 46 46 23 56 49 49 32 48 36 33 55 30 32 31 34 39 54 23 59 54 57 55 53 59 22 33 43 48 42 52 46 31 47 45 59 51 59 52 54 24 52 43 27 57 47 51 50 37 50 24 46 51 50 58 37 28 23 42 32 56 56 46 20 32 47 35 34 53 50 57 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /data/SET-3/p11_1050.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 88 51 38 64 92 88 59 28 36 22 84 51 57 61 76 43 26 60 88 63 28 70 72 66 83 78 22 82 32 28 88 84 86 37 87 58 82 58 58 86 35 25 70 73 90 42 59 54 87 69 73 72 26 93 79 78 44 76 52 47 90 41 45 43 48 58 88 27 98 89 95 91 87 99 24 46 66 77 65 84 72 42 74 71 98 82 98 84 88 29 85 66 34 95 74 83 81 54 81 28 73 83 80 96 55 37 27 64 45 93 93 73 21 44 75 51 49 86 81 94 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /data/SET-1/SD12.txt: -------------------------------------------------------------------------------- 1 | 80 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 707 707 6 | 0 1000 7 | -707 707 8 | -1000 0 9 | -707 -707 10 | -0 -1000 11 | 707 -707 12 | 2000 0 13 | 1414 1414 14 | 0 2000 15 | -1414 1414 16 | -2000 0 17 | -1414 -1414 18 | -0 -2000 19 | 1414 -1414 20 | 3000 0 21 | 2121 2121 22 | 0 3000 23 | -2121 2121 24 | -3000 0 25 | -2122 -2121 26 | -0 -3000 27 | 2121 -2122 28 | 4000 0 29 | 2828 2828 30 | 0 4000 31 | -2828 2829 32 | -4000 0 33 | -2829 -2828 34 | -1 -4000 35 | 2828 -2829 36 | 5000 0 37 | 3536 3535 38 | 0 5000 39 | -3535 3536 40 | -5000 0 41 | -3536 -3535 42 | -1 -5000 43 | 3535 -3536 44 | 6000 0 45 | 4243 4243 46 | 0 6000 47 | -4242 4243 48 | -6000 1 49 | -4243 -4242 50 | -1 -6000 51 | 4242 -4243 52 | 7000 0 53 | 4950 4950 54 | 0 7000 55 | -4949 4950 56 | -7000 1 57 | -4950 -4949 58 | -1 -7000 59 | 4949 -4951 60 | 8000 0 61 | 5657 5657 62 | 0 8000 63 | -5656 5657 64 | -8000 1 65 | -5658 -5656 66 | -1 -8000 67 | 5656 -5658 68 | 9000 0 69 | 6364 6364 70 | 0 9000 71 | -6364 6364 72 | -9000 1 73 | -6365 -6363 74 | -1 -9000 75 | 6363 -6365 76 | 10000 0 77 | 7071 7071 78 | 0 10000 79 | -7071 7072 80 | -10000 1 81 | -7072 -7070 82 | -1 -10000 83 | 7070 -7072 84 | -------------------------------------------------------------------------------- /data/SET-3/p11_1090.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 156 83 56 109 165 157 99 37 53 25 149 83 94 103 132 67 33 101 156 107 36 121 124 113 147 137 25 144 44 36 156 148 152 54 155 96 144 97 97 153 50 30 121 126 160 65 99 89 155 119 126 125 32 167 139 136 69 132 84 74 161 62 70 67 76 96 156 34 177 158 171 163 154 179 28 72 113 135 111 148 125 65 129 122 177 144 177 149 156 39 150 112 49 170 129 146 143 88 142 36 127 147 140 172 90 55 34 109 70 167 167 126 22 69 130 82 79 153 142 168 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /data/SET-3/p11_3070.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 128 91 78 104 132 128 99 68 76 62 124 91 97 101 116 83 66 100 128 103 68 110 112 106 123 118 62 122 72 68 128 124 126 77 127 98 122 98 98 126 75 65 110 113 130 82 99 94 127 109 113 112 66 133 119 118 84 116 92 87 130 81 85 83 88 98 128 67 138 129 135 131 127 139 64 86 106 117 105 124 112 82 114 111 138 122 138 124 128 69 125 106 74 135 114 123 121 94 121 68 113 123 120 136 95 77 67 104 85 133 133 113 61 84 115 91 89 126 121 134 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /src/distance_matrix_optimizer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | namespace alkaidsd { 6 | DistanceMatrixOptimizer::DistanceMatrixOptimizer(std::vector> &distance_matrix) 7 | : original_(distance_matrix), 8 | previous_node_indices_(distance_matrix.size(), std::vector(distance_matrix.size())) { 9 | Node num_customers = static_cast(distance_matrix.size()); 10 | for (Node k = 1; k < num_customers; ++k) { 11 | for (Node i = 0; i < num_customers; ++i) { 12 | for (Node j = 0; j < num_customers; ++j) { 13 | int distance = distance_matrix[i][k] + distance_matrix[k][j]; 14 | if (distance_matrix[i][j] > distance) { 15 | distance_matrix[i][j] = distance; 16 | previous_node_indices_[i][j] = k; 17 | } 18 | } 19 | } 20 | } 21 | } 22 | 23 | void DistanceMatrixOptimizer::Restore(AlkaidSolution &solution, Node i, Node j) const { 24 | Node customer = previous_node_indices_[solution.Customer(i)][solution.Customer(j)]; 25 | if (customer != 0) { 26 | Node k = solution.Insert(customer, 0, i, j); 27 | Restore(solution, i, k); 28 | Restore(solution, k, j); 29 | } 30 | } 31 | 32 | void DistanceMatrixOptimizer::Restore(AlkaidSolution &solution) const { 33 | std::vector heads; 34 | for (Node node_index : solution.NodeIndices()) { 35 | if (!solution.Predecessor(node_index)) { 36 | heads.push_back(node_index); 37 | } 38 | } 39 | for (Node node_index : heads) { 40 | Node predecessor = 0; 41 | while (node_index) { 42 | Restore(solution, predecessor, node_index); 43 | predecessor = node_index; 44 | node_index = solution.Successor(node_index); 45 | } 46 | Restore(solution, predecessor, 0); 47 | } 48 | } 49 | } // namespace alkaidsd 50 | -------------------------------------------------------------------------------- /data/SET-1/SD11.txt: -------------------------------------------------------------------------------- 1 | 80 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 0 1000 6 | -1000 0 7 | -0 -1000 8 | 2000 0 9 | 0 2000 10 | -2000 0 11 | -0 -2000 12 | 3000 0 13 | 0 3000 14 | -3000 0 15 | -0 -3000 16 | 4000 0 17 | 0 4000 18 | -4000 0 19 | -1 -4000 20 | 5000 0 21 | 0 5000 22 | -5000 0 23 | -1 -5000 24 | 6000 0 25 | 0 6000 26 | -6000 1 27 | -1 -6000 28 | 7000 0 29 | 0 7000 30 | -7000 1 31 | -1 -7000 32 | 8000 0 33 | 0 8000 34 | -8000 1 35 | -1 -8000 36 | 9000 0 37 | 0 9000 38 | -9000 1 39 | -1 -9000 40 | 10000 0 41 | 0 10000 42 | -10000 1 43 | -1 -10000 44 | 11000 0 45 | 1 11000 46 | -11000 1 47 | -2 -11000 48 | 12000 0 49 | 1 12000 50 | -12000 1 51 | -2 -12000 52 | 13000 0 53 | 1 13000 54 | -13000 1 55 | -2 -13000 56 | 14000 0 57 | 1 14000 58 | -14000 1 59 | -2 -14000 60 | 15000 0 61 | 1 15000 62 | -15000 1 63 | -2 -15000 64 | 16000 0 65 | 1 16000 66 | -16000 1 67 | -2 -16000 68 | 17000 0 69 | 1 17000 70 | -17000 2 71 | -2 -17000 72 | 18000 0 73 | 1 18000 74 | -18000 2 75 | -3 -18000 76 | 19000 0 77 | 1 19000 78 | -19000 2 79 | -3 -19000 80 | 20000 0 81 | 1 20000 82 | -20000 2 83 | -3 -20000 84 | -------------------------------------------------------------------------------- /data/SET-3/p11_7090.cri: -------------------------------------------------------------------------------- 1 | 120 200 2 | 174 155 149 162 176 174 159 144 148 141 172 155 158 160 168 151 143 160 174 161 144 165 166 163 171 169 141 171 146 144 174 172 173 148 173 159 171 159 159 173 147 142 165 166 175 151 159 157 173 164 166 166 143 176 169 169 152 168 156 153 175 150 152 151 154 159 174 143 179 174 177 175 173 179 142 153 163 168 162 172 166 151 167 165 179 171 179 172 174 144 172 163 147 177 167 171 170 157 170 144 166 171 170 178 157 148 143 162 152 176 176 166 140 152 167 155 154 173 170 177 3 | 10 45 4 | 25 1 5 | 25 3 6 | 31 5 7 | 32 5 8 | 31 7 9 | 32 9 10 | 34 9 11 | 46 9 12 | 35 7 13 | 34 6 14 | 35 5 15 | 47 6 16 | 40 5 17 | 39 3 18 | 36 3 19 | 73 6 20 | 73 8 21 | 24 36 22 | 76 6 23 | 76 10 24 | 76 13 25 | 78 3 26 | 78 9 27 | 79 3 28 | 79 5 29 | 79 11 30 | 82 3 31 | 82 7 32 | 90 15 33 | 84 3 34 | 84 5 35 | 84 9 36 | 85 1 37 | 87 5 38 | 85 8 39 | 87 7 40 | 86 41 41 | 86 44 42 | 86 46 43 | 85 55 44 | 89 43 45 | 89 46 46 | 89 52 47 | 92 42 48 | 92 52 49 | 94 42 50 | 94 44 51 | 94 48 52 | 96 42 53 | 99 46 54 | 99 50 55 | 83 80 56 | 83 83 57 | 85 81 58 | 85 85 59 | 85 89 60 | 87 80 61 | 87 86 62 | 90 77 63 | 90 88 64 | 93 82 65 | 93 84 66 | 93 89 67 | 94 86 68 | 95 80 69 | 99 89 70 | 37 83 71 | 50 80 72 | 35 85 73 | 35 87 74 | 44 86 75 | 46 89 76 | 46 83 77 | 46 87 78 | 46 89 79 | 48 83 80 | 50 85 81 | 50 88 82 | 54 86 83 | 54 90 84 | 10 35 85 | 10 40 86 | 18 30 87 | 17 35 88 | 16 38 89 | 14 40 90 | 15 42 91 | 11 42 92 | 18 40 93 | 21 39 94 | 20 40 95 | 18 41 96 | 20 44 97 | 22 44 98 | 16 45 99 | 20 45 100 | 25 45 101 | 30 55 102 | 20 50 103 | 22 51 104 | 18 49 105 | 16 48 106 | 20 55 107 | 18 53 108 | 14 50 109 | 15 51 110 | 16 54 111 | 28 33 112 | 33 38 113 | 30 50 114 | 13 40 115 | 15 36 116 | 18 31 117 | 25 37 118 | 30 46 119 | 25 52 120 | 16 33 121 | 25 35 122 | 5 40 123 | 5 50 -------------------------------------------------------------------------------- /cmake/tools.cmake: -------------------------------------------------------------------------------- 1 | # this file contains a list of tools that can be activated and downloaded on-demand each tool is 2 | # enabled during configuration by passing an additional `-DUSE_=` argument to CMake 3 | 4 | # only activate tools for top level project 5 | if(NOT PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) 6 | return() 7 | endif() 8 | 9 | include(${CMAKE_CURRENT_LIST_DIR}/CPM.cmake) 10 | 11 | # enables sanitizers support using the the `USE_SANITIZER` flag available values are: Address, 12 | # Memory, MemoryWithOrigins, Undefined, Thread, Leak, 'Address;Undefined' 13 | if(USE_SANITIZER OR USE_STATIC_ANALYZER) 14 | CPMAddPackage("gh:StableCoder/cmake-scripts#23.09") 15 | 16 | if(USE_SANITIZER) 17 | include(${cmake-scripts_SOURCE_DIR}/sanitizers.cmake) 18 | endif() 19 | 20 | if(USE_STATIC_ANALYZER) 21 | if("clang-tidy" IN_LIST USE_STATIC_ANALYZER) 22 | set(CLANG_TIDY 23 | ON 24 | CACHE INTERNAL "" 25 | ) 26 | else() 27 | set(CLANG_TIDY 28 | OFF 29 | CACHE INTERNAL "" 30 | ) 31 | endif() 32 | if("iwyu" IN_LIST USE_STATIC_ANALYZER) 33 | set(IWYU 34 | ON 35 | CACHE INTERNAL "" 36 | ) 37 | else() 38 | set(IWYU 39 | OFF 40 | CACHE INTERNAL "" 41 | ) 42 | endif() 43 | if("cppcheck" IN_LIST USE_STATIC_ANALYZER) 44 | set(CPPCHECK 45 | ON 46 | CACHE INTERNAL "" 47 | ) 48 | else() 49 | set(CPPCHECK 50 | OFF 51 | CACHE INTERNAL "" 52 | ) 53 | endif() 54 | 55 | include(${cmake-scripts_SOURCE_DIR}/tools.cmake) 56 | 57 | clang_tidy(${CLANG_TIDY_ARGS}) 58 | include_what_you_use(${IWYU_ARGS}) 59 | cppcheck(${CPPCHECK_ARGS}) 60 | endif() 61 | endif() 62 | 63 | # enables CCACHE support through the USE_CCACHE flag possible values are: YES, NO or equivalent 64 | if(USE_CCACHE) 65 | CPMAddPackage("gh:TheLartians/Ccache.cmake@1.2.5") 66 | endif() 67 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "delta.h" 7 | #include "route_context.h" 8 | 9 | namespace alkaidsd { 10 | template struct InsertionWithCost { 11 | Node predecessor; 12 | Node successor; 13 | Node route_index; 14 | Delta cost; 15 | 16 | bool Update(const InsertionWithCost &insertion, Random &random) { 17 | if (cost.Update(insertion.cost, random)) { 18 | predecessor = insertion.predecessor; 19 | successor = insertion.successor; 20 | route_index = insertion.route_index; 21 | return true; 22 | } 23 | return false; 24 | } 25 | }; 26 | 27 | template auto CalcBestInsertion(const AlkaidSolution &solution, const Func &func, 28 | const RouteContext &context, Node route_index, 29 | Node customer, Random &random) { 30 | Node head = context.Head(route_index); 31 | auto head_cost = func(0, head, customer); 32 | InsertionWithCost best_insertion{0, head, route_index, 33 | Delta(head_cost, 1)}; 34 | Node node_index = head; 35 | while (node_index) { 36 | auto cost = func(node_index, solution.Successor(node_index), customer); 37 | if (best_insertion.cost.Update(cost, random)) { 38 | best_insertion.predecessor = node_index; 39 | best_insertion.successor = solution.Successor(node_index); 40 | } 41 | node_index = solution.Successor(node_index); 42 | } 43 | return best_insertion; 44 | } 45 | 46 | inline Node CalcFleetLowerBound(const Instance &instance) { 47 | int sum_demands = 0; 48 | for (Node i = 1; i < instance.num_customers; ++i) { 49 | sum_demands += instance.demands[i]; 50 | } 51 | return (sum_demands + instance.capacity - 1) / instance.capacity; 52 | } 53 | } // namespace alkaidsd 54 | -------------------------------------------------------------------------------- /src/sorter.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include 4 | 5 | #include "random.h" 6 | 7 | namespace alkaidsd::sorter { 8 | void Sorter::AddSortFunction(std::unique_ptr &&sort_function, double weight) { 9 | sum_weights_ += weight; 10 | sort_functions_.emplace_back(std::move(sort_function), weight); 11 | } 12 | 13 | void Sorter::Sort(const Instance &instance, std::vector &customers, Random &random) const { 14 | double r = random.NextFloat() * sum_weights_; 15 | for (auto &&[sort_function, weight] : sort_functions_) { 16 | r -= weight; 17 | if (r < 0) { 18 | (*sort_function)(instance, customers, random); 19 | return; 20 | } 21 | } 22 | } 23 | 24 | void SortByRandom::operator()([[maybe_unused]] const Instance &instance, 25 | std::vector &customers, Random &random) const { 26 | random.Shuffle(customers.begin(), customers.end()); 27 | } 28 | 29 | void SortByDemand::operator()(const Instance &instance, std::vector &customers, 30 | [[maybe_unused]] Random &random) const { 31 | std::stable_sort(customers.begin(), customers.end(), [&](Node lhs, Node rhs) { 32 | return instance.demands[lhs] > instance.demands[rhs]; 33 | }); 34 | } 35 | 36 | void SortByFar::operator()(const Instance &instance, std::vector &customers, 37 | [[maybe_unused]] Random &random) const { 38 | std::stable_sort(customers.begin(), customers.end(), [&](Node lhs, Node rhs) { 39 | return instance.distance_matrix[0][lhs] > instance.distance_matrix[0][rhs]; 40 | }); 41 | } 42 | 43 | void SortByClose::operator()(const Instance &instance, std::vector &customers, 44 | [[maybe_unused]] Random &random) const { 45 | std::stable_sort(customers.begin(), customers.end(), [&](Node lhs, Node rhs) { 46 | return instance.distance_matrix[0][lhs] < instance.distance_matrix[0][rhs]; 47 | }); 48 | } 49 | } // namespace alkaidsd::sorter 50 | -------------------------------------------------------------------------------- /test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14...3.22) 2 | 3 | project(AlkaidSDTests LANGUAGES CXX) 4 | 5 | # ---- Options ---- 6 | 7 | option(ENABLE_TEST_COVERAGE "Enable test coverage" OFF) 8 | option(TEST_INSTALLED_VERSION "Test the version found by find_package" OFF) 9 | 10 | # --- Import tools ---- 11 | 12 | include(../cmake/tools.cmake) 13 | 14 | # ---- Dependencies ---- 15 | 16 | include(../cmake/CPM.cmake) 17 | 18 | CPMAddPackage("gh:doctest/doctest@2.4.11") 19 | CPMAddPackage("gh:TheLartians/Format.cmake@1.8.0") 20 | 21 | if(TEST_INSTALLED_VERSION) 22 | find_package(AlkaidSD REQUIRED) 23 | else() 24 | CPMAddPackage(NAME AlkaidSD SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/..) 25 | endif() 26 | 27 | # ---- Create binary ---- 28 | 29 | file(GLOB sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp) 30 | add_executable(${PROJECT_NAME} ${sources}) 31 | target_link_libraries(${PROJECT_NAME} doctest::doctest AlkaidSD::AlkaidSD) 32 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) 33 | 34 | # enable compiler warnings 35 | if(NOT TEST_INSTALLED_VERSION) 36 | if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "GNU") 37 | target_compile_options(AlkaidSD PUBLIC -Wall -Wpedantic -Wextra -Werror) 38 | elseif(MSVC) 39 | target_compile_options(AlkaidSD PUBLIC /W4 /WX) 40 | target_compile_definitions(${PROJECT_NAME} PUBLIC DOCTEST_CONFIG_USE_STD_HEADERS) 41 | endif() 42 | endif() 43 | 44 | # ---- Add AlkaidSDTests ---- 45 | 46 | enable_testing() 47 | 48 | # Note: doctest and similar testing frameworks can automatically configure CMake tests. For other 49 | # testing frameworks add the tests target instead: add_test(NAME ${PROJECT_NAME} COMMAND 50 | # ${PROJECT_NAME}) 51 | 52 | include(${doctest_SOURCE_DIR}/scripts/cmake/doctest.cmake) 53 | doctest_discover_tests(${PROJECT_NAME}) 54 | 55 | # ---- code coverage ---- 56 | 57 | if(ENABLE_TEST_COVERAGE) 58 | target_compile_options(AlkaidSD PUBLIC -O0 -g -fprofile-arcs -ftest-coverage) 59 | target_link_options(AlkaidSD PUBLIC -fprofile-arcs -ftest-coverage) 60 | endif() 61 | -------------------------------------------------------------------------------- /src/random.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace alkaidsd { 7 | class Random { 8 | public: 9 | explicit Random(uint32_t seed) : s() { 10 | s[0] = seed; 11 | for (int i = 1; i < 4; ++i) { 12 | s[i] = static_cast(ScrambleWell(s[i - 1], i)); 13 | } 14 | } 15 | 16 | int NextInt(int a, int b) { return static_cast(NextInt(b - a + 1)) + a; } 17 | 18 | float NextFloat() { return (NextInt() >> 8u) * kFloatMultiplier; } 19 | 20 | template void Shuffle(RandomIt first, RandomIt last) { 21 | typename std::iterator_traits::difference_type i, n; 22 | n = last - first; 23 | for (i = n - 1; i > 0; --i) { 24 | std::swap(first[i], first[NextInt(0, static_cast(i))]); 25 | } 26 | } 27 | 28 | private: 29 | static constexpr uint64_t kPow32 = uint64_t(1) << 32u; 30 | static constexpr float kFloatMultiplier = 0x1.0p-24f; 31 | 32 | uint32_t s[4]; 33 | 34 | static uint32_t RotateLeft(const uint32_t x, uint32_t k) { return (x << k) | (x >> (32 - k)); } 35 | 36 | static uint64_t Scramble(uint64_t n, uint64_t multiple, uint32_t shift, uint32_t add) { 37 | return multiple * (n ^ (n >> shift)) + add; 38 | } 39 | 40 | static uint64_t ScrambleWell(uint64_t n, int add) { return Scramble(n, 1812433253, 30, add); } 41 | 42 | uint32_t NextInt() { 43 | const uint32_t result = RotateLeft(s[0] + s[3], 7) + s[0]; 44 | const uint32_t t = s[1] << 9u; 45 | s[2] ^= s[0]; 46 | s[3] ^= s[1]; 47 | s[1] ^= s[2]; 48 | s[0] ^= s[3]; 49 | s[2] ^= t; 50 | s[3] = RotateLeft(s[3], 11); 51 | return result; 52 | } 53 | 54 | uint32_t NextInt(uint32_t n) { 55 | uint64_t m = static_cast(NextInt()) * n; 56 | uint64_t l = m & 0xffffffff; 57 | if (l < n) { 58 | uint64_t t = kPow32 % n; 59 | while (l < t) { 60 | m = (NextInt() & 0xffffffff) * n; 61 | l = m & 0xffffffff; 62 | } 63 | } 64 | return m >> 32u; 65 | } 66 | }; 67 | } // namespace alkaidsd 68 | -------------------------------------------------------------------------------- /data/SET-3/p04_00.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 7 30 16 9 21 15 19 23 11 5 19 29 23 21 10 15 3 41 9 28 8 8 16 10 28 7 15 14 6 19 11 12 23 26 17 6 9 15 14 7 27 13 11 16 10 5 25 17 18 10 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p04_110.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 17 9 6 12 18 17 10 3 5 2 16 9 10 11 14 7 3 11 17 11 3 13 13 12 16 15 2 15 4 3 17 16 16 5 17 10 16 10 10 16 5 3 13 14 17 7 10 9 17 13 13 13 3 18 15 15 7 14 9 8 17 6 7 7 8 10 17 3 19 17 19 18 17 19 2 7 12 15 12 16 13 7 14 13 19 16 19 16 17 4 16 12 5 18 14 16 15 9 15 3 14 16 15 19 9 6 3 12 7 18 18 13 2 7 14 9 8 16 15 18 8 10 3 8 13 11 19 10 14 10 13 13 15 15 16 12 12 7 7 19 12 13 12 5 13 14 19 5 12 8 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /include/alkaidsd/intra_operator.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | 8 | namespace alkaidsd { 9 | class Random; 10 | class RouteContext; 11 | } // namespace alkaidsd 12 | 13 | namespace alkaidsd::intra_operator { 14 | /** 15 | * @brief Base class for intra-route operators. 16 | * 17 | * This class defines the interface for intra-route operators, which are used to modify a solution 18 | * by making changes within a single route. 19 | */ 20 | class IntraOperator { 21 | public: 22 | virtual ~IntraOperator() = default; 23 | 24 | /** 25 | * @brief Executes the intra-operator on a specific route within a solution. 26 | * @param instance The problem instance. 27 | * @param route_index The index of the route to apply the operator to. 28 | * @param solution The solution to modify. 29 | * @param context The route context. 30 | * @param random The random number generator. 31 | * @return True if the operator successfully modifies the solution, false otherwise. 32 | */ 33 | virtual bool operator()(const Instance &instance, Node route_index, AlkaidSolution &solution, 34 | RouteContext &context, Random &random) const = 0; 35 | }; 36 | 37 | /** 38 | * @brief Intra-route operator that performs an exchange between two nodes in a route. 39 | * 40 | * This operator swaps the positions of two nodes within a single route. 41 | */ 42 | class Exchange : public IntraOperator { 43 | public: 44 | bool operator()(const Instance &instance, Node route_index, AlkaidSolution &solution, 45 | RouteContext &context, Random &random) const override; 46 | }; 47 | 48 | /** 49 | * @brief Intra-route operator that performs the Or-Opt move on a route. 50 | * 51 | * This operator moves consecutive `num` nodes from one position in a route to another. 52 | */ 53 | template class OrOpt : public IntraOperator { 54 | public: 55 | bool operator()(const Instance &instance, Node route_index, AlkaidSolution &solution, 56 | RouteContext &context, Random &random) const override; 57 | }; 58 | } // namespace alkaidsd::intra_operator 59 | -------------------------------------------------------------------------------- /data/SET-3/p04_1030.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 54 35 29 42 56 54 39 24 28 21 52 35 38 40 48 31 23 40 54 41 24 45 46 43 51 49 21 51 26 24 54 52 53 28 53 39 51 39 39 53 27 22 45 46 55 31 39 37 53 44 46 46 23 56 49 49 32 48 36 33 55 30 32 31 34 39 54 23 59 54 57 55 53 59 22 33 43 48 42 52 46 31 47 45 59 51 59 52 54 24 52 43 27 57 47 51 50 37 50 24 46 51 50 58 37 28 23 42 32 56 56 46 20 32 47 35 34 53 50 57 33 39 22 35 46 41 58 39 47 38 45 44 51 49 51 43 42 32 32 57 42 44 43 27 46 47 59 28 42 34 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p04_1050.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 88 51 38 64 92 88 59 28 36 22 84 51 57 61 76 43 26 60 88 63 28 70 72 66 83 78 22 82 32 28 88 84 86 37 87 58 82 58 58 86 35 25 70 73 90 42 59 54 87 69 73 72 26 93 79 78 44 76 52 47 90 41 45 43 48 58 88 27 98 89 95 91 87 99 24 46 66 77 65 84 72 42 74 71 98 82 98 84 88 29 85 66 34 95 74 83 81 54 81 28 73 83 80 96 55 37 27 64 45 93 93 73 21 44 75 51 49 86 81 94 47 59 24 50 72 62 97 59 74 56 70 68 82 78 83 66 64 45 44 95 64 69 66 34 72 74 99 37 64 48 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p04_1090.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 156 83 56 109 165 157 99 37 53 25 149 83 94 103 132 67 33 101 156 107 36 121 124 113 147 137 25 144 44 36 156 148 152 54 155 96 144 97 97 153 50 30 121 126 160 65 99 89 155 119 126 125 32 167 139 136 69 132 84 74 161 62 70 67 76 96 156 34 177 158 171 163 154 179 28 72 113 135 111 148 125 65 129 122 177 144 177 149 156 39 150 112 49 170 129 146 143 88 142 36 127 147 140 172 90 55 34 109 70 167 167 126 22 69 130 82 79 153 142 168 74 98 28 81 124 105 175 99 129 93 121 117 144 136 146 112 109 71 68 171 109 119 113 49 125 128 179 55 109 77 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p04_3070.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 128 91 78 104 132 128 99 68 76 62 124 91 97 101 116 83 66 100 128 103 68 110 112 106 123 118 62 122 72 68 128 124 126 77 127 98 122 98 98 126 75 65 110 113 130 82 99 94 127 109 113 112 66 133 119 118 84 116 92 87 130 81 85 83 88 98 128 67 138 129 135 131 127 139 64 86 106 117 105 124 112 82 114 111 138 122 138 124 128 69 125 106 74 135 114 123 121 94 121 68 113 123 120 136 95 77 67 104 85 133 133 113 61 84 115 91 89 126 121 134 87 99 64 90 112 102 137 99 114 96 110 108 122 118 123 106 104 85 84 135 104 109 106 74 112 114 139 77 104 88 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /data/SET-1/SD13.txt: -------------------------------------------------------------------------------- 1 | 96 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 707 707 6 | 0 1000 7 | -707 707 8 | -1000 0 9 | -707 -707 10 | -0 -1000 11 | 707 -707 12 | 2000 0 13 | 1414 1414 14 | 0 2000 15 | -1414 1414 16 | -2000 0 17 | -1414 -1414 18 | -0 -2000 19 | 1414 -1414 20 | 3000 0 21 | 2121 2121 22 | 0 3000 23 | -2121 2121 24 | -3000 0 25 | -2122 -2121 26 | -0 -3000 27 | 2121 -2122 28 | 4000 0 29 | 2828 2828 30 | 0 4000 31 | -2828 2829 32 | -4000 0 33 | -2829 -2828 34 | -1 -4000 35 | 2828 -2829 36 | 5000 0 37 | 3536 3535 38 | 0 5000 39 | -3535 3536 40 | -5000 0 41 | -3536 -3535 42 | -1 -5000 43 | 3535 -3536 44 | 6000 0 45 | 4243 4243 46 | 0 6000 47 | -4242 4243 48 | -6000 1 49 | -4243 -4242 50 | -1 -6000 51 | 4242 -4243 52 | 7000 0 53 | 4950 4950 54 | 0 7000 55 | -4949 4950 56 | -7000 1 57 | -4950 -4949 58 | -1 -7000 59 | 4949 -4951 60 | 8000 0 61 | 5657 5657 62 | 0 8000 63 | -5656 5657 64 | -8000 1 65 | -5658 -5656 66 | -1 -8000 67 | 5656 -5658 68 | 9000 0 69 | 6364 6364 70 | 0 9000 71 | -6364 6364 72 | -9000 1 73 | -6365 -6363 74 | -1 -9000 75 | 6363 -6365 76 | 10000 0 77 | 7071 7071 78 | 0 10000 79 | -7071 7072 80 | -10000 1 81 | -7072 -7070 82 | -1 -10000 83 | 7070 -7072 84 | 11000 0 85 | 7778 7778 86 | 1 11000 87 | -7778 7779 88 | -11000 1 89 | -7779 -7777 90 | -2 -11000 91 | 7777 -7779 92 | 12000 0 93 | 8485 8485 94 | 1 12000 95 | -8485 8486 96 | -12000 1 97 | -8486 -8484 98 | -2 -12000 99 | 8484 -8487 100 | -------------------------------------------------------------------------------- /data/SET-3/p04_7090.cri: -------------------------------------------------------------------------------- 1 | 150 200 2 | 174 155 149 162 176 174 159 144 148 141 172 155 158 160 168 151 143 160 174 161 144 165 166 163 171 169 141 171 146 144 174 172 173 148 173 159 171 159 159 173 147 142 165 166 175 151 159 157 173 164 166 166 143 176 169 169 152 168 156 153 175 150 152 151 154 159 174 143 179 174 177 175 173 179 142 153 163 168 162 172 166 151 167 165 179 171 179 172 174 144 172 163 147 177 167 171 170 157 170 144 166 171 170 178 157 148 143 162 152 176 176 166 140 152 167 155 154 173 170 177 153 159 142 155 166 161 178 159 167 158 165 164 171 169 171 163 162 152 152 177 162 164 163 147 166 167 179 148 162 154 3 | 35 35 4 | 37 52 5 | 49 49 6 | 52 64 7 | 20 26 8 | 40 30 9 | 21 47 10 | 17 63 11 | 31 62 12 | 52 33 13 | 51 21 14 | 42 41 15 | 31 32 16 | 5 25 17 | 12 42 18 | 36 16 19 | 52 41 20 | 27 23 21 | 17 33 22 | 13 13 23 | 57 58 24 | 62 42 25 | 42 57 26 | 16 57 27 | 8 52 28 | 7 38 29 | 27 68 30 | 30 48 31 | 43 67 32 | 58 48 33 | 58 27 34 | 37 69 35 | 38 46 36 | 46 10 37 | 61 33 38 | 62 63 39 | 63 69 40 | 32 22 41 | 45 35 42 | 59 15 43 | 5 6 44 | 10 17 45 | 21 10 46 | 5 64 47 | 30 15 48 | 39 10 49 | 32 39 50 | 25 32 51 | 25 55 52 | 48 28 53 | 56 37 54 | 41 49 55 | 35 17 56 | 55 45 57 | 55 20 58 | 15 30 59 | 25 30 60 | 20 50 61 | 10 43 62 | 55 60 63 | 30 60 64 | 20 65 65 | 50 35 66 | 30 25 67 | 15 10 68 | 30 5 69 | 10 20 70 | 5 30 71 | 20 40 72 | 15 60 73 | 45 65 74 | 45 20 75 | 45 10 76 | 55 5 77 | 65 35 78 | 65 20 79 | 45 30 80 | 35 40 81 | 41 37 82 | 64 42 83 | 40 60 84 | 31 52 85 | 35 69 86 | 53 52 87 | 65 55 88 | 63 65 89 | 2 60 90 | 20 20 91 | 5 5 92 | 60 12 93 | 40 25 94 | 42 7 95 | 24 12 96 | 23 3 97 | 11 14 98 | 6 38 99 | 2 48 100 | 8 56 101 | 13 52 102 | 6 68 103 | 47 47 104 | 49 58 105 | 27 43 106 | 37 31 107 | 57 29 108 | 63 23 109 | 53 12 110 | 32 12 111 | 36 26 112 | 21 24 113 | 17 34 114 | 12 24 115 | 24 58 116 | 27 69 117 | 15 77 118 | 62 77 119 | 49 73 120 | 67 5 121 | 56 39 122 | 37 47 123 | 37 56 124 | 57 68 125 | 47 16 126 | 44 17 127 | 46 13 128 | 49 11 129 | 49 42 130 | 53 43 131 | 61 52 132 | 57 48 133 | 56 37 134 | 55 54 135 | 15 47 136 | 14 37 137 | 11 31 138 | 16 22 139 | 4 18 140 | 28 18 141 | 26 52 142 | 26 35 143 | 31 67 144 | 15 19 145 | 22 22 146 | 18 24 147 | 26 27 148 | 25 24 149 | 22 27 150 | 25 21 151 | 19 21 152 | 20 26 153 | 18 18 -------------------------------------------------------------------------------- /src/cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | #include "route_context.h" 12 | 13 | namespace alkaidsd { 14 | class Cache { 15 | public: 16 | virtual ~Cache() = default; 17 | virtual void Reset(const alkaidsd::AlkaidSolution &solution, const alkaidsd::RouteContext &context) 18 | = 0; 19 | virtual void AddRoute(alkaidsd::Node route_index) = 0; 20 | virtual void RemoveRoute(alkaidsd::Node route_index) = 0; 21 | virtual void MoveRoute(alkaidsd::Node dest_route_index, alkaidsd::Node src_route_index) = 0; 22 | virtual void Save(const alkaidsd::AlkaidSolution &solution, const alkaidsd::RouteContext &context) 23 | = 0; 24 | }; 25 | 26 | class CacheMap : public Cache { 27 | public: 28 | template 29 | T &Get(const alkaidsd::AlkaidSolution &solution, const alkaidsd::RouteContext &context) { 30 | auto it = caches_.find(typeid(T)); 31 | if (it == caches_.end()) { 32 | auto cache = std::make_unique(); 33 | cache->Reset(solution, context); 34 | auto &cache_ref = *cache; 35 | caches_.emplace(typeid(T), std::move(cache)); 36 | return cache_ref; 37 | } 38 | return *static_cast(it->second.get()); 39 | } 40 | void Reset(const alkaidsd::AlkaidSolution &solution, const alkaidsd::RouteContext &context) override { 41 | for (auto &[_, cache] : caches_) { 42 | cache->Reset(solution, context); 43 | } 44 | } 45 | void AddRoute(alkaidsd::Node route_index) override { 46 | for (auto &[_, cache] : caches_) { 47 | cache->AddRoute(route_index); 48 | } 49 | } 50 | void RemoveRoute(alkaidsd::Node route_index) override { 51 | for (auto &[_, cache] : caches_) { 52 | cache->RemoveRoute(route_index); 53 | } 54 | } 55 | void MoveRoute(alkaidsd::Node dest_route_index, alkaidsd::Node src_route_index) override { 56 | for (auto &[_, cache] : caches_) { 57 | cache->MoveRoute(dest_route_index, src_route_index); 58 | } 59 | } 60 | void Save(const alkaidsd::AlkaidSolution &solution, const alkaidsd::RouteContext &context) override { 61 | for (auto &[_, cache] : caches_) { 62 | cache->Save(solution, context); 63 | } 64 | } 65 | 66 | private: 67 | std::unordered_map> caches_; 68 | }; 69 | } // namespace alkaidsd 70 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.14...3.22) 2 | 3 | # ---- Project ---- 4 | 5 | # Note: update this to your new project's name and version 6 | project( 7 | AlkaidSD 8 | VERSION 1.0 9 | LANGUAGES CXX 10 | ) 11 | 12 | # ---- Include guards ---- 13 | 14 | if(PROJECT_SOURCE_DIR STREQUAL PROJECT_BINARY_DIR) 15 | message( 16 | FATAL_ERROR 17 | "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there." 18 | ) 19 | endif() 20 | 21 | # ---- Add dependencies via CPM ---- 22 | # see https://github.com/TheLartians/CPM.cmake for more info 23 | 24 | include(cmake/CPM.cmake) 25 | 26 | # PackageProject.cmake will be used to make our target installable 27 | CPMAddPackage("gh:TheLartians/PackageProject.cmake@1.11.1") 28 | 29 | # ---- Add source files ---- 30 | 31 | # Note: globbing sources is considered bad practice as CMake's generators may not detect new files 32 | # automatically. Keep that in mind when changing files, or explicitly mention them here. 33 | file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h") 34 | file(GLOB_RECURSE sources CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp") 35 | 36 | # ---- Create library ---- 37 | 38 | # Note: for header-only libraries change all PUBLIC flags to INTERFACE and create an interface 39 | # target: add_library(${PROJECT_NAME} INTERFACE) 40 | add_library(${PROJECT_NAME} ${headers} ${sources}) 41 | set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17) 42 | 43 | # being a cross-platform target, we enforce standards conformance on MSVC 44 | target_compile_options(${PROJECT_NAME} PUBLIC "$<$:/permissive->") 45 | 46 | target_include_directories( 47 | ${PROJECT_NAME} PUBLIC $ 48 | $ 49 | ) 50 | 51 | # ---- Create an installable target ---- 52 | # this allows users to install and find the library via `find_package()`. 53 | 54 | # the location where the project's version header will be placed should match the project's regular 55 | # header paths 56 | string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION) 57 | 58 | packageProject( 59 | NAME ${PROJECT_NAME} 60 | VERSION ${PROJECT_VERSION} 61 | NAMESPACE ${PROJECT_NAME} 62 | BINARY_DIR ${PROJECT_BINARY_DIR} 63 | INCLUDE_DIR ${PROJECT_SOURCE_DIR}/include 64 | INCLUDE_DESTINATION include/${PROJECT_NAME}-${PROJECT_VERSION} 65 | VERSION_HEADER "${VERSION_HEADER_LOCATION}" 66 | COMPATIBILITY SameMajorVersion 67 | ) 68 | -------------------------------------------------------------------------------- /src/repair.cpp: -------------------------------------------------------------------------------- 1 | #include "repair.h" 2 | 3 | #include 4 | 5 | namespace alkaidsd { 6 | void MergeAdjacentSameCustomers([[maybe_unused]] const Instance &instance, Node route_index, 7 | AlkaidSolution &solution, RouteContext &context) { 8 | Node node_index = context.Head(route_index); 9 | while (true) { 10 | Node successor = solution.Successor(node_index); 11 | if (!successor) { 12 | break; 13 | } 14 | if (solution.Customer(node_index) == solution.Customer(successor)) { 15 | solution.SetLoad(node_index, solution.Load(node_index) + solution.Load(successor)); 16 | solution.Remove(successor); 17 | } else { 18 | node_index = successor; 19 | } 20 | } 21 | } 22 | 23 | int CalcRemovalDelta(const Instance &instance, const AlkaidSolution &solution, Node node_index) { 24 | Node predecessor = solution.Predecessor(node_index); 25 | Node successor = solution.Successor(node_index); 26 | return instance.distance_matrix[solution.Customer(predecessor)][solution.Customer(successor)] 27 | - instance.distance_matrix[solution.Customer(predecessor)][solution.Customer(node_index)] 28 | - instance.distance_matrix[solution.Customer(node_index)][solution.Customer(successor)]; 29 | } 30 | 31 | void Repair(const Instance &instance, Node route_index, AlkaidSolution &solution, RouteContext &context) { 32 | if (!context.Head(route_index)) { 33 | return; 34 | } 35 | MergeAdjacentSameCustomers(instance, route_index, solution, context); 36 | std::map customer_node_map; 37 | Node node_index = context.Head(route_index); 38 | solution.SetSuccessor(0, node_index); 39 | while (node_index) { 40 | Node successor = solution.Successor(node_index); 41 | Node customer = solution.Customer(node_index); 42 | auto it = customer_node_map.find(customer); 43 | if (it == customer_node_map.end()) { 44 | customer_node_map[customer] = node_index; 45 | } else { 46 | Node &last_node_index = it->second; 47 | if (CalcRemovalDelta(instance, solution, last_node_index) 48 | < CalcRemovalDelta(instance, solution, node_index)) { 49 | std::swap(last_node_index, node_index); 50 | } 51 | solution.SetLoad(last_node_index, 52 | solution.Load(last_node_index) + solution.Load(node_index)); 53 | solution.Remove(node_index); 54 | } 55 | node_index = successor; 56 | } 57 | context.SetHead(route_index, solution.Successor(0)); 58 | context.UpdateRouteContext(solution, route_index, 0); 59 | } 60 | } // namespace alkaidsd 61 | -------------------------------------------------------------------------------- /src/split_reinsertion.cpp: -------------------------------------------------------------------------------- 1 | #include "split_reinsertion.h" 2 | 3 | #include 4 | #include 5 | 6 | #include "utils.h" 7 | 8 | namespace alkaidsd { 9 | struct SplitReinsertionMove { 10 | InsertionWithCost insertion; 11 | int residual; 12 | SplitReinsertionMove(const InsertionWithCost &insertion, int residual) 13 | : insertion(insertion), residual(residual) {} 14 | }; 15 | 16 | void SplitReinsertion(const Instance &instance, Node customer, int demand, double blink_rate, 17 | AlkaidSolution &solution, RouteContext &context, Random &random) { 18 | auto func = [&](Node predecessor, Node successor, Node customer) { 19 | Node pre_customer = solution.Customer(predecessor); 20 | Node suc_customer = solution.Customer(successor); 21 | return instance.distance_matrix[customer][pre_customer] 22 | + instance.distance_matrix[customer][suc_customer] 23 | - instance.distance_matrix[pre_customer][suc_customer]; 24 | }; 25 | std::vector moves; 26 | moves.reserve(context.NumRoutes()); 27 | int sum_residual = 0; 28 | for (Node route_index = 0; route_index < context.NumRoutes(); ++route_index) { 29 | int residual = std::min(demand, instance.capacity - context.Load(route_index)); 30 | if (residual > 0) { 31 | auto insertion = CalcBestInsertion(solution, func, context, route_index, customer, random); 32 | moves.emplace_back(insertion, residual); 33 | sum_residual += residual; 34 | } 35 | } 36 | if (sum_residual < demand) { 37 | return; 38 | } 39 | std::stable_sort(moves.begin(), moves.end(), 40 | [](const SplitReinsertionMove &lhs, const SplitReinsertionMove &rhs) { 41 | return lhs.insertion.cost.value * rhs.residual 42 | < rhs.insertion.cost.value * lhs.residual; 43 | }); 44 | for (const auto &move : moves) { 45 | sum_residual -= move.residual; 46 | if (sum_residual >= demand && random.NextFloat() < blink_rate) { 47 | continue; 48 | } 49 | int load = std::min(demand, move.residual); 50 | Node node_index 51 | = solution.Insert(customer, load, move.insertion.predecessor, move.insertion.successor); 52 | if (move.insertion.predecessor == 0) { 53 | context.SetHead(move.insertion.route_index, node_index); 54 | } 55 | context.UpdateRouteContext(solution, move.insertion.route_index, move.insertion.predecessor); 56 | demand -= load; 57 | if (demand == 0) { 58 | break; 59 | } 60 | } 61 | } 62 | } // namespace alkaidsd 63 | -------------------------------------------------------------------------------- /include/alkaidsd/config.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace alkaidsd { 14 | /** 15 | * @class Listener 16 | * @brief Interface for listening to events during the optimization process. 17 | */ 18 | class Listener { 19 | public: 20 | /** 21 | * @brief Virtual destructor for the Listener class. 22 | */ 23 | virtual ~Listener() = default; 24 | 25 | /** 26 | * @brief Called when the optimization process starts. 27 | */ 28 | virtual void OnStart() = 0; 29 | 30 | /** 31 | * @brief Called when the solution is updated during the optimization process. 32 | * @param solution The updated solution. 33 | * @param objective The objective value of the updated solution. 34 | */ 35 | virtual void OnUpdated(const AlkaidSolution &solution, int objective) = 0; 36 | 37 | /** 38 | * @brief Called when the optimization process ends. 39 | * @param solution The final solution. 40 | * @param objective The objective value of the final solution. 41 | */ 42 | virtual void OnEnd(const AlkaidSolution &solution, int objective) = 0; 43 | }; 44 | 45 | /** 46 | * @struct Config 47 | * @brief General configuration options for the optimization process. 48 | */ 49 | struct Config { 50 | uint32_t random_seed; /**< The random seed for the optimization process. */ 51 | double time_limit; /**< The time limit (in seconds) for the optimization process. */ 52 | }; 53 | 54 | /** 55 | * @struct AlkaidConfig 56 | * @brief Configuration options for the AlkaidSolver optimization process. 57 | */ 58 | struct AlkaidConfig : public Config { 59 | double blink_rate; /**< The blink rate for the SplitReinsertion process. */ 60 | std::vector> 61 | inter_operators; /**< The inter-operators for optimizing the solution. */ 62 | std::vector> 63 | intra_operators; /**< The intra-operators for optimizing the solution. */ 64 | std::function()> 65 | acceptance_rule; /**< The acceptance rule for accepting new solutions. */ 66 | std::unique_ptr 67 | ruin_method; /**< The ruin method for destroying parts of the solution. */ 68 | sorter::Sorter sorter; /**< The sorter for sorting customers during the perturbation process. */ 69 | std::unique_ptr listener; /**< The listener for receiving optimization events. */ 70 | }; 71 | } // namespace alkaidsd 72 | -------------------------------------------------------------------------------- /example-config.ini: -------------------------------------------------------------------------------- 1 | ; Specifies the path to the problem input file. 2 | input = data/SET-1/SD21.txt 3 | 4 | ; Specifies the name of the output file where the solution will be written. 5 | output = solution.txt 6 | 7 | ; Sets the seed value for the random number generator used by the algorithm. 8 | random-seed = 42 9 | 10 | ; Specifies the maximum time limit (in seconds) for the algorithm to run. 11 | time-limit = 1800 12 | 13 | ; Sets the blink rate for the SplitReinsertion process. 14 | blink-rate = 0.021 15 | 16 | ; Specifies the list of inter-route operators to be used by the algorithm. 17 | ; Possible inter-route operators are: 18 | ; - Swap<2, 0> 19 | ; - Swap<2, 1> 20 | ; - Swap<2, 2> 21 | ; - Relocate 22 | ; - SwapStar 23 | ; - Cross 24 | ; - SdSwapStar 25 | ; - SdSwapOneOne 26 | ; - SdSwapTwoOne 27 | inter-operators = ["Relocate", "Swap<2, 0>", "Swap<2, 1>", "Swap<2, 2>", "Cross", "SwapStar", "SdSwapStar"] 28 | 29 | ; Specifies the list of intra-route operators to be used by the algorithm. 30 | ; Possible intra-route operators are: 31 | ; - Exchange 32 | ; - OrOpt<1> 33 | ; - OrOpt<2> 34 | ; - OrOpt<3> 35 | intra-operators = ["Exchange", "OrOpt<1>"] 36 | 37 | ; Specifies the type and arguments of acceptance rule to be used by the algorithm. 38 | ; Possible acceptance rules are: 39 | ; - HC: Hill Climbing 40 | ; - HCWE: Hill Climbing With Equal 41 | ; - LAHC: Late Acceptance Hill Climbing 42 | ; - length: the length of the history list. 43 | ; - SA: Simulated Annealing 44 | ; - initial_temperature: the initial temperature. 45 | ; - decay: the decay rate. 46 | acceptance-rule-type = "LAHC" 47 | acceptance-rule-args = ["length=83"] 48 | 49 | ; Specifies the type and arguments of ruin method to be used by the algorithm. 50 | ; Possible ruin methods are: 51 | ; - SISRs: Slack Induction by String Removals 52 | ; - average_customers: the average number of customers to be removed. 53 | ; - max_length: the maximum length of the route to be removed. 54 | ; - split_rate: the split rate. 55 | ; - preserved_probability: the probability of preserving a node. 56 | ; - Random: Random Ruin 57 | ; - args are integer values representing all possible ruin sizes. 58 | ruin-method-type = "SISRs" 59 | ruin-method-args = ["average_customers=36", "max_length=8", "split_rate=0.740", "preserved_probability=0.096"] 60 | 61 | ; Specifies the list of sorters to be used by the perturbation process. 62 | ; Possible sorters are: 63 | ; - random: randomly shuffles customers. 64 | ; - demand: sorts customers based on their demand in descending order. 65 | ; - far: sorts customers based on their distance to the depot in descending order. 66 | ; - close: sorts customers based on their distance to the depot in increasing order. 67 | sorters = ["random=0.078", "demand=0.225", "far=0.942", "close=0.120"] 68 | -------------------------------------------------------------------------------- /data/SET-1/SD14.txt: -------------------------------------------------------------------------------- 1 | 120 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 866 500 6 | 500 866 7 | 0 1000 8 | -500 866 9 | -866 500 10 | -1000 0 11 | -866 -500 12 | -500 -866 13 | -0 -1000 14 | 500 -866 15 | 866 -500 16 | 2000 0 17 | 1732 1000 18 | 1000 1732 19 | 0 2000 20 | -1000 1732 21 | -1732 1000 22 | -2000 0 23 | -1732 -1000 24 | -1000 -1732 25 | -0 -2000 26 | 1000 -1732 27 | 1732 -1000 28 | 3000 0 29 | 2598 1500 30 | 1500 2598 31 | 0 3000 32 | -1500 2598 33 | -2598 1500 34 | -3000 0 35 | -2598 -1500 36 | -1500 -2598 37 | -0 -3000 38 | 1500 -2598 39 | 2598 -1500 40 | 4000 0 41 | 3464 2000 42 | 2000 3464 43 | 0 4000 44 | -2000 3464 45 | -3464 2000 46 | -4000 0 47 | -3464 -2000 48 | -2000 -3464 49 | -1 -4000 50 | 1999 -3464 51 | 3464 -2001 52 | 5000 0 53 | 4330 2500 54 | 2500 4330 55 | 0 5000 56 | -2500 4330 57 | -4330 2500 58 | -5000 0 59 | -4330 -2500 60 | -2501 -4330 61 | -1 -5000 62 | 2499 -4331 63 | 4330 -2501 64 | 6000 0 65 | 5196 3000 66 | 3000 5196 67 | 0 6000 68 | -3000 5196 69 | -5196 3000 70 | -6000 1 71 | -5196 -2999 72 | -3001 -5196 73 | -1 -6000 74 | 2999 -5197 75 | 5196 -3001 76 | 7000 0 77 | 6062 3500 78 | 3500 6062 79 | 0 7000 80 | -3500 6062 81 | -6062 3500 82 | -7000 1 83 | -6063 -3499 84 | -3501 -6062 85 | -1 -7000 86 | 3499 -6063 87 | 6062 -3501 88 | 8000 0 89 | 6928 4000 90 | 4000 6928 91 | 0 8000 92 | -4000 6928 93 | -6928 4001 94 | -8000 1 95 | -6929 -3999 96 | -4001 -6928 97 | -1 -8000 98 | 3999 -6929 99 | 6928 -4001 100 | 9000 0 101 | 7794 4500 102 | 4500 7794 103 | 0 9000 104 | -4500 7795 105 | -7794 4501 106 | -9000 1 107 | -7795 -4499 108 | -4501 -7794 109 | -1 -9000 110 | 4499 -7795 111 | 7793 -4501 112 | 10000 0 113 | 8660 5000 114 | 5000 8660 115 | 0 10000 116 | -4999 8661 117 | -8660 5001 118 | -10000 1 119 | -8661 -4999 120 | -5001 -8660 121 | -1 -10000 122 | 4999 -8661 123 | 8659 -5001 124 | -------------------------------------------------------------------------------- /include/alkaidsd/acceptance_rule.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | namespace alkaidsd { 7 | class Random; 8 | } // namespace alkaidsd 9 | 10 | namespace alkaidsd::acceptance_rule { 11 | /** 12 | * @brief This class defines the interface for acceptance rules used 13 | * in algorithms that involve accepting or rejecting new values based 14 | * on certain criteria. 15 | */ 16 | class AcceptanceRule { 17 | public: 18 | /** 19 | * @brief Destructor for the AcceptanceRule class. 20 | */ 21 | virtual ~AcceptanceRule() = default; 22 | 23 | /** 24 | * @brief Determines whether a new value should be accepted or rejected. 25 | * 26 | * This method is called to determine whether a new value should be accepted 27 | * or rejected based on the old value, the new value, and a random number generator. 28 | * 29 | * @param old_value The old value. 30 | * @param new_value The new value. 31 | * @param random The random number generator. 32 | * @return true if the new value should be accepted, false otherwise. 33 | */ 34 | virtual bool Accept(int old_value, int new_value, Random &random) = 0; 35 | }; 36 | 37 | /** 38 | * @brief A class comparing the new value with the old value and accepts it if 39 | * the new value is smaller than the old value. 40 | */ 41 | class HillClimbing : public AcceptanceRule { 42 | public: 43 | bool Accept(int old_value, int new_value, [[maybe_unused]] Random &random) override; 44 | }; 45 | 46 | /** 47 | * @brief A class comparing the new value with the old value and 48 | * accepts it if the new value is smaller than or equal to the old value. 49 | */ 50 | class HillClimbingWithEqual : public AcceptanceRule { 51 | public: 52 | bool Accept(int old_value, int new_value, [[maybe_unused]] Random &random) override; 53 | }; 54 | 55 | /** 56 | * @brief A class representing the Late Acceptance Hill Climbing acceptance rule. 57 | */ 58 | class LateAcceptanceHillClimbing : public AcceptanceRule { 59 | public: 60 | explicit LateAcceptanceHillClimbing(int length) 61 | : length_(length), position_(0), values_(length, std::numeric_limits::max()) {} 62 | 63 | bool Accept(int old_value, int new_value, [[maybe_unused]] Random &random) override; 64 | 65 | private: 66 | int length_; 67 | int position_; 68 | std::vector values_; 69 | }; 70 | 71 | /** 72 | * @brief A class representing the Simulated Annealing acceptance rule. 73 | */ 74 | class SimulatedAnnealing : public AcceptanceRule { 75 | public: 76 | SimulatedAnnealing(double initial_temperature, double decay) 77 | : temperature_(initial_temperature), decay_(decay) {} 78 | 79 | bool Accept(int old_value, int new_value, Random &random) override; 80 | 81 | private: 82 | double temperature_; 83 | double decay_; 84 | }; 85 | } // namespace alkaidsd::acceptance_rule 86 | -------------------------------------------------------------------------------- /data/SET-3/p05_110.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 17 9 6 12 18 17 10 3 5 2 16 9 10 11 14 7 3 11 17 11 3 13 13 12 16 15 2 15 4 3 17 16 16 5 17 10 16 10 10 16 5 3 13 14 17 7 10 9 17 13 13 13 3 18 15 15 7 14 9 8 17 6 7 7 8 10 17 3 19 17 19 18 17 19 2 7 12 15 12 16 13 7 14 13 19 16 19 16 17 4 16 12 5 18 14 16 15 9 15 3 14 16 15 19 9 6 3 12 7 18 18 13 2 7 14 9 8 16 15 18 8 10 3 8 13 11 19 10 14 10 13 13 15 15 16 12 12 7 7 19 12 13 12 5 13 14 19 5 12 8 10 3 19 9 10 2 14 4 5 11 2 4 2 4 2 15 19 6 2 2 15 10 13 5 13 9 13 11 10 17 13 7 12 6 6 15 17 5 10 9 10 18 18 5 3 12 17 14 7 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_110.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 17 9 6 12 18 17 10 3 5 2 16 9 10 11 14 7 3 11 17 11 3 13 13 12 16 15 2 15 4 3 17 16 16 5 17 10 16 10 10 16 5 3 13 14 17 7 10 9 17 13 13 13 3 18 15 15 7 14 9 8 17 6 7 7 8 10 17 3 19 17 19 18 17 19 2 7 12 15 12 16 13 7 14 13 19 16 19 16 17 4 16 12 5 18 14 16 15 9 15 3 14 16 15 19 9 6 3 12 7 18 18 13 2 7 14 9 8 16 15 18 8 10 3 8 13 11 19 10 14 10 13 13 15 15 16 12 12 7 7 19 12 13 12 5 13 14 19 5 12 8 10 3 19 9 10 2 14 4 5 11 2 4 2 4 2 15 19 6 2 2 15 10 13 5 13 9 13 11 10 17 13 7 12 6 6 15 17 5 10 9 10 18 18 5 3 12 17 14 7 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p05_00.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 7 30 16 9 21 15 19 23 11 5 19 29 23 21 10 15 3 41 9 28 8 8 16 10 28 7 15 14 6 19 11 12 23 26 17 6 9 15 14 7 27 13 11 16 10 5 25 17 18 10 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_00.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 18 26 11 30 21 19 15 16 29 26 37 16 12 31 8 19 20 13 15 22 28 12 6 27 14 18 17 29 13 22 25 28 27 19 10 12 14 24 16 33 15 11 18 17 21 27 19 20 5 7 30 16 9 21 15 19 23 11 5 19 29 23 21 10 15 3 41 9 28 8 8 16 10 28 7 15 14 6 19 11 12 23 26 17 6 9 15 14 7 27 13 11 16 10 5 25 17 18 10 10 7 13 19 26 3 5 9 16 16 12 19 23 20 8 19 2 12 17 9 11 18 29 3 6 17 16 16 9 21 27 23 11 14 8 5 8 16 31 9 5 5 7 18 16 1 27 36 30 13 10 9 14 18 2 6 7 18 28 3 13 19 10 9 20 25 25 36 6 5 15 25 9 8 18 13 14 3 23 6 26 16 11 7 41 35 26 9 15 3 1 2 22 27 20 11 12 10 9 17 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p05_1030.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 54 35 29 42 56 54 39 24 28 21 52 35 38 40 48 31 23 40 54 41 24 45 46 43 51 49 21 51 26 24 54 52 53 28 53 39 51 39 39 53 27 22 45 46 55 31 39 37 53 44 46 46 23 56 49 49 32 48 36 33 55 30 32 31 34 39 54 23 59 54 57 55 53 59 22 33 43 48 42 52 46 31 47 45 59 51 59 52 54 24 52 43 27 57 47 51 50 37 50 24 46 51 50 58 37 28 23 42 32 56 56 46 20 32 47 35 34 53 50 57 33 39 22 35 46 41 58 39 47 38 45 44 51 49 51 43 42 32 32 57 42 44 43 27 46 47 59 28 42 34 39 24 59 37 37 21 47 24 28 41 20 25 21 25 20 50 59 29 21 20 50 38 44 28 44 37 45 41 38 53 46 32 43 30 30 50 53 28 38 36 39 56 56 26 22 43 54 47 32 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p05_1050.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 88 51 38 64 92 88 59 28 36 22 84 51 57 61 76 43 26 60 88 63 28 70 72 66 83 78 22 82 32 28 88 84 86 37 87 58 82 58 58 86 35 25 70 73 90 42 59 54 87 69 73 72 26 93 79 78 44 76 52 47 90 41 45 43 48 58 88 27 98 89 95 91 87 99 24 46 66 77 65 84 72 42 74 71 98 82 98 84 88 29 85 66 34 95 74 83 81 54 81 28 73 83 80 96 55 37 27 64 45 93 93 73 21 44 75 51 49 86 81 94 47 59 24 50 72 62 97 59 74 56 70 68 82 78 83 66 64 45 44 95 64 69 66 34 72 74 99 37 64 48 58 28 98 54 55 22 75 29 36 62 20 31 22 30 20 81 99 38 22 20 81 57 69 37 69 54 70 62 56 87 72 44 67 41 40 81 87 37 57 53 59 93 92 33 25 66 89 75 45 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_1030.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 54 35 29 42 56 54 39 24 28 21 52 35 38 40 48 31 23 40 54 41 24 45 46 43 51 49 21 51 26 24 54 52 53 28 53 39 51 39 39 53 27 22 45 46 55 31 39 37 53 44 46 46 23 56 49 49 32 48 36 33 55 30 32 31 34 39 54 23 59 54 57 55 53 59 22 33 43 48 42 52 46 31 47 45 59 51 59 52 54 24 52 43 27 57 47 51 50 37 50 24 46 51 50 58 37 28 23 42 32 56 56 46 20 32 47 35 34 53 50 57 33 39 22 35 46 41 58 39 47 38 45 44 51 49 51 43 42 32 32 57 42 44 43 27 46 47 59 28 42 34 39 24 59 37 37 21 47 24 28 41 20 25 21 25 20 50 59 29 21 20 50 38 44 28 44 37 45 41 38 53 46 32 43 30 30 50 53 28 38 36 39 56 56 26 22 43 54 47 32 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_1050.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 88 51 38 64 92 88 59 28 36 22 84 51 57 61 76 43 26 60 88 63 28 70 72 66 83 78 22 82 32 28 88 84 86 37 87 58 82 58 58 86 35 25 70 73 90 42 59 54 87 69 73 72 26 93 79 78 44 76 52 47 90 41 45 43 48 58 88 27 98 89 95 91 87 99 24 46 66 77 65 84 72 42 74 71 98 82 98 84 88 29 85 66 34 95 74 83 81 54 81 28 73 83 80 96 55 37 27 64 45 93 93 73 21 44 75 51 49 86 81 94 47 59 24 50 72 62 97 59 74 56 70 68 82 78 83 66 64 45 44 95 64 69 66 34 72 74 99 37 64 48 58 28 98 54 55 22 75 29 36 62 20 31 22 30 20 81 99 38 22 20 81 57 69 37 69 54 70 62 56 87 72 44 67 41 40 81 87 37 57 53 59 93 92 33 25 66 89 75 45 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /src/inter_operator/base_cache.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | #include 5 | 6 | #include "../cache.h" 7 | #include "../delta.h" 8 | #include "../route_context.h" 9 | 10 | namespace alkaidsd::inter_operator { 11 | template struct BaseCache { 12 | bool invalidated = true; 13 | Delta delta; 14 | T move; 15 | 16 | bool TryReuse() { 17 | if (!invalidated) { 18 | return true; 19 | } 20 | invalidated = false; 21 | delta = Delta(); 22 | return false; 23 | } 24 | }; 25 | 26 | template class InterRouteCache : public Cache { 27 | public: 28 | void Reset([[maybe_unused]] const AlkaidSolution &solution, const RouteContext &context) override { 29 | max_index_ = context.NumRoutes(); 30 | matrix_.resize(context.NumRoutes()); 31 | route_index_mappings_.resize(context.NumRoutes()); 32 | route_pool_.clear(); 33 | unused_indices_.clear(); 34 | for (Node i = 0; i < context.NumRoutes(); ++i) { 35 | matrix_[i].resize(context.NumRoutes()); 36 | route_index_mappings_[i] = i; 37 | route_pool_.emplace_back(i); 38 | for (Node j = 0; j < context.NumRoutes(); ++j) { 39 | matrix_[i][j].invalidated = true; 40 | } 41 | } 42 | } 43 | 44 | void AddRoute(Node route_index) override { 45 | Node index; 46 | if (unused_indices_.empty()) { 47 | index = max_index_++; 48 | route_index_mappings_.resize(max_index_); 49 | matrix_.resize(max_index_); 50 | for (Node i = 0; i < max_index_; ++i) { 51 | matrix_[i].resize(max_index_); 52 | } 53 | } else { 54 | index = unused_indices_.back(); 55 | unused_indices_.pop_back(); 56 | } 57 | route_index_mappings_[route_index] = index; 58 | route_pool_.emplace_back(index); 59 | for (Node other : route_pool_) { 60 | matrix_[index][other].invalidated = true; 61 | matrix_[other][index].invalidated = true; 62 | } 63 | } 64 | 65 | void RemoveRoute(Node route_index) override { 66 | Node index = route_index_mappings_[route_index]; 67 | route_pool_.erase(std::find(route_pool_.begin(), route_pool_.end(), index)); 68 | unused_indices_.emplace_back(index); 69 | } 70 | 71 | void MoveRoute(Node dest_route_index, Node src_route_index) override { 72 | route_index_mappings_[dest_route_index] = route_index_mappings_[src_route_index]; 73 | } 74 | 75 | void Save([[maybe_unused]] const AlkaidSolution &solution, 76 | [[maybe_unused]] const RouteContext &context) override {} 77 | 78 | BaseCache &Get(Node route_a, Node route_b) { 79 | return matrix_[route_index_mappings_[route_a]][route_index_mappings_[route_b]]; 80 | } 81 | 82 | private: 83 | std::vector>> matrix_; 84 | std::vector route_index_mappings_; 85 | std::vector route_pool_; 86 | std::vector unused_indices_; 87 | Node max_index_{}; 88 | }; 89 | } // namespace alkaidsd::inter_operator 90 | -------------------------------------------------------------------------------- /data/SET-3/p05_1090.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 156 83 56 109 165 157 99 37 53 25 149 83 94 103 132 67 33 101 156 107 36 121 124 113 147 137 25 144 44 36 156 148 152 54 155 96 144 97 97 153 50 30 121 126 160 65 99 89 155 119 126 125 32 167 139 136 69 132 84 74 161 62 70 67 76 96 156 34 177 158 171 163 154 179 28 72 113 135 111 148 125 65 129 122 177 144 177 149 156 39 150 112 49 170 129 146 143 88 142 36 127 147 140 172 90 55 34 109 70 167 167 126 22 69 130 82 79 153 142 168 74 98 28 81 124 105 175 99 129 93 121 117 144 136 146 112 109 71 68 171 109 119 113 49 125 128 179 55 109 77 97 37 177 89 91 25 130 39 53 105 20 42 25 41 21 143 178 56 24 20 143 95 118 54 118 88 121 104 92 155 124 68 115 62 60 142 154 55 94 87 98 166 164 47 31 113 159 130 70 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p05_3070.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 128 91 78 104 132 128 99 68 76 62 124 91 97 101 116 83 66 100 128 103 68 110 112 106 123 118 62 122 72 68 128 124 126 77 127 98 122 98 98 126 75 65 110 113 130 82 99 94 127 109 113 112 66 133 119 118 84 116 92 87 130 81 85 83 88 98 128 67 138 129 135 131 127 139 64 86 106 117 105 124 112 82 114 111 138 122 138 124 128 69 125 106 74 135 114 123 121 94 121 68 113 123 120 136 95 77 67 104 85 133 133 113 61 84 115 91 89 126 121 134 87 99 64 90 112 102 137 99 114 96 110 108 122 118 123 106 104 85 84 135 104 109 106 74 112 114 139 77 104 88 98 68 138 94 95 62 115 69 76 102 60 71 62 70 60 121 139 78 62 60 121 97 109 77 109 94 110 102 96 127 112 84 107 81 80 121 127 77 97 93 99 133 132 73 65 106 129 115 85 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_1090.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 156 83 56 109 165 157 99 37 53 25 149 83 94 103 132 67 33 101 156 107 36 121 124 113 147 137 25 144 44 36 156 148 152 54 155 96 144 97 97 153 50 30 121 126 160 65 99 89 155 119 126 125 32 167 139 136 69 132 84 74 161 62 70 67 76 96 156 34 177 158 171 163 154 179 28 72 113 135 111 148 125 65 129 122 177 144 177 149 156 39 150 112 49 170 129 146 143 88 142 36 127 147 140 172 90 55 34 109 70 167 167 126 22 69 130 82 79 153 142 168 74 98 28 81 124 105 175 99 129 93 121 117 144 136 146 112 109 71 68 171 109 119 113 49 125 128 179 55 109 77 97 37 177 89 91 25 130 39 53 105 20 42 25 41 21 143 178 56 24 20 143 95 118 54 118 88 121 104 92 155 124 68 115 62 60 142 154 55 94 87 98 166 164 47 31 113 159 130 70 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_3070.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 128 91 78 104 132 128 99 68 76 62 124 91 97 101 116 83 66 100 128 103 68 110 112 106 123 118 62 122 72 68 128 124 126 77 127 98 122 98 98 126 75 65 110 113 130 82 99 94 127 109 113 112 66 133 119 118 84 116 92 87 130 81 85 83 88 98 128 67 138 129 135 131 127 139 64 86 106 117 105 124 112 82 114 111 138 122 138 124 128 69 125 106 74 135 114 123 121 94 121 68 113 123 120 136 95 77 67 104 85 133 133 113 61 84 115 91 89 126 121 134 87 99 64 90 112 102 137 99 114 96 110 108 122 118 123 106 104 85 84 135 104 109 106 74 112 114 139 77 104 88 98 68 138 94 95 62 115 69 76 102 60 71 62 70 60 121 139 78 62 60 121 97 109 77 109 94 110 102 96 127 112 84 107 81 80 121 127 77 97 93 99 133 132 73 65 106 129 115 85 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p05_7090.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 174 155 149 162 176 174 159 144 148 141 172 155 158 160 168 151 143 160 174 161 144 165 166 163 171 169 141 171 146 144 174 172 173 148 173 159 171 159 159 173 147 142 165 166 175 151 159 157 173 164 166 166 143 176 169 169 152 168 156 153 175 150 152 151 154 159 174 143 179 174 177 175 173 179 142 153 163 168 162 172 166 151 167 165 179 171 179 172 174 144 172 163 147 177 167 171 170 157 170 144 166 171 170 178 157 148 143 162 152 176 176 166 140 152 167 155 154 173 170 177 153 159 142 155 166 161 178 159 167 158 165 164 171 169 171 163 162 152 152 177 162 164 163 147 166 167 179 148 162 154 159 144 179 157 157 141 167 144 148 161 140 145 141 145 140 170 179 149 141 140 170 158 164 148 164 157 165 161 158 173 166 152 163 150 150 170 173 148 158 156 159 176 176 146 142 163 174 167 152 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /data/SET-3/p10_7090.cri: -------------------------------------------------------------------------------- 1 | 199 200 2 | 174 155 149 162 176 174 159 144 148 141 172 155 158 160 168 151 143 160 174 161 144 165 166 163 171 169 141 171 146 144 174 172 173 148 173 159 171 159 159 173 147 142 165 166 175 151 159 157 173 164 166 166 143 176 169 169 152 168 156 153 175 150 152 151 154 159 174 143 179 174 177 175 173 179 142 153 163 168 162 172 166 151 167 165 179 171 179 172 174 144 172 163 147 177 167 171 170 157 170 144 166 171 170 178 157 148 143 162 152 176 176 166 140 152 167 155 154 173 170 177 153 159 142 155 166 161 178 159 167 158 165 164 171 169 171 163 162 152 152 177 162 164 163 147 166 167 179 148 162 154 159 144 179 157 157 141 167 144 148 161 140 145 141 145 140 170 179 149 141 140 170 158 164 148 164 157 165 161 158 173 166 152 163 150 150 170 173 148 158 156 159 176 176 146 142 163 174 167 152 3 | 35 35 4 | 22 22 5 | 36 26 6 | 21 45 7 | 45 35 8 | 55 20 9 | 33 34 10 | 50 50 11 | 55 45 12 | 26 59 13 | 40 66 14 | 55 65 15 | 35 51 16 | 62 35 17 | 62 57 18 | 62 24 19 | 21 36 20 | 33 44 21 | 9 56 22 | 62 48 23 | 66 14 24 | 44 13 25 | 26 13 26 | 11 28 27 | 7 43 28 | 17 64 29 | 41 46 30 | 55 34 31 | 35 16 32 | 52 26 33 | 43 26 34 | 31 76 35 | 22 53 36 | 26 29 37 | 50 40 38 | 55 50 39 | 54 10 40 | 60 15 41 | 47 66 42 | 30 60 43 | 30 50 44 | 12 17 45 | 15 14 46 | 16 19 47 | 21 48 48 | 50 30 49 | 51 42 50 | 50 15 51 | 48 21 52 | 12 38 53 | 37 52 54 | 49 49 55 | 52 64 56 | 20 26 57 | 40 30 58 | 21 47 59 | 17 63 60 | 31 62 61 | 52 33 62 | 51 21 63 | 42 41 64 | 31 32 65 | 5 25 66 | 12 42 67 | 36 16 68 | 52 41 69 | 27 23 70 | 17 33 71 | 13 13 72 | 57 58 73 | 62 42 74 | 42 57 75 | 16 57 76 | 8 52 77 | 7 38 78 | 27 68 79 | 30 48 80 | 43 67 81 | 58 48 82 | 58 27 83 | 37 69 84 | 38 46 85 | 46 10 86 | 61 33 87 | 62 63 88 | 63 69 89 | 32 22 90 | 45 35 91 | 59 15 92 | 5 6 93 | 10 17 94 | 21 10 95 | 5 64 96 | 30 15 97 | 39 10 98 | 32 39 99 | 25 32 100 | 25 55 101 | 48 28 102 | 56 37 103 | 41 49 104 | 35 17 105 | 55 45 106 | 55 20 107 | 15 30 108 | 25 30 109 | 20 50 110 | 10 43 111 | 55 60 112 | 30 60 113 | 20 65 114 | 50 35 115 | 30 25 116 | 15 10 117 | 30 5 118 | 10 20 119 | 5 30 120 | 20 40 121 | 15 60 122 | 45 65 123 | 45 20 124 | 45 10 125 | 55 5 126 | 65 35 127 | 65 20 128 | 45 30 129 | 35 40 130 | 41 37 131 | 64 42 132 | 40 60 133 | 31 52 134 | 35 69 135 | 53 52 136 | 65 55 137 | 63 65 138 | 2 60 139 | 20 20 140 | 5 5 141 | 60 12 142 | 40 25 143 | 42 7 144 | 24 12 145 | 23 3 146 | 11 14 147 | 6 38 148 | 2 48 149 | 8 56 150 | 13 52 151 | 6 68 152 | 47 47 153 | 49 58 154 | 27 43 155 | 37 31 156 | 57 29 157 | 63 23 158 | 53 12 159 | 32 12 160 | 36 26 161 | 21 24 162 | 17 34 163 | 12 24 164 | 24 58 165 | 27 69 166 | 15 77 167 | 62 77 168 | 49 73 169 | 67 5 170 | 56 39 171 | 37 47 172 | 37 56 173 | 57 68 174 | 47 16 175 | 44 17 176 | 46 13 177 | 49 11 178 | 49 42 179 | 53 43 180 | 61 52 181 | 57 48 182 | 56 37 183 | 55 54 184 | 15 47 185 | 14 37 186 | 11 31 187 | 16 22 188 | 4 18 189 | 28 18 190 | 26 52 191 | 26 35 192 | 31 67 193 | 15 19 194 | 22 22 195 | 18 24 196 | 26 27 197 | 25 24 198 | 22 27 199 | 25 21 200 | 19 21 201 | 20 26 202 | 18 18 -------------------------------------------------------------------------------- /include/alkaidsd/sorter.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | #include 6 | #include 7 | 8 | namespace alkaidsd { 9 | class Random; 10 | } // namespace alkaidsd 11 | 12 | namespace alkaidsd::sorter { 13 | /** 14 | * @brief Abstract base class for sort operators. 15 | */ 16 | class SortOperator { 17 | public: 18 | /** 19 | * @brief Virtual destructor for SortOperator. 20 | */ 21 | virtual ~SortOperator() = default; 22 | 23 | /** 24 | * @brief Sorts the given vector of customers based on a specific criterion. 25 | * @param instance The problem instance. 26 | * @param customers customers to be sorted. 27 | * @param random The random number generator. 28 | */ 29 | virtual void operator()(const Instance &instance, std::vector &customers, 30 | Random &random) const = 0; 31 | }; 32 | 33 | /** 34 | * @brief Class for sorting customers using different sort operators. 35 | */ 36 | class Sorter { 37 | public: 38 | /** 39 | * @brief Adds a sort operator with a specified weight. 40 | * @param sort_function The sort operator to be added. 41 | * @param weight The weight of the sort operator. 42 | */ 43 | void AddSortFunction(std::unique_ptr &&sort_function, double weight); 44 | 45 | /** 46 | * @brief Sorts the given vector of customers using the added sort operators. 47 | * @param instance The problem instance. 48 | * @param customers customers to be sorted. 49 | * @param random The random number generator. 50 | */ 51 | void Sort(const Instance &instance, std::vector &customers, Random &random) const; 52 | 53 | private: 54 | double sum_weights_ = 0; 55 | std::vector, double>> sort_functions_; 56 | }; 57 | 58 | /** 59 | * @brief Sort operator that randomly shuffles customers. 60 | */ 61 | class SortByRandom : public SortOperator { 62 | public: 63 | void operator()(const Instance &instance, std::vector &customers, 64 | Random &random) const override; 65 | }; 66 | 67 | /** 68 | * @brief Sort operator that sorts customers based on their demand in descending order. 69 | */ 70 | class SortByDemand : public SortOperator { 71 | public: 72 | void operator()(const Instance &instance, std::vector &customers, 73 | Random &random) const override; 74 | }; 75 | 76 | /** 77 | * @brief Sort operator that sorts customers based on their distance to the depot in descending 78 | * order. 79 | */ 80 | class SortByFar : public SortOperator { 81 | public: 82 | void operator()(const Instance &instance, std::vector &customers, 83 | Random &random) const override; 84 | }; 85 | 86 | /** 87 | * @brief Sort operator that sorts customers based on their distance to the depot in ascending 88 | * order. 89 | */ 90 | class SortByClose : public SortOperator { 91 | public: 92 | void operator()(const Instance &instance, std::vector &customers, 93 | Random &random) const override; 94 | }; 95 | } // namespace alkaidsd::sorter 96 | -------------------------------------------------------------------------------- /src/intra_operator/exchange.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "../delta.h" 4 | #include "../route_context.h" 5 | 6 | namespace alkaidsd::intra_operator { 7 | struct ExchangeMove { 8 | Node node_a; 9 | Node node_b; 10 | }; 11 | 12 | void DoExchange(const ExchangeMove &move, Node route_index, AlkaidSolution &solution, 13 | RouteContext &context) { 14 | Node predecessor_a = solution.Predecessor(move.node_a); 15 | Node successor_a = solution.Successor(move.node_a); 16 | Node predecessor_b = solution.Predecessor(move.node_b); 17 | Node successor_b = solution.Successor(move.node_b); 18 | solution.Link(predecessor_a, move.node_b); 19 | solution.Link(move.node_b, successor_a); 20 | solution.Link(predecessor_b, move.node_a); 21 | solution.Link(move.node_a, successor_b); 22 | if (!predecessor_a) { 23 | context.SetHead(route_index, move.node_b); 24 | } 25 | context.UpdateRouteContext(solution, route_index, predecessor_a); 26 | } 27 | 28 | void ExchangeInner(const Instance &instance, const AlkaidSolution &solution, Node node_a, Node node_b, 29 | ExchangeMove &best_move, Delta &best_delta, Random &random) { 30 | Node predecessor_a = solution.Predecessor(node_a); 31 | Node successor_a = solution.Successor(node_a); 32 | Node predecessor_b = solution.Predecessor(node_b); 33 | Node successor_b = solution.Successor(node_b); 34 | int delta 35 | = instance.distance_matrix[solution.Customer(predecessor_a)][solution.Customer(node_b)] 36 | + instance.distance_matrix[solution.Customer(node_b)][solution.Customer(successor_a)] 37 | + instance.distance_matrix[solution.Customer(predecessor_b)][solution.Customer(node_a)] 38 | + instance.distance_matrix[solution.Customer(node_a)][solution.Customer(successor_b)] 39 | - instance.distance_matrix[solution.Customer(predecessor_a)][solution.Customer(node_a)] 40 | - instance.distance_matrix[solution.Customer(node_a)][solution.Customer(successor_a)] 41 | - instance.distance_matrix[solution.Customer(predecessor_b)][solution.Customer(node_b)] 42 | - instance.distance_matrix[solution.Customer(node_b)][solution.Customer(successor_b)]; 43 | if (best_delta.Update(delta, random)) { 44 | best_move = {node_a, node_b}; 45 | } 46 | } 47 | 48 | bool intra_operator::Exchange::operator()(const Instance &instance, Node route_index, 49 | AlkaidSolution &solution, RouteContext &context, 50 | Random &random) const { 51 | ExchangeMove best_move{}; 52 | Delta best_delta{}; 53 | Node node_a = context.Head(route_index); 54 | while (node_a) { 55 | Node node_b = solution.Successor(node_a); 56 | if (node_b) { 57 | node_b = solution.Successor(node_b); 58 | while (node_b) { 59 | ExchangeInner(instance, solution, node_a, node_b, best_move, best_delta, random); 60 | node_b = solution.Successor(node_b); 61 | } 62 | } 63 | node_a = solution.Successor(node_a); 64 | } 65 | if (best_delta.value < 0) { 66 | DoExchange(best_move, route_index, solution, context); 67 | return true; 68 | } 69 | return false; 70 | } 71 | } // namespace alkaidsd::intra_operator 72 | -------------------------------------------------------------------------------- /src/inter_operator/relocate.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | #include "base_cache.h" 4 | #include "base_star.h" 5 | #include "route_head_guard.h" 6 | 7 | namespace alkaidsd::inter_operator { 8 | struct RelocateMove { 9 | Node route_x, route_y; 10 | Node node_x, predecessor_x, successor_x; 11 | }; 12 | 13 | void DoRelocate(RelocateMove &move, AlkaidSolution &solution, RouteContext &context) { 14 | Node predecessor_x = solution.Predecessor(move.node_x); 15 | Node successor_x = solution.Successor(move.node_x); 16 | { 17 | RouteHeadGuard guard(solution, context, move.route_x); 18 | solution.Link(predecessor_x, successor_x); 19 | } 20 | { 21 | RouteHeadGuard guard(solution, context, move.route_y); 22 | solution.Link(move.predecessor_x, move.node_x); 23 | solution.Link(move.node_x, move.successor_x); 24 | } 25 | } 26 | 27 | void RelocateInner(const Instance &instance, const AlkaidSolution &solution, const RouteContext &context, 28 | Node route_x, Node route_y, BaseCache &cache, 29 | StarCaches &star_caches, Random &random) { 30 | star_caches.Preprocess(instance, solution, context, route_y, random); 31 | Node node_x = context.Head(route_x); 32 | while (node_x) { 33 | if (context.Load(route_y) + solution.Load(node_x) <= instance.capacity) { 34 | auto insertion = star_caches.Get(route_y, solution.Customer(node_x)).FindBest(); 35 | Node predecessor_x = solution.Predecessor(node_x); 36 | Node successor_x = solution.Successor(node_x); 37 | int delta = insertion->delta.value 38 | - CalcDelta(instance, solution, node_x, predecessor_x, successor_x); 39 | if (cache.delta.Update(delta, random)) { 40 | cache.move = {route_x, route_y, node_x, insertion->predecessor, insertion->successor}; 41 | } 42 | } 43 | node_x = solution.Successor(node_x); 44 | } 45 | } 46 | 47 | std::vector inter_operator::Relocate::operator()(const Instance &instance, AlkaidSolution &solution, 48 | RouteContext &context, Random &random, 49 | CacheMap &cache_map) const { 50 | auto &caches = cache_map.Get>(solution, context); 51 | auto &star_caches = cache_map.Get(solution, context); 52 | RelocateMove best_move{}; 53 | Delta best_delta{}; 54 | for (Node route_x = 0; route_x < context.NumRoutes(); ++route_x) { 55 | for (Node route_y = 0; route_y < context.NumRoutes(); ++route_y) { 56 | if (route_x == route_y) { 57 | continue; 58 | } 59 | auto &cache = caches.Get(route_x, route_y); 60 | if (!cache.TryReuse()) { 61 | RelocateInner(instance, solution, context, route_x, route_y, cache, star_caches, random); 62 | } else { 63 | cache.move.route_x = route_x; 64 | cache.move.route_y = route_y; 65 | } 66 | if (best_delta.Update(cache.delta, random)) { 67 | best_move = cache.move; 68 | } 69 | } 70 | } 71 | if (best_delta.value < 0) { 72 | DoRelocate(best_move, solution, context); 73 | return {best_move.route_x, best_move.route_y}; 74 | } 75 | return {}; 76 | } 77 | } // namespace alkaidsd::inter_operator 78 | -------------------------------------------------------------------------------- /data/SET-1/SD16.txt: -------------------------------------------------------------------------------- 1 | 144 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 996 87 6 | 985 174 7 | 966 259 8 | 940 342 9 | 906 423 10 | 866 500 11 | 819 574 12 | 766 643 13 | 707 707 14 | 643 766 15 | 574 819 16 | 500 866 17 | 423 906 18 | 342 940 19 | 259 966 20 | 174 985 21 | 87 996 22 | 0 1000 23 | -87 996 24 | -174 985 25 | -259 966 26 | -342 940 27 | -423 906 28 | -500 866 29 | -574 819 30 | -643 766 31 | -707 707 32 | -766 643 33 | -819 574 34 | -866 500 35 | -906 423 36 | -940 342 37 | -966 259 38 | -985 174 39 | -996 87 40 | -1000 0 41 | -996 -87 42 | -985 -174 43 | -966 -259 44 | -940 -342 45 | -906 -423 46 | -866 -500 47 | -819 -573 48 | -766 -643 49 | -707 -707 50 | -643 -766 51 | -574 -819 52 | -500 -866 53 | -423 -906 54 | -342 -940 55 | -259 -966 56 | -174 -985 57 | -87 -996 58 | -0 -1000 59 | 87 -996 60 | 174 -985 61 | 259 -966 62 | 342 -940 63 | 422 -906 64 | 500 -866 65 | 573 -819 66 | 643 -766 67 | 707 -707 68 | 766 -643 69 | 819 -574 70 | 866 -500 71 | 906 -423 72 | 940 -342 73 | 966 -259 74 | 985 -174 75 | 996 -87 76 | 2000 0 77 | 1992 174 78 | 1970 347 79 | 1932 518 80 | 1879 684 81 | 1813 845 82 | 1732 1000 83 | 1638 1147 84 | 1532 1286 85 | 1414 1414 86 | 1286 1532 87 | 1147 1638 88 | 1000 1732 89 | 845 1813 90 | 684 1879 91 | 518 1932 92 | 347 1970 93 | 174 1992 94 | 0 2000 95 | -174 1992 96 | -347 1970 97 | -518 1932 98 | -684 1879 99 | -845 1813 100 | -1000 1732 101 | -1147 1638 102 | -1285 1532 103 | -1414 1414 104 | -1532 1286 105 | -1638 1147 106 | -1732 1000 107 | -1813 845 108 | -1879 684 109 | -1932 518 110 | -1970 347 111 | -1992 174 112 | -2000 0 113 | -1992 -174 114 | -1970 -347 115 | -1932 -517 116 | -1879 -684 117 | -1813 -845 118 | -1732 -1000 119 | -1638 -1147 120 | -1532 -1285 121 | -1414 -1414 122 | -1286 -1532 123 | -1147 -1638 124 | -1000 -1732 125 | -845 -1813 126 | -684 -1879 127 | -518 -1932 128 | -348 -1970 129 | -175 -1992 130 | -0 -2000 131 | 174 -1992 132 | 347 -1970 133 | 517 -1932 134 | 684 -1879 135 | 845 -1813 136 | 1000 -1732 137 | 1147 -1638 138 | 1285 -1532 139 | 1414 -1414 140 | 1532 -1286 141 | 1638 -1147 142 | 1732 -1000 143 | 1812 -846 144 | 1879 -684 145 | 1932 -518 146 | 1970 -348 147 | 1992 -175 148 | -------------------------------------------------------------------------------- /data/SET-1/SD15.txt: -------------------------------------------------------------------------------- 1 | 144 100 2 | 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 60 90 3 | 0 0 4 | 1000 0 5 | 866 500 6 | 500 866 7 | 0 1000 8 | -500 866 9 | -866 500 10 | -1000 0 11 | -866 -500 12 | -500 -866 13 | -0 -1000 14 | 500 -866 15 | 866 -500 16 | 2000 0 17 | 1732 1000 18 | 1000 1732 19 | 0 2000 20 | -1000 1732 21 | -1732 1000 22 | -2000 0 23 | -1732 -1000 24 | -1000 -1732 25 | -0 -2000 26 | 1000 -1732 27 | 1732 -1000 28 | 3000 0 29 | 2598 1500 30 | 1500 2598 31 | 0 3000 32 | -1500 2598 33 | -2598 1500 34 | -3000 0 35 | -2598 -1500 36 | -1500 -2598 37 | -0 -3000 38 | 1500 -2598 39 | 2598 -1500 40 | 4000 0 41 | 3464 2000 42 | 2000 3464 43 | 0 4000 44 | -2000 3464 45 | -3464 2000 46 | -4000 0 47 | -3464 -2000 48 | -2000 -3464 49 | -1 -4000 50 | 1999 -3464 51 | 3464 -2001 52 | 5000 0 53 | 4330 2500 54 | 2500 4330 55 | 0 5000 56 | -2500 4330 57 | -4330 2500 58 | -5000 0 59 | -4330 -2500 60 | -2501 -4330 61 | -1 -5000 62 | 2499 -4331 63 | 4330 -2501 64 | 6000 0 65 | 5196 3000 66 | 3000 5196 67 | 0 6000 68 | -3000 5196 69 | -5196 3000 70 | -6000 1 71 | -5196 -2999 72 | -3001 -5196 73 | -1 -6000 74 | 2999 -5197 75 | 5196 -3001 76 | 7000 0 77 | 6062 3500 78 | 3500 6062 79 | 0 7000 80 | -3500 6062 81 | -6062 3500 82 | -7000 1 83 | -6063 -3499 84 | -3501 -6062 85 | -1 -7000 86 | 3499 -6063 87 | 6062 -3501 88 | 8000 0 89 | 6928 4000 90 | 4000 6928 91 | 0 8000 92 | -4000 6928 93 | -6928 4001 94 | -8000 1 95 | -6929 -3999 96 | -4001 -6928 97 | -1 -8000 98 | 3999 -6929 99 | 6928 -4001 100 | 9000 0 101 | 7794 4500 102 | 4500 7794 103 | 0 9000 104 | -4500 7795 105 | -7794 4501 106 | -9000 1 107 | -7795 -4499 108 | -4501 -7794 109 | -1 -9000 110 | 4499 -7795 111 | 7793 -4501 112 | 10000 0 113 | 8660 5000 114 | 5000 8660 115 | 0 10000 116 | -4999 8661 117 | -8660 5001 118 | -10000 1 119 | -8661 -4999 120 | -5001 -8660 121 | -1 -10000 122 | 4999 -8661 123 | 8659 -5001 124 | 11000 0 125 | 9526 5500 126 | 5500 9526 127 | 1 11000 128 | -5499 9527 129 | -9526 5501 130 | -11000 1 131 | -9527 -5499 132 | -5501 -9526 133 | -2 -11000 134 | 5499 -9527 135 | 9525 -5502 136 | 12000 0 137 | 10392 6000 138 | 6000 10392 139 | 1 12000 140 | -5999 10393 141 | -10392 6001 142 | -12000 1 143 | -10393 -5999 144 | -6001 -10392 145 | -2 -12000 146 | 5998 -10393 147 | 10391 -6002 148 | --------------------------------------------------------------------------------