Skip to content

Commit

Permalink
Add command line arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
newptcai committed Feb 25, 2020
1 parent 6ef4eba commit ce8b2ae
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/args.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ function parse_commandline()
"log-prod"
action = :command
help="simulation of log product of subtree sizes"
"size-power"
action = :command
help="simulation of sum of power of subtree sizes"
"leaf"
action = :command
help="simulation of the number of leaves coutning"
Expand Down Expand Up @@ -72,5 +75,14 @@ function parse_commandline()
arg_type=Int
default=1
end

@add_arg_table! setting["size-power"] begin
"--pow", "-p"
dest_name="pow"
help="subtree size^pow"
arg_type=Real
default=0.5
end

return parse_args(setting)
end
2 changes: 2 additions & 0 deletions src/main.jl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ function main()
sim = KcutSimulator(tree_ins, parsed_args["kcut"]["k"])
elseif parsed_args["%COMMAND%"] == "log-prod"
sim = LogProductSimulator(tree_ins, parsed_args["log-prod"]["pow"])
elseif parsed_args["%COMMAND%"] == "size-power"
sim = SizePowerSimulator(tree_ins, parsed_args["size-power"]["pow"])
elseif parsed_args["%COMMAND%"] == "height"
sim = HeightSimulator(tree_ins)
elseif parsed_args["%COMMAND%"] == "total-path"
Expand Down

0 comments on commit ce8b2ae

Please sign in to comment.