Neuro 317 Methods in Computational Neurobiology
Univ. of Illinois, Urbana-Champaign
Prof. Mark Nelson

Homework 6 - Problem 2

2. In this problem you will explore the role of noise in enhancing foraging efficiency.  To carry out this exercise, you'll need to comment out three lines of code in bbsim.m that reset the trail of dots whenever the bug runs into a light source. Comment out lines 274-276 as follows:
```

% reset trail
% trailCnt = 0;
% xtrail = robot.x*ones(maxTrail,1);
% ytrail = robot.y*ones(maxTrail,1);

```
Now the bug will leave a trail of up to 1000 dots on the screen as it moves around the arena. The dots are added every time step (1/30 s), so it takes approximately 33.3 seconds of simulated time for the bug to lay down a full-length trail of 1000 dots. Once the trail is complete you'll notice that the dots are removed from the end of the trail, such that the total number of dots remains at 1000. You'll also need to download estFillingFraction.m which will estimate how much of the arena has been filled with dots.

(a) Create a new controller called brain_wander.m. In the body of the function, set motorL and motorR to A + B*randn, where A and B are constants. Use a different random number for each motor. For example:
`function [motorL, motorR] = brain_wander(sensorL, sensorR, DT)    A = 0.0;     B = 1.0;    motorL = A + B*randn;    motorB = A + B*randn;`

(a) Explore different combinations of A and B. Run the simulation for at least 34 seconds of simulated time (to generate a complete trail). Then hit pause and call estFillingFraction from the command line. Generate a table with different combinations of A and B.  Try at least seven different combinations (more is OK).  For each combination, indicate the filling fraction  and give a brief description of the bug's behavior. For example, the entries in your table might look similar to the following:

 A B Estimated FillingFraction Comments 1.0 0.0 0.05 Bug moves in a straight line at maximum velocity . 0.0 1.0 0.11 Bug moves erratically, forward, backward, spins in place, etc. Doesn't seem to cover much ground.

Now, imagine that your are the design engineer for a company that makes a robotic vacuum cleaner (like the Roomba). You are asked to design a controller that covers as much of the surface area as possible in a given amount of time. Fortunately, your company specializes in cleaning surfaces on the space station which happen to have boundary conditions just like the arena in bbsim!

(b) For the controller architecture specifiec in part (a), what values (or range of values) do you recommend for the parameters A and B? Why?

(c) The "power management" team decides that A cannot be any larger than 0.25, otherwise the batteries will run down too quickly. Your boss remembers hearing a seminar about stochastic resonance in graduate school and wants to know if A is fixed at 0.25, is there is an optimal noise level B that maximizes the performance.  What is your response?

(d) Your boss suggests that you might be able to improve the coverage by using different parameters for the left and right motors (e.g., motorL = A + B*randn; motorR = C + D*randn). Carry out some simulations to test this idea, then summarize and explain your results.

 EXTRA CREDIT: Design a controller that achieves 100% converage in the alloted time. Restrictions: You cannot modify any of the code in bbsim.m, you cannot modify the code in estFillingFraction.m, you cannot access global variables in your controller code. Your controller does not have to use neurons. Your controller does not have to use noise. If you can't achieve 100% coverage, turn in your best controller. Good luck!