Last week I wrote the base of an application running distributed agents over DSS/VPL, interchanging arbitrary messages, with automatic load balancing. You can read the details at:
Distributed Agents using DSS/VPL
Today, I extended the example with a new project, Fractal:
You can download from my Skydrive.
It has two DSS Service Components, one is the Calculator: it calculates a sector of the Mandelbrot fractal. The other component is the Renderer, that has a form to control and show the results of the calculation. The message that has the info of the sector to calculate is:
public class SectorInfo : MessagePayload { public double RealMinimum { get; set; } public double ImgMinimum { get; set; } public double Delta { get; set; } public int FromX { get; set; } public int FromY { get; set; } public int Width { get; set; } public int Height { get; set; } public int MaxIterations { get; set; } public int MaxValue { get; set; } }
Another class is the message that returns the calculation:
public class Sector : MessagePayload { public int FromX { get; set; } public int FromY { get; set; } public int Width { get; set; } public int Height { get; set; } public int[] Values { get; set; } }
The calculator splits the sector to calculate, if it too big. It can calculate all in only one step, but it is interesting to split the sector to generate more messages:
private void Calculate(AgentMessage msg) { LogInfo("Entering Calculator with Action: " + msg.Action); SectorInfo sectorInfo = (SectorInfo) msg.Payload; LogInfo(String.Format("X {0} Y {1} Width {2} Height {3}", sectorInfo.FromX, sectorInfo.FromY, sectorInfo.Width, sectorInfo.Height)); if (sectorInfo.Width > 100 && sectorInfo.Height > 100) SplitSector(sectorInfo); else CalculateSector(sectorInfo); }
As in the previous example, you can run this from a VPL diagram, FractalVpl1:
There is only one renderer, and two calculators agents. If you launch this VPL program, a window appears. This is the initial window content (after pressing the Calculate button):
You can drag and move the mouse to select a new region, or use the buttons to zoom in and out. Reset backs to the initial position. You can resize the window and invoke Calculate again. New colors button changes the color palette in use.
There is another VPL program, FractalVpl2, that it can be used to run the same example in a distributed way. It has a diagram with two AgentHosts:
and two nodes:
You must compile the VPL example and run as distributed nodes, using the rundeployer.cmd (see my previous post for details).
These some of the drawings the system produces:
Enjoy!
Angel “Java” Lopez
http://www.ajlopez.com/en
Too awesome!
Comment by Arvindra Sehmi — June 23, 2008 @ 5:16 am
[...] You can get Angel’s blog, agent toolkit and sample applications here. [...]
Pingback by Sehmi-Conscious Thoughts : Gorgeous Fractals with VPL and Distributed DSS Services — June 23, 2008 @ 5:43 am
[...] just offers up too many pleasant distractions, doesn’t it? Here’s a cool blog entry about using VPL to create fractal images. I haven’t spent much time playing with this – [...]
Pingback by Contagious Curiosity : Distributed Agents and Fractals using DSS/VPL — June 23, 2008 @ 3:31 pm
Great work! Makes me want to create another render farm and spin up some animations!
Comment by Phil Wheat — June 24, 2008 @ 2:46 am
[...] Distributed Agents and Fractals using DSS/VPL [...]
Pingback by Fractal application revisited « Angel “Java” Lopez on Blog — December 17, 2008 @ 9:46 am
[...] out to me as someone who’s really gotten into Robotics Studio. I went to check his blog at http://ajlopez.wordpress.com/2008/06/22/distributed-agents-and-fractals-using-dssvpl/ and was incredibly impressed. He’s not only put together some great mathematical services for [...]
Pingback by Phil Wheat : Now THERE's someone doing some productive work with Robotics Studio! — December 17, 2008 @ 10:49 pm
[...] Distributed Agents and Fractals using DSS/VPLAgentes Distribuidos usando DSS/VPL [...]
Pingback by Fractal revisitado - Angel "Java" Lopez — December 19, 2008 @ 1:20 pm
[...] Distributed Agents and Fractals using DSS/VPLAgentes Distribuidos usando DSS/VPL [...]
Pingback by Fractal revisitado | Buanzolandia — December 20, 2008 @ 12:00 am