next up previous contents
Next: Using Drone With a Swarm Program Up: The Target Program Previous: Using Drone With an Existing Program

Using Drone With an Adapter Script

 

If all else fails, you should be able to make Drone work with practically any target program using an additional adapter script that massages the command-line options and input file into a form that the target program will understand. Write a script or program in your favorite language that meets the requirements listed in Section 3.3.1, above. This adapter script should do whatever is necessary to get the target program to run with those parameters. It should then invoke the target program. When the target program has finished, all output files should be moved to the script's current working directory, if the target program hasn't already placed them there. If numRuns is greater than 1, the output files must all incorporate the run number and run prefix into their filenames in some way, so that they don't overwrite files from other runs. The adapter script must wait until the target program has completed its run before exiting, in order for Drone to work properly. This script is an example of a kind of adapter pattern, also known as a wrapper [1]. Neither Drone nor the target program need to know that the adapter script exists; as far as Drone is concerned, the adapter script is the target program.

For example, John Grefenstette's Genesis 5.0 genetic algorithm (GA) package expects the random number seed and all other parameters to be in the input file, and it accepts only a single command-line option: a filename suffix for the current run. It also uses a second input file, the template file, to store information about the format of the GA chromosomes. To get Drone to work with Genesis, I've written an adapter script in Tcl, named gawrap, that is invoked by Drone in the place of Genesis. The input file that gawrap reads was formed by concatenating the Genesis input file with the template file. gawrap reads the input file given to it by Drone. It parses portion that contains the Genesis input file and overrides the parameter values there with those from the command line, such as the random seed. Next, the script creates a new input file and template file, named so that Genesis will find them. Then it invokes Genesis and waits for it to complete. Genesis executes the GA multiple times within a single run; after it completes, the script calls a second program named report, which calculates statistics such as mean fitness, averaged over all of the GA executions. The programs put their output in their working directory, so there is no need to move it. After the report program completes, the gawrap script is done, and it exits. Drone continues on, just as if it had called Genesis directly. See the files in the examples/gawrap directory for more details.

Rick Riolo has also successfully used Drone with the genetic programming (GP) package lilgp, developed by the GARAGe Group at Michigan State University, using the wrapper lilgpwrap in the directory examples/lilgpwrap.


next up previous contents
Next: Using Drone With a Swarm Program Up: The Target Program Previous: Using Drone With an Existing Program

Drone 1.01 User's Guide
Theodore C. Belding
Wed Nov 13 03:53:22 EST 1996