Skip to content

Commit

Permalink
Closes #5; packages updated, minor polishing of demos
Browse files Browse the repository at this point in the history
  • Loading branch information
graidl committed Nov 29, 2023
1 parent dbd174d commit 0f04c5a
Show file tree
Hide file tree
Showing 11 changed files with 67 additions and 41 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
44 changes: 28 additions & 16 deletions MHLibDemos/Manifest.toml
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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"]
Expand All @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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"]
Expand Down
6 changes: 4 additions & 2 deletions MHLibDemos/src/GraphColoring.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -248,8 +249,9 @@ function solve_graph_coloring(args=ARGS)
return sol
end

# To run from REPL, use `MHLibDemos` and call `solve_graph_coloring(<args>)` where
# `<args>` is a list of strings being passed as arguments for setting global parameters.
# To run from REPL, use `MHLibDemos` and call `solve_graph_coloring(<args>)` where `<args>`
# 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
Expand Down
5 changes: 3 additions & 2 deletions MHLibDemos/src/MAXSAT.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -245,8 +246,8 @@ function solve_maxsat(args=ARGS)
end

# To run from REPL, use MHLibDemos and call `solve_maxsat(<args>)` where `<args>` 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
# @profview solve_maxsat(args)
6 changes: 4 additions & 2 deletions MHLibDemos/src/MISP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -231,8 +232,9 @@ function solve_misp(args=ARGS)
return sol
end

# To run from REPL, use MHLibDemos and call `solve_misp(<args>)` where `<args>` is
# a list of strings being passed as arguments for setting global parameters.
# To run from REPL, use MHLibDemos and call `solve_misp(<args>)` where `<args>`
# 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
Expand Down
6 changes: 4 additions & 2 deletions MHLibDemos/src/MKP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -231,8 +232,9 @@ function solve_mkp(args=ARGS)
return sol
end

# To run from REPL, use MHLibDemos and call `solve_mkp(<args>)` where `<args>` is
# a list of strings being passed as arguments for setting global parameters.
# To run from REPL, use MHLibDemos and call `solve_mkp(<args>)` where `<args>` 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
Expand Down
6 changes: 4 additions & 2 deletions MHLibDemos/src/OneMax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -78,8 +79,9 @@ function solve_onemax(args=ARGS)
return sol
end

# To run from REPL, use `MHLibDemos` and call `solve_onemax(<args>)` where
# `<args>` is a list of strings being passed as arguments for setting global parameters.
# To run from REPL, use `MHLibDemos` and call `solve_onemax(<args>)` where `<args>`
# 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
Expand Down
6 changes: 4 additions & 2 deletions MHLibDemos/src/TSP.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -285,8 +286,9 @@ function solve_tsp(args=ARGS)
return sol
end

# To run from REPL, use MHLibDemos and call `solve_tsp(<args>)` where `<args>` is
# a list of strings being passed as arguments for setting global parameters.
# To run from REPL, use MHLibDemos and call `solve_tsp(<args>)` where `<args>` 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")`.
# `@<filename>` may be used to read arguments from a configuration file <filename>

# Run with profiler:
Expand Down
16 changes: 8 additions & 8 deletions Manifest.toml
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down Expand Up @@ -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"]
Expand All @@ -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"
Expand Down Expand Up @@ -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"]
Expand Down Expand Up @@ -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"]
Expand Down
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MHLib"
uuid = "0f3a0e6e-e0e7-4894-bd64-856f0ae3b635"
authors = ["Guenther Raidl <[email protected]> and others"]
version = "0.1.10"
version = "0.1.11"

[deps]
ArgParse = "c7e460c6-2fb9-53a9-8c5b-16f535851c63"
Expand Down
6 changes: 3 additions & 3 deletions src/GVNSs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0f04c5a

Please sign in to comment.