Search Process

Figure 1: Drop-down menu items for the design window.

The Design drop down menu in GraphSynth provides functions to test and synthesize new graphs from the grammar rule sets described in earlier pages (graphs, grammars, rule sets). Firstly, the pane has commands to set the active seed and the first three active rule sets. These can also be set in the GraphSynthSettings.config file so that they are established on running the program (this proves to be a great time-saver!). The GUI will only allow one to assign the first three rule sets; however, if you want more, you will need to make the assignments in GraphSynthSettings.config or during Program.runSearchProcess().

This is followed by the “Run Search Process” item, which is the main entry point for a search process that one may implement (more on this in a second). The bottom three items allow for the testing or rules, rule sets, and seeds. The “Recognize—>User Choose—>Apply” item invokes a dialog to choose the rules by hand. Within the options presented in that dialog, one can double-click a location to see what subgraph the rule is applying to. The “Recognize—>Random Choose—>Apply” item will continuously call random options on the seed until the process stops (stops by encountering a “Stop” in one of the 5 generation exits). Additionally the gray box that is labeled “#steps” can be changed to a set a integers that will be assigned to the generation cycle limits for each rule set (see int[] maxNumOfCalls). For example by replacing “#steps” with “4, 5  12”, the generation process will be invoked with set maxNumOfCalls to [4, 5, 12] (most common separators such as comma and space can be used).

Search Process Controller

When any of these lower items are clicked, a
small controller window appears (often it is
hidden for user and random testing). The
controller allows one to change how the search
process is executing. The snapshot to the right
was taken while the process was executing. Notice
that the “Play” button is disabled since the
process is already in operation. The process can
be paused, stopped , or aborted from this point.
Pressing the “Stop” button will send a request to
the process. This is to allow the process to end
and still retain useful results. It will not always
 function if the search process is using the
computational resources elsewhere. Thus as a
last resort, the “Abort” button will attempt to
kill the thread that the search process is running on.

In addition to these button, there are three displays that show pertinent information about the process. The time is implemented as part of the controller; it ‘pings’ the thread the search process is on in specific intervals. The rate at which is pings is based on the verbosity setting (described below). The top two displays shown the iterations and a miscellaneous field. These are set in the search process by setting the iterDisplay and miscDisplay properties of the main Program.cs. At the bottom one can set the priority and verbosity for the search process. The computational processes in GraphSynth run on separate threads, and a thread can be given a priority over other threads. Set this high if you want to speed up the process but do not mind it slowly down other processes. The verbosity is a highly useful UI that allows the user to adjust how much text is being output by the process. One is encourage to implement many Program.output statements in a search

process to provide information about the progress of a long operation. However, such commands can greatly slow down the processing. By dynamically set how verbose we want the search process to be, we can get the information we want when we need it. The Program.output function can be invoked with an object (usually a string) to print and a verbosity limit, which is an integer from 0 to 4. If the verbosity limit is set to 0, then the object will be printed all the time even for verbosity set to “lowest.” If it is set to 4, then it will only print when verbosity is set to “highest.”

Writing a Custom Search Process

As discussed in the introduction, one may want to automate the creation of candidate solutions. This custom code can be written in under the function Program. runSearchProcess(). In fact, any C# code can be written here. One may want to invoke functions from another Visual Studio project, or invoke additionally GUI forms.

In the example code, the swirl seed and rule set are loaded (which encapsulates the representation) , and we create the generate, evaluate and guide methods for the search process:

Generation.randomChoose GenerationApproach = new Generation.randomChoose(Program.seed, Program.rulesets,
new int[1] { 100 }, false);

output("making new evaluation", 2);

Evaluation.EvaluateSwirls EvaluationApproach
new Evaluation.EvaluateSwirls();

output("making new guidance", 2);

Guidance.DoNothingButDisplay GuidanceApproach
new Guidance.DoNothingButDisplay();

The initiation of these routines is done at the beginning of the process in an attempt to make GraphSynth modular for a wide range of applications.