Skip to content

Commit

Permalink
Simplification in tuning/call-julia-function-f.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
graidl committed Nov 10, 2023
1 parent 15da46f commit dbd174d
Showing 1 changed file with 11 additions and 25 deletions.
36 changes: 11 additions & 25 deletions Tuning/call-julia-function-f.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,24 @@
# Julia script that parses command line arguments and calls function f
# returns result via stdout

using ArgParse

arg_table = ArgParseSettings()
@add_arg_table arg_table begin
"--instance"
arg_type = String
required = true
"--instance_features"
arg_type = String
required = true
"--seed"
arg_type = Int
"--x"
arg_type = Float64
required = true
"--y"
arg_type = Int
required = true
"--z"
arg_type = String
required = true
# put provided command line arguments with their values into a dictionary
d = Dict{String, String}()
for arg in ARGS
(name, value) = split(arg, "=")
d[name] = value
end

include("julia-function-to-tune.jl")

# open("args.txt", "w") do f
# println(f, ARGS)
# println(f, d)
# end

args = parse_args(ARGS, arg_table)

c = f(args["instance"], args["seed"], args["x"], args["y"], args["z"])
c = f(d["--instance"], parse(Int, d["--seed"]),
parse(Float64, d["--x"]),
parse(Int, d["--y"]),
d["--z"],
)

println("cost=", c)

Expand Down

0 comments on commit dbd174d

Please sign in to comment.