HW 06 solution [open in editor]

  due date: Tue Feb 20 by 9:00 PM
  email to: [email protected]
  subject: hw06
  email content: url link to your p5js project  
  
SAMPLE SOLUTION

In this assignment, you will evolve Braitenberg controllers that use up to 6 genes:

    mtrL = genes[0] + genes[1] * snsL + genes[2] * snsR;
    mtrR = genes[3] + genes[4] * snsL + genes[5] * snsR;
    
During evolution, you can control which genes are active, and restrict their values using the lowerBound and upperBound variables. For example, setting the lowerBound and upperBound for a gene to zero, silences the gene.



GA evolution



Fitness vs generation:

Instructions

  1. What value of bot.genes corresponds to a Braitenberg "aggressive" controller, with left/right motor offsets of 3 and crossed-connection strengths of 9?
    [3, 0, 9, 3, 9, 0]
  2. Enter this value for bot.genes in the top textbox; click "Reset" and then "Run/Pause". Describe the bot's behavior.
    The bot capture a few pellets along it's line-of-sight until it runs into a wall, then drifts to a corner where it gets stuck.
  3. Leaving bot.genes as above, click "Run Expt". What is the mean fitness and max fitness of this controller? Why do they differ?
    Mean fitness: 4.8 (should less than 10)
    Max fitness: 24
    Max fitness is significantly higher than the mean, because sometimes the bot gets "lucky" and the pellet placement leads it along a curving path path avoids running into a wall, so it collects more pellets.
  4. Leave the genes as above, but change the offset of the LEFT motor only from 3 to 4. What is the mean and max fitness of this controller? Why is the mean fitness so much higher than in question 3?
    Mean fitness: 118.5 (should greater than 100)
    Max fitness: 149
    When the bot doesn't see any pellets, it now turns to the right, rather than going straight, because the left wheel has a larger offset than the right. This prevents the bot from getting stuck against the walls.
  5. Now we will try to evolve an even more effective crossed-connection controller. What values of lowerBound and upperBound would allow the motor offset genes to vary between -9 to 9, the crossed-connection strengths to vary between 0 to 99, and the uncrossed connection strengths to be zero?
    lowerBound: [ -9, 0, 0, -9, 0, 0]
    upperBound: [ 9, 0, 99, 9, 99, 0]
  6. In the GA textbox, choose initial values of popSize, crossoverRate, mutationRate, and specify the lowerBound and upperBound from above. Click "GA Reset" and then "GA Run." Evolution will stop automatically after 50 generations. If necessary, readjust popSize, crossoverRate and mutationRate and re-evolve. What are the Best genome and Best fit values that you obtained (shown in blue)?
    Best gene: [-8.73, 0.00, 78.30, 4.58, 56.82, 0.00]
    Best fit: 221(should be greater than 200)
  7. Click "GA Load Best" to transfer this genome to the upper dialog box. Click "Reset" and "Run/Pause". Describe the bot behavior. How does it differ from the behavior observed in Question #4?
    The bot almost never hits the wall; when it can't see any pellets it spins in place.
  8. What are the relative signs of the two motor offsets? What does this imply about the bot behavior when it doesn't have any sensory input?
    The motor offsets have opposite signs. The bot spins when it doesn't have any sensory input.
  9. Now evolve a controller that allows both crossed and uncrossed connections. Report the gene and fitness values below. Does allowing both crossed and uncrossed connections seem to improve performance, degrade performance, or have little effect?
    Best gene: [0.43, 9.44, 48.67, -8.32, 99.00, -21.59]
    Best fit: 217
    It doesn't seem to have much of an effect on performance.
  10. Now evolve a controller under the constraints that gene 0 is fixed at -5, genes 1 and 2 are fixed at zero, gene 3 can vary between -9 and 9, gene 4 is fixed at zero and gene 5 can vary between -99 and 99. Report the best gene and fitness values that you obtained:
    Best gene: [-5.00, 0.00, 0.00, -4.92, 0.00, 8.33]
    Best fit: 75 (should be greater than 50)
  11. Use "GA Load Best" to load this genome into the simulator. Run the simulation and describe the bot behavior. Is this a surprising mode of foraging? Would you have been likely to discover this on your own without using a GA?
    The bot spins backwards spiraling toward nearby pellets as it goes. This is an unexpected behavior; I wouldn't have discovered it on my own. The GA can discover unusual or unexpected solutions that would be hard to find otherwise.
  12. (OPTIONAL) Feel free to run additional GA experiments on your own and/or comment on any interesting results or insights.
    Your answer here

End of assignment