machine_programmer.tex 6.15 KB
 LiberIT committed Dec 16, 2017 1 2 \chapter{Machine Programmer}  LiberIT committed Jan 17, 2018 3 \begin{description}  LiberIT committed Feb 02, 2018 4 5  \item[recipe] is a function in computer programming jargon. \item[holy recipe] is a pure functionin computer programming jargon.  LiberIT committed Jan 17, 2018 6 7 \end{description}  LiberIT committed May 09, 2018 8 9 10 11 12 13 14 15 16 17 18 \section{Oracle Based, or Active Synthesis} The interactive version of evolutionary programming is where a user starts a conversaion with the machine programmer. First you would give a brief description about the purpose of this function, for documentation, and helping yourself narrow it down a little. Then you would make the function declaration with the input and output types, perhaps with some contractual constraints on the range of valid inputs and outputs.  LiberIT committed May 22, 2018 19 20 21 22 23 24 At this point the machine programmer can check it's inventory of known programs to see if there are any matching programs, that have the same input/outputs, and similar names and-or description. If it finds a small amount of them, can ask if you'd like to use one of them as a basis. After that user can give one or more input and output example and-or a logical  LiberIT committed May 10, 2018 25 26 description of what the output should be relative to the input. Can also offer some suggestions for which functions may be helpful in accomplishing the task.  LiberIT committed May 09, 2018 27 28  At which point the machine programmer will start evolving functions that meet  LiberIT committed May 22, 2018 29 30 31 32 33 34 35 36 37 38 39 the specification and examples. If it is taking more than a few seconds user can start writing the program as they think it should be. the functions they thought would be necessary would be in comments, they can remove or add to them as necessary or uncomment them to include them in the code. If the user decides that will need to make a new support function in order to achieve this task, then can save state of this development. and switch over to developing the supporting function. If it evolves multiple programs that meet the  LiberIT committed May 09, 2018 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 full specification, but deviate from each other within the valid range of inputs. Then the machine programmer will ask which of them is prefered, or if neither then by giving the appropriate output for that particular input. This process of refinement would occur until either the user is satisfied with the program or all the evolved programs having matching input and output pairs. The machine programmer will then select one or more of the evolved programs to the library, based on what optimization have been set. For example, if size-optimization is enabled, then the smallest would be added, if speed-optimization is enabled then the fastest would be added, if fault-tolerance is enabled then two which call a maximally different set of functions would be added. Got the idea from a book called "Program Synthesis" (2017), about a 4 hour read: https://www.nowpublishers.com/article/Details/PGL-010  LiberIT committed Dec 16, 2017 58 \section{Overview}  LiberIT committed Feb 02, 2018 59 60 A human programmer writes a recipe template, recipe suggestions and either provides a working recipe or sample input and output data.  LiberIT committed Dec 16, 2017 61   LiberIT committed Feb 02, 2018 62 An encoder encodes the recipe template and recipe suggestions into the  LiberIT committed Dec 16, 2017 63 64 intermediate representation (IR).  LiberIT committed Feb 02, 2018 65 66 If the human programmer provides a working recipe, then the recipe profiler takes the recipe template IR and working recipe and generates the sample  LiberIT committed Dec 16, 2017 67 68 input and output data.  LiberIT committed Feb 02, 2018 69 A population generator takes the recipe suggestions IR and input from  LiberIT committed Dec 16, 2017 70 71 72 73 74 75 76 77 78 79 80 81 /dev/random to create the population IR.\@ The population compiler converts the population IR into kernel or .cl'' files, one for each. The population tester loads each population kernel, and streams the sample inputs through them, checking outputs for correctness, and produces the population fitness which includes fitness of all individuals. The champion selector takes the fitness ratings, and the population IR, and outputs the champions.  LiberIT committed Feb 02, 2018 82 The population mutator and recombiner takes the champions and recipe  LiberIT committed Dec 16, 2017 83 84 85 86 suggestions, then generates a new population IR.\@ An output generator takes the champions and outputs the best ones to a file.  LiberIT committed Dec 23, 2017 87 88 \section{input specification} The input specification consists of:  LiberIT committed Dec 16, 2017 89   LiberIT committed Dec 23, 2017 90 \begin{itemize}  LiberIT committed Feb 02, 2018 91 92 93  \item the slogan of the recipe, \item description of the recipe, \item specification of the recipe,  LiberIT committed Dec 23, 2017 94 \end{itemize}  LiberIT committed Dec 16, 2017 95   LiberIT committed Dec 23, 2017 96 \subsection{Constraint Specification}  LiberIT committed Dec 16, 2017 97   LiberIT committed Dec 23, 2017 98 99 100 101 The one implemented so far is one of the simplest, A form of constraint programing, commonly used in training contemporary AI\@. \begin{itemize}  LiberIT committed Jan 26, 2018 102  \item the training sequence  LiberIT committed Feb 02, 2018 103  \item a list of recipes to work with.  LiberIT committed Dec 23, 2017 104 105 106 \end{itemize}  LiberIT committed Dec 23, 2017 107 \subsection{Specification example}  LiberIT committed Dec 26, 2017 108 \begin{verbatim}  LiberIT committed Feb 02, 2018 109 specification -top recipe slogan -acc begin -rea  LiberIT committed Jan 26, 2018 110 training sequence -top begin -rea  LiberIT committed Dec 25, 2017 111 112 113 114 115 -quoted letter.A.letter -quoted -acc input -con -quoted letter.a.letter -quoted -acc produce -rea zero -num -acc input -con zero -num -acc produce -rea -fin  LiberIT committed Feb 02, 2018 116 recipe sequence -top begin -rea  LiberIT committed Dec 25, 2017 117 118 119 plus -rea subtract -rea -fin  LiberIT committed Jan 26, 2018 120 regulation sequence -top begin -rea  LiberIT committed Dec 25, 2017 121 -quoted letter.A.letter -quoted -abl down -con  LiberIT committed Dec 26, 2017 122 input -nom produce -acc copula -rea  LiberIT committed Dec 25, 2017 123 -fin  LiberIT committed Dec 26, 2017 124 \end{verbatim}  LiberIT committed Dec 23, 2017 125 126 127  \section{Evolutionary programming}  LiberIT committed Feb 02, 2018 128 multiple forms of evolution and optmial recipe discovery are used:  LiberIT committed Dec 23, 2017 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146  \begin{itemize} \item random mutation (asexual reproduction) \item program inversion with backpropogation \item crossover (sexual reproduction) \item speciation \item neuro evolution \item specification generated tests \item adverserial coevolution \item neural networks \end{itemize} A computer program is similar to a recurrent neural net. \section{Ceremony produce} The produce of the evolutionary process contains the following items: \begin{itemize}  LiberIT committed Feb 02, 2018 147  \item recipe slogan  LiberIT committed Dec 23, 2017 148  \item best tests generated if any  LiberIT committed Feb 02, 2018 149 150  \item health achieved and recipe metrics \item unique identifier based on universal hash of recipe definition.  LiberIT committed Dec 23, 2017 151  \item required imports  LiberIT committed Feb 02, 2018 152  \item recipe definition including declared internal variables.  LiberIT committed Dec 23, 2017 153 154 155 \end{itemize}  LiberIT committed Feb 02, 2018 156 The recipe produce is a named recipe, appended to the file that has the same  LiberIT committed Dec 23, 2017 157 158 verb. If no such file exists then it is created.  LiberIT committed Feb 02, 2018 159 This way various over-ride recipes will all be in the same file.  LiberIT committed Dec 23, 2017 160 161 162  Automatic importing can happen by getting a list of all the verbs in the file and importing them. Though that could have a lot of problems, if there are name  LiberIT committed Feb 02, 2018 163 collisions or there are different providers of recipes.  LiberIT committed Dec 27, 2017 164 165 166 167 168 169  \subsection{produce example} holy -top letter tiny -nom tiny letter -num -dat letter -num -acc begin -dec metadata -top begin -rea  LiberIT committed Jan 17, 2018 170   LiberIT committed Dec 27, 2017 171 172 -fin  LiberIT committed Feb 02, 2018 173 program recipe -deo  LiberIT committed Jan 17, 2018 174   LiberIT committed Dec 27, 2017 175 -fin