Fractal Frenzy !

In this NetLogo application I explore the computational performance of my own computer and NetLogo to use random walk theory to render a mandlebrot.

The computer in use is a mac running os-x bigsur, which Unix based on the BSD kernel, so optimal for threading and process execution. The CPU is 3.8GHz 8 core I-8 with 128Gb of DDR4 memory. The GPU takes the edge of the OSX Windowing environment in which applications such as NetLogo are presented.

Computer specification
Mandlebrot rendered by Netlogo ‘turtlebots’

Initial rendering takes the form of setting the amount of turtles which will b eused, the ‘throw’ which is the distance the turtles will travel on their path and the scale factor, which effectively translate to zooming in or out.

The AI being used by the turtles here is the unique way in which a mandlebrot is generated. As the turtles ‘explore’ their random path, they encounter the spaces around them, whereby if the point is already ‘occupied’ the colour changes. In this way with many turtles and many random paths based on the Mandlebrot equation, the familar pattern is rendered.

initial mandelbrot setup screen of 1000 turtles

After approximantely one minute, and with show turtles, the familar mandlebrot pattern emerges. The halo effect is largely complete and the turtles are now working on further iterations of ‘colour climbing’ the currently occupied spaces.

The beauty of the mandlebrot series is that it is endless and the ability to scale it, by adjusting the scale-factor will render the mandlebrot zoomed in, even tho the turtles are following a random path. Here the speed of ticks is set to fastest and showing the turtles as the render completes.

3 minutes of render time with show turtles

Netlogo was consuming alot of processing time, but not alot of the overall resources as can be seen from this ‘top’ output.

Processes: 683 total, 4 running, 1 stuck, 678 sleeping, 2916 threads 03:13:50
Load Avg: 3.55, 2.78, 2.31 CPU usage: 8.19% user, 8.35% sys, 83.45% idle SharedLibs: 726M resident, 110M data, 158M linkedit.
MemRegions: 235899 total, 17G resident, 440M private, 4369M shared. PhysMem: 54G used (6694M wired), 74G unused.
VM: 5424G vsize, 2318M framework vsize, 0(0) swapins, 0(0) swapouts. Networks: packets: 47177662/46G in, 150461034/114G out.
Disks: 5121776/98G read, 3273115/69G written.

PID COMMAND %CPU TIME #TH #WQ #PORTS MEM PURG CMPR PGRP PPID STATE BOOSTS %CPU_ME %CPU_OTHRS UID FAULTS COW MSGSENT
25364 NetLogo 105.6 08:11.81 45/1 2 378- 894M+ 16K 0B 25364 1 running *0[140] 0.38790 0.40022 501 365252+ 770 2011504+

For the next set of rending and further zoom, i remove the turtles. In my own previous experiments using Mandlebrots in Python 2.x and rendering engine in Python, removing the turtles speeded things up considerably.

hide turtles = faster render time

As such the time to render the fractal was decreased but not massively, a similar amount of resources was used by the system.

Processes: 664 total, 3 running, 661 sleeping, 2862 threads 03:26:12
Load Avg: 3.71, 3.06, 2.71 CPU usage: 8.21% user, 1.24% sys, 90.54% idle SharedLibs: 726M resident, 110M data, 158M linkedit.
MemRegions: 232388 total, 16G resident, 433M private, 4370M shared. PhysMem: 54G used (6360M wired), 74G unused.
VM: 5335G vsize, 2318M framework vsize, 0(0) swapins, 0(0) swapouts. Networks: packets: 47238047/46G in, 150536161/114G out.
Disks: 5123227/98G read, 3288798/70G written.

PID COMMAND %CPU TIME #TH #WQ #PORTS MEM PURG CMPR PGRP PPID STATE BOOSTS %CPU_ME %CPU_OTHRS UID FAULTS COW MSGSENT
25364 NetLogo 108.8 20:33.76 46/1 3 378 778M 16K 0B 25364 1 running *0[298+] 0.49873 0.64401 501 491848+ 770 247550

Conclusion

In this Netlogo simulation i set out to see the grapical capabilities of NetLogo (2d) and my own computer. It can be clearly demonstrated that the computational power and resources of the computer are more than adequate to run complex calcuations and rendering, giving the possiblity that I could include various levels of complex rendered worlds in my own NetLogo application.

Leave a Reply

Your email address will not be published. Required fields are marked *