jGE NetLogo v2.0 Documentation

jGE NetLogo 2.0 User Manual   

Introduction

The jGE NetLogo extension lets users of NetLogo (Wilensky, 1999) incorporate within their models a small part of the functionality and features of the jGE Library (Georgiou and Teahan, 2006a). Namely, it provides primitives which allow the users to take advantage of the Grammatical Evolution algorithm (O'Neill and Ryan, 2003) and utilise it for the evolution of the morphology and/or the behaviour of NetLogo agents (turtles). This extension includes reporters and commands which provide the functionality of Grammatical Evolution plus some supporting / helper primitives.

The goal of this extension is to allow both NetLogo users to get familiar with and use Grammatical Evolution within their models, and users interested in Evolutionary Computation to use evolutionary algorithms (like Grammatical Evolution) directly within a simulation environment for the evolution of the morphology and behaviour of agents.

Furthermore, another one goal of this extension is to facilitate the evolution of the behaviour of NetLogo agents. The key factor in most of the Evolution models of NetLogo is how the agent-environment interaction affects the simulation. There are two components to this (fairly obviously) – the agents, and the environment. What the existing NetLogo agents do is interact with (possibly) a dynamic environment. Usually the agents themselves are not dynamic themselves – i.e. their behaviour does not usually alter based on the changing environment. What the jGE NetLogo extension provides is the ability for the human modeller to alter the behaviour of the agents. The agents themselves can also alter the environment, and with the jGE NetLogo extension, it is now possible to have the environment affect the resultant behaviour of the agents as they determine what is best to interact successfully (or even survive) within it.

How to Install

The jGE NetLogo extension requires at least NetLogo 4.1. It is not tested with older versions of NetLogo. To install the jGE NetLogo extension for use by any model, place jGE's folder in the extensions directory in the NetLogo directory. Or, you can just keep the jGE's folder in the same folder as the model that uses it. For more information about other ways of installing an extension refer to the NetLogo Extensions Guide.

Getting Started

The main usage pattern of jGE in NetLogo models is as follows: The user creates a model for the problem in question and defines the agents (breeds), and their initial morphology and/or behaviour. The domains of these are defined in external text files as BNF Grammar/s which will be used for the mapping of the genotype of the agents (binary string) to the phenotype (NetLogo agent's attributes or actions). In the case of the evolution of the morphology of an agent, the modeller has to assign the evolved attributes to the agent by decoding the resultant phenotype and using the NetLogo programming language features. In the case of the evolution of the behaviour of an agent, the modeller has to execute the resultant behaviour (phenotype) using the "run" native primitive. Also, regarding the selection mechanism, and the replacement strategy, these are responsibilities of the NetLogo model. In this way the modellers gain the maximum flexibility (limited only by the NetLogo features) plus the advantage of using the Grammatical Evolution algorithm in a straight and simple manner for the evolution of their agents.

jGE NetLogo Dictionary

The documentation of the commands and reporters of the jGE NetLogo extension follows.

jge:load-bnf

jge:load-bnf path reference

This command loads, parses, and keeps in-memory (for later use in the model by mentioning the reference value) the BNF grammar which is found in a file with the given path. The argument path is a string with the value of the absolute path of the BNF file (or the relative path to the model which calls this command). The argument reference is a string with the name that will be used in the model for referencing the loaded BNF grammar (in that way it is possible to load and use more than one BNF grammar in the same model).

Note: If the file does not exist or the BNF grammar has a wrong format (not compatible with jGE according to the jGE Documentation) then these will cause a runtime error. Check the log file of the NetLogo installation for more information when a non-valid BNF Grammar runtime error occurs. If another BNF grammar is loaded using the same reference with a previous one, then the previous grammar will be replaced by the new grammar.

;; Assume it is a Windows Machine. Load the first BNF Grammar
jge:load-bnf "C:/BNFFile1.txt" "grammar1"

;; Load the second BNF Grammar
jge:load-bnf "C:/BNFFile2.txt" "grammar2"

;; Replace BNF Grammar in grammar1 with a new BNF Grammar
jge:load-bnf "C:/BNFFile3.txt" "grammar1"

See also bnf-grammar.

jge:bnf-grammar

jge:bnf-grammar reference

Reports the BNF Grammar which is referenced by reference.

Note: A non-existent reference will cause a runtime error.

;; Assume it is a Windows Machine
;; Load the BNF Grammar
jge:load-bnf "C:/BNFFile.txt" "grammar"
;; Print the loaded BNF Grammar
print jge:bnf-grammar "grammar"
<Int> 	
     <Int><Digit> 	
     <Digit>

<Digit>
     0
     1
     2
     3
     4
     5
     6
     7
     8
     9

See also load-bnf.

jge:phenotype

jge:phenotype genotype grammar codonsize maxwraps

Executes the genotype to phenotype Grammatical Evolution mapping algorithm and reports a string with the corresponding phenotype to the given binary genotype. The mapping process uses the BNF Grammar referenced by grammar, size for each codon by the given codonsize, and maximum number of genotypes by maxwraps. If the resultant phenotype is invalid (contains non-terminal symbols) then an empty string is returned.

Note: Setting genotype to anything else other than a binary string, or setting grammar to a non existent reference of a BNF Grammar, or setting the argument codonsize to a non-positive integer, or setting maxwraps to a negative value, will cause a runtime error.

show jge:phenotype "01000110110001" "actionsGrammar" 2 4
=> "fd 1 fd 1 lt 90 fd 1 fd 1 rt 90 fd 1"
show jge:phenotype "1011010110" "integersGrammar" 2 0
=> "325"

See also load-bnf, is-binary?.

jge:crossover

jge:crossover parentA parentB probability

Reports a NetLogo List with the results (two binary strings) of the application of the Standard One Point Crossover operation with probability probability to the variable-length binary strings parentA and parentB.

Note: The arguments parentA and parentB should be non-empty binary strings. The argument probability should take values from 0.0 to 1.0. Setting the arguments to out of range values will not cause any runtime error except in the case of empty parent/s. In the case of probability any negative value is counted as equivalent to 0.0 and any value greater that one is counted as equivalent to 1.0.

show jge:crossover "0000000000" "1111111111" 0.9
=> ["00000000111111" "111100"]
show jge:crossover "0000000000" "1111111111" 0.9
=> ["0001" "1111111110000000"]
show jge:crossover "0000000000" "1111" 0.9
=> ["000000000" "11110"]
show jge:crossover "0000000000" "1111" 0.9
=> ["00" "111100000000"]

See also crossover-fixed-length, mutation, is-binary?.

jge:crossover-fixed-length

jge:crossover-fixed-length parentA parentB probability

Reports a NetLogo List with the results (two binary strings of the same length) of the application of the Standard One Point Crossover operation with probability probability to the fixed-length binary strings parentA and parentB.

Note: The arguments parentA and parentB should be non-empty binary strings of the same length. The argument probability should take values from 0.0 to 1.0. Setting the arguments to out of range values will not cause any runtime error except in the case of empty or with different length parent/s. In the case of probability any negative value is counted as equivalent to 0.0 and any value greater that one is counted as equivalent to 1.0.

show jge:crossover-fixed-length "0000000000" "1111111111" 0.9
=> ["0000001111" "1111110000"]
show jge:crossover-fixed-length "0000000000" "1111111111" 0.9
=> ["0000000011" "1111111100"]
show jge:crossover-fixed-length "00000" "11111" 0.9
=> ["00111" "11000"]
show jge:crossover-fixed-length "000000" "111111" 0.9
=> ["000001" "111110"]

See also crossover, mutation, is-binary?.

jge:mutation

jge:mutation offspring probability

Reports a string with the result of the application of the Point Mutation operation with probability probability in the binary string offspring.

Note: The argument offspring is a non-empty binary string. Setting this argument to an invalid value will cause a runtime error. The argument probability should take values from 0.0 to 1.0. Setting this argument to out of range values will not cause any runtime error because any negative value is counted as equivalent to 0.0 and any value greater that one is counted as equivalent to 1.0.

show jge:mutation "0000000000" 0.1
=> "0000100001"
show jge:mutation "0000000000" 0.1
=> "0001000000"
show jge:mutation "0000000000" 0.1
=> "1000010000"
show jge:mutation "0000000000" 0.1
=> "0001100100"

See also crossover, crossover-fixed-length, is-binary?.

jge:individual

jge:individual codonsize min max

Reports a randomly generated genotype (binary string) of size between the specified limits (size of codon in bits, minimum length in codons, and maximum length in codons). The binary string will have a random number of codons (each one of codonsize bits) in the range between min and max.

Note: All arguments are positive numbers (integers). Setting any argument with a value less than or equal to zero (0) or setting to min a value greater than the value of max will cause a runtime error.

show jge:individual 4 1 3
=> "01011010"
show jge:individual 4 1 3
=> "1101"
show jge:individual 4 1 3
=> "111001010010"

See also population.

jge:population

jge:population size codonsize min max

Reports a NetLogo List of length size with randomly generated genotypes (binary strings). Each genotype (binary string) contains a random number of codons (each one of codonsize bits) in the range between min and max.

Note: All arguments are positive numbers (integers). Setting any argument with a value less than or equal to zero (0) or setting to min a value greater than the value of max will cause a runtime error.

show jge:population 6 2 1 3
=> ["0101" "001111" "01" "000110" "01" "001101"]
show jge:population 6 2 1 3
=> ["11" "01" "0110" "00" "000010" "0101"]
show jge:population 6 2 1 3
=> ["1110" "101100" "100101" "11" "110101" "10"] 
show jge:population 6 2 3 3
=> ["111000" "101100" "100101" "101011" "110101" "000010"]

See also individual.

jge:is-binary?

jge:is-binary? string

Reports true if the given string is binary, false otherwise.

Note: If the given string is empty then false is reported.

show jge:is-binary? "000101101010"
=> true
show jge:is-binary? "abcdabcdabcd"
=> false
show jge:is-binary? "232323232323"
=> false
show jge:is-binary? "200010110100"
=> false
show jge:is-binary? ""
=> false

See also phenotype, crossover, crossover-fixed-length, mutation.

jge:version

jge:version

Reports the product version of the jGE NetLogo extension.

show jge:version
=> "2.0"

 

What's New?

Version 2.0

 

Contact Information

Author: Loukas Georgiou

Email: eep201@bangor.ac.uk, loukas@informatics.bangor.ac.uk

Web Site: http://www.bangor.ac.uk/~eep201/

References

GEORGIOU, L. and TEAHAN, W.J. (2006) jGE - A Java implementation of Grammatical Evolution. 10th WSEAS International Conference on Systems, Athens, Greece, July 10-15, 2006.

GEORGIOU, L. and TEAHAN, W. J. (2006) Implication of Prior Knowledge and Population Thinking in Grammatical Evolution: Toward a Knowledge Sharing Architecture. WSEAS Transactions on Systems 5 (10), 2338-2345.

O'NEILL, M. and RYAN, C. (2001) Grammatical Evolution. IEEE Transactions on Evolutionary Computation 5(4), 349-358.

O'NEILL, M. and RYAN, C. (2003) Grammatical Evolution: Evolutionary Automatic Programming in an Arbitrary Language. USA: Kluwer Academic Publishers.

UWB SCHOOL OF INFORMATICS (2006) Java GE (jGE) Official Web Site. United Kingdom, Bangor. Available from http://www.informatics.bangor.ac.uk/~loukas/jge.

WILENSKY, U. (1999) NetLogo. Evanston, IL: Center for Connected Learning and Computer-Based Modeling, Northwestern University. Available from http://ccl.northwestern.edu/netlogo.

Terms of Use

All contents © 2008 Loukas Georgiou.

jGE NetLogo extension is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

jGE NetLogo extension is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with jGE NetLogo extension. If not, see http://www.gnu.org/licenses.