Generation

We consider the seed graph, the grammar rules and the rule sets to provide the designer with the Representation for a particular problem domain. On top of this representation, GraphSynth provides us the basic framework to generate candidate solutions through a recognize, choose and apply cycle shown here.

Figure 1: Throughout a recognize, choose, and apply generation process, any of five things may happen. In order to plan accordingly a rule set should include instructions for how to handle each of these possible exits.

The code for this particular generation function is found in the 2.Generation directory under the filename RecognizeChooseApply.cs. This is actually an abstract class and cannot be invoked directly, as a result on must produce an inherited class to use this function. Two such inherited classes are shown in that same directory: chooseViaHumanGui.cs and randomChoose.cs. Mainly these inherited classes answer a difficult question of graph synthesis: how or who will make the decisions to synthesize new graphs?

Once an inherited class is established, a creation of that class (constructor) will be required to populate the fields of the recognize, choose, and apply process. These fields are:

int[] maxNumOfCalls :  the number of calls or cycles specified for each rule set. This is an array of length specified by the number of rule sets (<numOfRuleSets> in App.config). If it is not set, the value of maxRulesToApply will be used (<maxRulesToApply>).

candidate seed :  Often the same seed is used as a starting point with the generation process. That seed is stored here as a global field of the class.

ruleSet[] rulesets : The ruleSet array used to perform the generation process is stored here.

Boolean display : A simple Boolean used for debugging or interactive generation. If true then the host will be re-plotted after each apply action.

After the creation of the generation methods, one can invoke the generation by calling one of the existing RecognizeChooseApply.cs invoked functions:
public candidate generateOneCandidate()
public void runGUIOrRandomTest()
public candidate[] GenerateArrayOfCandidates(int numToCandidates)
public List<candidate> GenerateListOfCandidates(int numToCandidates)
or by writing your own invoking function in the derived class (see example at bottom of
randomChoose.cs).