diff --git a/CHANGELOG.md b/CHANGELOG.md index eb7bbf3..ae430f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,11 @@ Major changes in releases: ## Upcoming -## Version 0.1.10 +## Version 0.1.11 +- Fix in ``GVNS`: Empty local search method list led to an infinite loop + [issue #5](/../../issues/5) +## Version 0.1.10 - subdirectory `Tuning` added with examples how to use SMAC3 for tuning parameters algorithms implemented in Julia - the LNS variants now also accept new equally good solutions as new incumbents diff --git a/MHLibDemos/Manifest.toml b/MHLibDemos/Manifest.toml index e54b580..7be3338 100644 --- a/MHLibDemos/Manifest.toml +++ b/MHLibDemos/Manifest.toml @@ -1,6 +1,6 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.9.3" +julia_version = "1.9.4" manifest_format = "2.0" project_hash = "310f02b02e97b016922d1f28da101bfd8b1831be" @@ -102,19 +102,19 @@ version = "0.2.2" [[deps.JuliaInterpreter]] deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"] -git-tree-sha1 = "0592b1810613d1c95eeebcd22dc11fba186c2a57" +git-tree-sha1 = "e49bce680c109bc86e3e75ebcb15040d6ad9e1d3" uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a" -version = "0.9.26" +version = "0.9.27" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.3" +version = "0.6.4" [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "7.84.0+0" +version = "8.4.0+0" [[deps.LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] @@ -123,7 +123,7 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.10.2+0" +version = "1.11.0+1" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -153,9 +153,9 @@ uuid = "56ddb016-857b-54e1-b83d-db4d58db5568" [[deps.LoweredCodeUtils]] deps = ["JuliaInterpreter"] -git-tree-sha1 = "60168780555f3e663c536500aa790b6368adc02a" +git-tree-sha1 = "c165f205e030208760ebd75b5e1f7706761d9218" uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b" -version = "2.3.0" +version = "2.3.1" [[deps.MHLib]] deps = ["ArgParse", "DataStructures", "Logging", "Printf", "Random", "Reexport", "StatsBase"] @@ -201,15 +201,27 @@ uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" version = "0.3.21+4" [[deps.OrderedCollections]] -git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" +git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.6.2" +version = "1.6.3" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f" version = "1.9.2" +[[deps.PrecompileTools]] +deps = ["Preferences"] +git-tree-sha1 = "03b4c25b43cb84cee5c90aa9b5ea0a78fd848d2f" +uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a" +version = "1.2.0" + +[[deps.Preferences]] +deps = ["TOML"] +git-tree-sha1 = "00805cd429dcb4870060ff49ef443486c262e38e" +uuid = "21216c6a-2e73-6563-6e65-726566657250" +version = "1.4.1" + [[deps.Printf]] deps = ["Unicode"] uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7" @@ -235,9 +247,9 @@ version = "1.3.0" [[deps.Revise]] deps = ["CodeTracking", "Distributed", "FileWatching", "JuliaInterpreter", "LibGit2", "LoweredCodeUtils", "OrderedCollections", "Pkg", "REPL", "Requires", "UUIDs", "Unicode"] -git-tree-sha1 = "ba168f8fc36bf83c8d0573d464b7aab0f8a81623" +git-tree-sha1 = "6990168abf3fe9a6e34ebb0e05aaaddf6572189e" uuid = "295af30f-e4ad-537b-8983-00126c2a3abe" -version = "3.5.7" +version = "3.5.10" [[deps.SHA]] uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce" @@ -270,10 +282,10 @@ deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"] uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf" [[deps.StaticArrays]] -deps = ["LinearAlgebra", "Random", "StaticArraysCore"] -git-tree-sha1 = "0adf069a2a490c47273727e029371b31d44b72b2" +deps = ["LinearAlgebra", "PrecompileTools", "Random", "StaticArraysCore"] +git-tree-sha1 = "5ef59aea6f18c25168842bded46b16662141ab87" uuid = "90137ffa-7385-5640-81b9-e52037218182" -version = "1.6.5" +version = "1.7.0" weakdeps = ["Statistics"] [deps.StaticArrays.extensions] @@ -341,7 +353,7 @@ version = "5.8.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.48.0+0" +version = "1.52.0+1" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] diff --git a/MHLibDemos/src/GraphColoring.jl b/MHLibDemos/src/GraphColoring.jl index 8899a1e..46e58db 100644 --- a/MHLibDemos/src/GraphColoring.jl +++ b/MHLibDemos/src/GraphColoring.jl @@ -226,6 +226,7 @@ end function solve_graph_coloring(args=ARGS) println("Graph Coloring Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # We set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.Schedulers.settings_cfg, "mh_titer", 1000) @@ -248,8 +249,9 @@ function solve_graph_coloring(args=ARGS) return sol end -# To run from REPL, use `MHLibDemos` and call `solve_graph_coloring()` where -# `` is a list of strings being passed as arguments for setting global parameters. +# To run from REPL, use `MHLibDemos` and call `solve_graph_coloring()` where `` +# is a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_graph_coloring("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file # Run with profiler: diff --git a/MHLibDemos/src/MAXSAT.jl b/MHLibDemos/src/MAXSAT.jl index 978338c..29f55cf 100644 --- a/MHLibDemos/src/MAXSAT.jl +++ b/MHLibDemos/src/MAXSAT.jl @@ -200,6 +200,7 @@ end function solve_maxsat(args=ARGS) println("MAXSAT Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.settings_cfg, "ifile", "data/maxsat-adv1.cnf") @@ -245,8 +246,8 @@ function solve_maxsat(args=ARGS) end # To run from REPL, use MHLibDemos and call `solve_maxsat()` where `` is -# a list of strings being passed as arguments for setting global parameters. +# a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_maxsat("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file - # Run with profiler: # @profview solve_maxsat(args) \ No newline at end of file diff --git a/MHLibDemos/src/MISP.jl b/MHLibDemos/src/MISP.jl index d7068ca..0b54d1f 100644 --- a/MHLibDemos/src/MISP.jl +++ b/MHLibDemos/src/MISP.jl @@ -205,6 +205,7 @@ end function solve_misp(args=ARGS) println("MISP Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.settings_cfg, "ifile", "data/frb40-19-1.mis") @@ -231,8 +232,9 @@ function solve_misp(args=ARGS) return sol end -# To run from REPL, use MHLibDemos and call `solve_misp()` where `` is -# a list of strings being passed as arguments for setting global parameters. +# To run from REPL, use MHLibDemos and call `solve_misp()` where `` +# is a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_misp("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file # Run with profiler: diff --git a/MHLibDemos/src/MKP.jl b/MHLibDemos/src/MKP.jl index 81d7472..4e7f330 100644 --- a/MHLibDemos/src/MKP.jl +++ b/MHLibDemos/src/MKP.jl @@ -205,6 +205,7 @@ end function solve_mkp(args=ARGS) println("MKP Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.settings_cfg, "ifile", "data/mknapcb5-01.txt") @@ -231,8 +232,9 @@ function solve_mkp(args=ARGS) return sol end -# To run from REPL, use MHLibDemos and call `solve_mkp()` where `` is -# a list of strings being passed as arguments for setting global parameters. +# To run from REPL, use MHLibDemos and call `solve_mkp()` where `` is +# a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_mkp("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file # Run with profiler: diff --git a/MHLibDemos/src/OneMax.jl b/MHLibDemos/src/OneMax.jl index b6030b5..007e391 100644 --- a/MHLibDemos/src/OneMax.jl +++ b/MHLibDemos/src/OneMax.jl @@ -56,6 +56,7 @@ Base.copy(s::OneMaxSolution) = OneMaxSolution(s.obj_val, s.obj_val_valid, copy(s function solve_onemax(args=ARGS) println("OneMax Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # We set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.Schedulers.settings_cfg, "mh_titer", 100) @@ -78,8 +79,9 @@ function solve_onemax(args=ARGS) return sol end -# To run from REPL, use `MHLibDemos` and call `solve_onemax()` where -# `` is a list of strings being passed as arguments for setting global parameters. +# To run from REPL, use `MHLibDemos` and call `solve_onemax()` where `` +# is a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_onemax("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file # Run with profiler: diff --git a/MHLibDemos/src/TSP.jl b/MHLibDemos/src/TSP.jl index f3425ff..dc41655 100644 --- a/MHLibDemos/src/TSP.jl +++ b/MHLibDemos/src/TSP.jl @@ -253,6 +253,7 @@ end function solve_tsp(args=ARGS) println("TSP Demo version $(git_version())\nARGS: ", args) + args isa AbstractString && (args = split(args)) # set some new default values for parameters and parse all relevant arguments settings_new_default_value!(MHLib.settings_cfg, "ifile", "data/xqf131.tsp") @@ -285,8 +286,9 @@ function solve_tsp(args=ARGS) return sol end -# To run from REPL, use MHLibDemos and call `solve_tsp()` where `` is -# a list of strings being passed as arguments for setting global parameters. +# To run from REPL, use MHLibDemos and call `solve_tsp()` where `` is +# a single string or list of strings being passed as arguments for setting global +# parameters, e.g. `solve_tsp("--seed=1 --mh_titer=120")`. # `@` may be used to read arguments from a configuration file # Run with profiler: diff --git a/Manifest.toml b/Manifest.toml index efcb243..c32f705 100644 --- a/Manifest.toml +++ b/Manifest.toml @@ -1,8 +1,8 @@ # This file is machine-generated - editing it directly is not advised -julia_version = "1.9.3" +julia_version = "1.9.4" manifest_format = "2.0" -project_hash = "1e7ca9e29eca034eaf97268b397e9abf8c5c560b" +project_hash = "120b5576b04f4d26ef6670cecf1c2071e4f8ef62" [[deps.ArgParse]] deps = ["Logging", "TextWrap"] @@ -76,12 +76,12 @@ version = "0.2.2" [[deps.LibCURL]] deps = ["LibCURL_jll", "MozillaCACerts_jll"] uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21" -version = "0.6.3" +version = "0.6.4" [[deps.LibCURL_jll]] deps = ["Artifacts", "LibSSH2_jll", "Libdl", "MbedTLS_jll", "Zlib_jll", "nghttp2_jll"] uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0" -version = "7.84.0+0" +version = "8.4.0+0" [[deps.LibGit2]] deps = ["Base64", "NetworkOptions", "Printf", "SHA"] @@ -90,7 +90,7 @@ uuid = "76f85450-5226-5b5a-8eaa-529ad045b433" [[deps.LibSSH2_jll]] deps = ["Artifacts", "Libdl", "MbedTLS_jll"] uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8" -version = "1.10.2+0" +version = "1.11.0+1" [[deps.Libdl]] uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb" @@ -147,9 +147,9 @@ uuid = "4536629a-c528-5b80-bd46-f80d51c5b363" version = "0.3.21+4" [[deps.OrderedCollections]] -git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3" +git-tree-sha1 = "dfdf5519f235516220579f949664f1bf44e741c5" uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d" -version = "1.6.2" +version = "1.6.3" [[deps.Pkg]] deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "REPL", "Random", "SHA", "Serialization", "TOML", "Tar", "UUIDs", "p7zip_jll"] @@ -250,7 +250,7 @@ version = "5.8.0+0" [[deps.nghttp2_jll]] deps = ["Artifacts", "Libdl"] uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d" -version = "1.48.0+0" +version = "1.52.0+1" [[deps.p7zip_jll]] deps = ["Artifacts", "Libdl"] diff --git a/Project.toml b/Project.toml index 845c230..9cbb3ae 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "MHLib" uuid = "0f3a0e6e-e0e7-4894-bd64-856f0ae3b635" authors = ["Guenther Raidl and others"] -version = "0.1.10" +version = "0.1.11" [deps] ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63" diff --git a/src/GVNSs.jl b/src/GVNSs.jl index cd89ac8..f5707bc 100644 --- a/src/GVNSs.jl +++ b/src/GVNSs.jl @@ -55,7 +55,7 @@ end vnd(scheduler, solution) Perform variable neighborhood descent (VND) on given solution. -Return true if a global termination condition is fulfilled, else False. +Return true if a global termination condition is fulfilled, else false. """ function vnd!(gvns::GVNS, sol::Solution)::Bool sol2 = copy(sol) @@ -88,10 +88,10 @@ Perform general variable neighborhood search (GVNS) to given solution. """ function gvns!(gvns::GVNS, sol::Solution) sol2 = copy(sol) - if vnd!(gvns, sol2) || isempty(gvns.meths_sh) + use_vnd = !isempty(gvns.meths_li) + if use_vnd && vnd!(gvns, sol2) || isempty(gvns.meths_sh) return end - use_vnd = !isempty(gvns.meths_li) improvement_found = true while improvement_found for m in next_method(gvns.meths_sh, repeat=true)