Distributed Agents and Fractals using DSS/VPL

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

12 thoughts on “Distributed Agents and Fractals using DSS/VPL

  1. Pingback: Sehmi-Conscious Thoughts : Gorgeous Fractals with VPL and Distributed DSS Services

  2. Pingback: Contagious Curiosity : Distributed Agents and Fractals using DSS/VPL

  3. Pingback: Fractal application revisited « Angel “Java” Lopez on Blog

  4. Pingback: Phil Wheat : Now THERE's someone doing some productive work with Robotics Studio!

  5. Pingback: Fractal revisitado - Angel "Java" Lopez

  6. Pingback: Fractal revisitado | Buanzolandia

  7. Pingback: Now THERE’s someone doing some productive work with Robotics Studio! « Knowledge Matters

  8. Mario

    Hi Angel.
    I’m really interested in CCR and DSS and really appreciate your project’s concept.
    I would like to build the solution (agents + the fractal implementation) using MRDS 2008 R2 and VS2008 but I’m getting lots of errors (also after fixing the different \USER\ paths in the projects properties…

    in particular the proxy dll is not being generated.

    would you consider updating the solution to run with ccr/dss 2008 R2 and VS 2008 ?

    thank you and regards,
    Mario

    Reply
  9. cheap logo

    This is very interesting, You’re a very skilled blogger. I have joined your feed and look forward to more of your magnificent post. Also, I’ve shared your website in my social networks!

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s