úΫ¿¦UO      !"#$%&'()*+,-./0123456789:;<=>?@ABCDE F G H I J K L M N  Safe-InferredFThe Rates structure is used to hold the probability of various events : occurring during the evolution of the GEP algorithm. /Probability of any single symbol being mutated  per individual *Probability of an individual experiencing $ insertion sequence transposition *Probability of an individual experiencing ) root insertion sequence transposition *Probability of an individual experiencing  gene transposition )Probability of a 1pt recombination event )Probability of a 2pt recombination event *Probability of a gene recombination event EThe SimParams structure reprents the parameters for a run of the GEP G algorithm. This includes gross parameters unrelated to individuals E such as the population size, parameters related to selection, and 5 parameters related to specific genetic operators. Population size #Exponent for defining the roulette  wheel bin sizes  Fitness of the ideal individual !Number of generations to run the  algorithm for Parameter m for fitness value # computation from the GEP paper. 'Maximum length of an IS transpose seq. (Maximum length of an RIS transpose seq.      NoneEGenerate a random number as a Double between 0.0 and the given upper  bound. EGenerate a random integer between 1 and the upper bound (inclusive). $Generate a list of random integers.  Document me! IGenerate a list of n random integers such that each entry occurs at most 2 once. Each number in the list must be unique. FGenerate a random integer in the specified range that is NOT equal to  the integer provided.  Upper bound.  Upper bound. Number of integers to generate Upper bound for each integer. OPQ Upper bound. Integer to avoid.    OPQ Safe-InferredDData type representing a genome. The genome contains all necessary L parameters to interpret a chromosome. These include the alphabet (split K between terminal and nonterminal characters), connective characters for L multi-gene chromosomes, the maximum arity of any nonterminal, the length B of the head of a gene, and the number of genes per chromosome. Set of terminal symbols Set of nonterminal symbols (Symbol connecting genes in a chromosome #Highest arity nonterminal function !Length of gene head sequence "Number of genes per chromosome #?Function to express an individual into a list of ET structures $FSymbol table used for fitness tests. We assume that there is exactly G one pair per symbol. If there are symbols missing, fitness testing C may fail (the library does not have facilities yet to allow for E default values). If a symbol occurs multiple times in the symbol C table, no guarantee is provided for which value will be chosen. %HA chromosome is a list of symbols. We avoided using a list of genes to G maintain the view of a chromosome as nothing more than a flattened,  linear sequence of genes. &,A gene in a chromosome is a list of symbols 'JA sequence of symbols not neccessaryly a gene or chromosome. Used in gene  operations. (A symbol in a chromosome )JGiven a genome, provide the list of all symbols possible in a chromosome. + This is just nonterminals ++ terminals. *;Return the length of the tail of a gene for a given genome +9Return length of a gene (tail + head) for a given genome ,"Test if a symbol is a nonterminal -*Fracture a chromosome into a set of genes .*Assemble a chromosome from a set of genes  !"#$%&'()Genome List of symbols *Genome !Number of symbols in a gene tail +Genome Total length of a gene. ,Symbol to test Genome providing context 1True if symbol is a nonterminal, false otherwise -)Chromosome to split into a set of genes Length of a single gene &Ordered list of genes from chromosome .List of genes  Chromosome assembled from genes  !"#$%&'()*+,-. !"('&%$#*+)-.,  !"#$%&'()*+,-. Safe-InferredRLSplits a sequence into three by given positions. Similar to the splitAt but O for two positions. The positions must be in a non-descending order. This is  not checked. /One-point crossover 0Two-point crossover 1Gene crossover 2'Root insertion sequence transposition. 3"Insertion sequence transposition. 4Gene transposition. R/%Pair of individuals before crossover Crossover point $Pair of individuals after crossover 0%Pair of individuals before crossover Crossover point 1 Crossover point 2 $Pair of individuals after crossover S1%Pair of individuals before crossover Gene number for crossover Gene length in symbols $Pair of individuals after crossover T2)Sequence to perform RIS transposition on Genome information )Gene to perform RIS transposition within )Position within gene to start search for  RIS for transposition Length of RIS +Sequence after RIS transposition performed U3 Chromosome Genome  Gene number $Position to take from within a gene Length to take Position to put within a gene Resulting chromosome 4 Chromosome Genome  Gene number Resulting chromosome /01234/01432 R/0S1T2U34None5IS Transposition helper 6RIS Transposition helper 7Gene transposition helper 8DOne-point crossover helper. Takes a genome, a pair of individuals, D and selects the crossover point before generating the new pair of ) resulting individuals after crossover. 9DTwo-point crossover helper. Takes a genome, a pair of individuals, E and selects the crossover points before generating the new pair of ) resulting individuals after crossover. :CGene crossover helper. Takes a genome, a pair of individuals, and ? selects the crossover gene before generating the new pair of ) individuals resulting after crossover. 56789:56789:56789:56789:None;/Select a random symbol from the provided list. <<Select a sequence of random symbols from the provided list. =8Generate a new individual given a genome specification. >?Create a population of fresh random individuals given a genome  |specification. VKMutate symbols in a gene. Symbols are chosen from terminals and allsymbols / for head and tail of the gene respectively. WIMutate single symbol with probability pMutate choosing from given symbol  list. ;List of symbols Selected symbol <List of symbols Number to select List of selected  symbols =Genome for individual Number of genes to generate >Genome of population  Number of individuals to create VW?;<=>?;<=>?;<=>VW?None@GGiven a set of pairs (f,i) where f is the fitness of the individual i, E return the pair representing the individual with the best fitness. G We may return nothing if an empty set is passed in to begin with, so # the return type is a Maybe pair. AGGiven a list of indices and a list of data elements, create a new list F of data elements composed of the elements listed in the index list. * The output list may contain duplicates. BLGenerate n roulette weights with a generator exponent e. A helper function H weight_function is used to generate the actual weights. For example, K w = (k^e)^(-1) for k from 1 to n leads to a set of weights such that the M size of the slots decreases exponentially as fitness decreases. When e=1, P this decrease is linear. The list that is returned is the width of each slot 2 such that the total of the weights adds to 1.0. CKGiven a set of roulette weights and a number of spins of the wheel, return K a list of indices corresponding to the winning slot for each spin. This N is used to perform the actual selection after a set of roulette weights are  generated. @Fitness/Individual pairs &Best pair, or Nothing if no such pair XAList of indices to select List of elements IList composed of elements selected from original set by indices provided YBC@ABCBCA@@XAYBC Safe-Inferred ZD[\]^_`abDD ZD[\]^_`ab  Safe-InferredEEEE  Safe-InferredFBThe set of outputs expected for each entry in the test dictionary G)A test dictionary is a set of test cases H5A test case maps a list of terminals to float values IFitness function type JBFitness evaluator for generic individuals. This needs to go away > and use a more general approach like evaluateFitness above. KHGiven a list of fitness values and a corresponding list of individuals, M return a list of tuples pairing the fitness value with the individuals for L only those individuals that have a valid fitness value. This means those  that are +/- infinity or NaN are removed. L?Sort a set of individuals with fitness values by their fitness FGHIcJExpressed individual Fitness function %List of symbol tables for test cases (List of expected outputs for test cases #Range of selection. M in original $ GEP paper equations for fitness. #Fitness value for given individual KFitness values  Individuals Paired fitness/individuals after  filtering LFGHIJKLIHGFJKLFGHIcJKL Noned$debugging version of (!!) thanks to #!haskell help. by default we let E (!!!) simply alias (!!), but when we need to we can swap in a new eBReassemble a population. We are given a full population, the set H of individuals that are to be replaced and their indices. The output J of this function is the new population where the unmodified individuals K are carried forward and those that were modified are replaced with their  new versions. fSingle step of GEP algorithm dge"Indices of individuals to replace Replacement individuals Original population New population hifList of individuals Genome Simulation parameters Gene operator rates Expression function Fitness function Fitness inputs Fitness outputs M List of individuals Genome Simulation parameters Gene operator rates Expression function Fitness function Fitness inputs Fitness outputs &Maximum number of generations to test Ideal fitness MMdgehifM NoneNIGeneric driver to be called from specific GEP program instances in their  main routine. NSimulation parameters Rates for genetic operators 'Genome that individuals are drawn from $Test dictionary for fitness testing *Expected test results for test dictionary Fitness testing function !String to ET expression function .Return best individual fitness and population NNNj   !"#$%&&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMN O P Q R S T U V W XYZ[\]^_`abcdefghijkl m n o p q r st HSGEP-0.1.5 GEP.Params GEP.Rmonad GEP.TypesGEP.GeneOperationsGEP.MonadicGeneOperations GEP.Random GEP.SelectionGEP.Util.ConfigurationReaderGEP.Expression GEP.Fitness GEP.TimeStepGEP.GenericDriverRatespMutatepISpRISpGTp1Rp2RpGR SimParamspopSizerouletteExponent maxFitnessnumGenerationsselectionRangemaxISLen maxRISLenGEPMonadnextFnextR nextRList generatePairsnextRListUniquenextRListPairsnextRDifferent runRmonadGenome terminals nonterminals geneConnectormaxArity headLengthnumGenesExpressionFunctionSymTable ChromosomeGeneSequenceSymbol allsymbols tailLength geneLength isNonterminal chromToGenes genesToChrom crossover1pt crossover2pt crossoverGene transposeRIS transposeIS transposeGene isTransposer risTransposergeneTransposer x1PHelper x2PHelperxGHelper randomSymbolrandomSymbolList newIndividual newPopulationmutategetBestselectorgenerate_roulette_weightsroulettereadParameterslevelizeTestOutsTestDictTestCaseFitnessFunctionfitness_testerfitness_filter sortByFitness multiStep gepDriver removeNthshufflepairify splitThirds geneExtractfindRISinsertIntoGene mutateGene mutateSymbolweight_function innerSelectextractParameters lookupDouble lookupInt lookupString lookupCharremoveWhitespace splitLine fileToLinesreadConfigurationpairSort!!! putTogether singleStep intToDouble fillFilterGapapplyMutations