Module tutorial5
[hide private]
[frames] | no frames]

Module tutorial5

source code

tutorial5

Contains all parameters for the evolutionary run, grammar rules, constraints, and specifics about the terminal and function set of the trees in tutorial5. In this example, we evolve hybrid system: a model containing discrete values and logic operators and numerical operations. More specifically, we will evolve if_then_else types rules that will determine the application of different polynomials... from 20 sets of testing data (20 different values for x and y). Considering the constraints for building the trees, the root node will have 3 children, and these will be ordered ADF defining branches (we simply won't use ADF terminals nodes) describing the structure of the if then else statement. The solution found should be the equivalent of this expression: if x>y then cos(x) else sin(y)

A typical way to run the tutorial would be to:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.


Author: by Mehdi Khoury

Version: 1.20

Copyright: (c) 2009 Mehdi Khoury under the mit license http://www.opensource.org/licenses/mit-license.html

Contact: mehdi.khoury at gmail.com

Functions [hide private]
 
equal_(listElem) source code
 
superior_(listElem) source code
 
inferior_(listElem) source code
 
and_(listElem) source code
 
or_(listElem) source code
 
add(listElem) source code
 
sub(listElem) source code
 
neg(listElem) source code
 
multiply(listElem) source code
 
square(listElem) source code
 
cos(listElem) source code
 
sin(listElem) source code
 
if_(x) source code
 
then_(x) source code
 
else_(x) source code
 
rootBranch(x) source code
 
GetIdealResultsData() source code
 
FitnessFunction(my_tree) source code
Variables [hide private]
  functions = {'+': add, '-': sub, 'neg': neg, '*': multiply, '^...
  nb_eval = 20
  all_x = [0.415790465507, 5.29512144098, 1.56774827715, 5.43979...
  all_y = [7.48111452905, 3.59907678037, 0.0945960143436, 1.2611...
  terminals = {'x': [0.415790465507, 5.29512144098, 1.5677482771...
  ideal_results = []
  crossover_mapping = []
  defaultFunctionSet = [(1, 2, '+'), (1, 2, '*'), (1, 1, '^2'), ...
  defaultTerminalSet = [(3, 0, 'x'), (3, 0, 'y')]
  treeRules = {'*': [([(1, 2, '+'), (1, 2, '*'), (1, 1, '^2'), (...
  Strongly_Typed_Crossover_degree = 0
  Substitute_Mutation = 0
  adfOrdered = True
  __package__ = None
  i = 19
Variables Details [hide private]

functions

Value:
{'+': add, '-': sub, 'neg': neg, '*': multiply, '^2': square, 'cos': c\
os, 'sin': sin, '=': equal_, '>': superior_, '<': inferior_, 'and': an\
d_, 'or': or_, 'if': if_, 'then': then_, 'else': else_, 'root': rootBr\
anch}

all_x

Value:
[0.415790465507,
 5.29512144098,
 1.56774827715,
 5.4397989962,
 6.98245351488,
 1.24598222225,
 9.82566366847,
 0.247411683405,
...

all_y

Value:
[7.48111452905,
 3.59907678037,
 0.0945960143436,
 1.26114358765,
 2.92249833812,
 2.7207795698,
 2.4294785777,
 9.72012998853,
...

terminals

Value:
{'x': [0.415790465507,
       5.29512144098,
       1.56774827715,
       5.4397989962,
       6.98245351488,
       1.24598222225,
       9.82566366847,
       0.247411683405,
...

defaultFunctionSet

Value:
[(1, 2, '+'),
 (1, 2, '*'),
 (1, 1, '^2'),
 (1, 2, '-'),
 (1, 1, 'cos'),
 (1, 1, 'sin'),
 (1, 1, 'neg')]

treeRules

Value:
{'*': [([(1, 2, '+'),
         (1, 2, '*'),
         (1, 1, '^2'),
         (1, 2, '-'),
         (1, 1, 'cos'),
         (1, 1, 'sin'),
         (1, 1, 'neg')],
        [(3, 0, 'x'), (3, 0, 'y')]),
...