MASON-INTEREST-L Archives

October 2006

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Christopher Roach <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Fri, 20 Oct 2006 16:27:57 -0400
Content-Type:
text/plain
Parts/Attachments:
text/plain (92 lines)
Sean,

Thanks so much for your help, that was exactly what I needed.  Sorry for asking
such a simple question (when I saw the answer it was definitely a "duh" moment
for me) but I'm still learning MASON and getting a feel for how everything
works right now.  Though my experience is little, I still feel confident in
saying that I am very happy with MASON thus far and I am happy that I chose it
over Repast for my model.  Oh and thanks for such a quick response as
well--most appreciated.

Keep up the good work.

Christopher

Quoting Sean Luke <[log in to unmask]>:

> On Oct 19, 2006, at 5:42 PM, Christopher Roach wrote:
>
> > I am currently working on some research where I am trying to
> > optimize the
> > individual ants in Ant Colony Optimization algorithms using
> > evolutionary
> > computation techniques and I am using MASON as my simulation
> > engine.  The
> > problem I am using for testing my algorithm is dynamic TSP and I am
> > using the
> > Network facilities in MASON to represent the TSP graph.  The only
> > problem with
> > this is that even in a small graph--e.g., eil51 with 1275 edges--
> > the number of
> > edges are quite large and displaying them all in the simulation
> > just adds up to
> > a huge amount of noise.  What I would like to be able to do is make
> > all edges in
> > the graph invisible with the exception of the edges that fall on
> > the best path
> > found so far.  So, my question is: does anyone happen to know how
> > to set the
> > visibilty of the individual edges in the network?
>
> You'll need to make a SimpleEdgePortrayal2D subclass which draws
> itself (or doesn't) based on whether or not the edge has a given
> feature.  Presuming that the edges in your best path all have info
> elements which indicate this, the SimpleEdgePortrayal2D can just look
> up this fact in the edge it's handed to draw.  Something like:
>
> public MyPortrayal extends SimpleEdgePortrayal2D
> 	{
> 	public void draw(Object obj, Graphics2D graphics, DrawInfo2D info)
> 		{
> 		Edge e = (Edge)obj;
> 		if (isOnBestPath(e)) super.draw(obj,graphics,inf);
> 		}
>
>      	public boolean hitObject(Object object, DrawInfo2D range)
> 		{
> 		Edge e = (Edge) object;
> 		if (isOnBestPath(e)) super.hitObject(object, range);
> 		}
> 	}
>
> > Also, in the future, I would like to have the best paths (plural)
> > displayed with
> > differing levels of intensity based on the amount of pheromone on
> > each edge.
> > So, if anyone knows of a way to also add a color map to the edges
> > in the
> > network, that would be really helpful as well.
>
> Hmmm, well SimpleEdgePortrayal2D could be rewritten or subclassed so
> that instead of setting the graphics to the color provided, it does
> this:
>
> 	Edge e = (Edge)obj;
> 	if (e.info != null)
> 		{
> 		if (e.info instanceof Valuable)
> 			{
> 			double val = ((Valuable)(e.info)).doubleValue();
> 			graphics.setColor(myColorMap.getColor(val));
> 			}
> 		else if (e.info instanceof Number)
> 			{
> 			double val = ((Number)(e.info)).doubleValue();
> 			graphics.setColor(myColorMap.getColor(val));
> 			}
> 		else graphics.setColor(someDefaultColor);
> 		}
>
> Sean
>

ATOM RSS1 RSS2