7.1 Running the network from the command line

Problem

Although HARK-Designer can be built and executed, it is annoying to use GUI every time. I want to run a network file using a command line, as well as to change network parameters using command line arguments.

Solution

You have to change a parameter value that you want to specify as a command line argument so that the program can associate with the parameter and command line argument.

Open the network file using HARK-Designer , and edit it as follows:

  1. In the MAIN subnetwork, open the node property window to which you want to give a command line argument.

  2. Designate the Type of variable for which an argument is substituted for in subnet_param and enter "ARG?" as Value (the index of the argument should be entered in ?. If this is the first argument, enter "ARG1"). If you want to give the argument as int or float , you have to specify it (i.e. “int:ARG1” or “float:ARG1”).

Note that you can give the command line argument only to the nodes in the MAIN subnetwork. Two steps are required to give command line arguments to other nodes: First, set the Type of the parameter as subnet_param so that you can see the parameter in the MAIN network. Then, set the command line argument in the MAIN subnetwork. Then, you can run it as if it were an ordinal executable.

batchflow executes the contents of the network file. Therefore, you have to type “batchflow” before the network file and a command line argument.

$ batchflow foo.n 0.5 0.9

Then, ARG1 is set to 0.5 and ARG2 to 0.9, followed by the execution of foo.n.

Discussion

HARK-Designer is a GUI for editing a network file and the actual processing is performed by batchflow .

The arguments are interpreted as string type by default. If utilize different types, such as int and float types, designate them as “int :ARG1”, “float :ARG1”. The current version of HARK  cannot accept command line arguments with Object type such as Vector<int> using this method.

See also

None.