How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

View: New views
5 Messages — Rating Filter:   Alert me  

How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

by fdsf dfds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

I'm new to Repast, and over the last couple of days I've been analyzing the sample codes as well as reading the documentation, trying to understand it. I would like to simulate a computer network using Repast, to simulate certain behaviors in it. I think the Network Projection would let me connect the agents the way I need. However, I can't see the topology when I run my simulation.

What I did was to take the simplehappy source in the examples. I've implemented a similar context, but only with the network projection. Then I added 2 agents I created that wouldn't do anything, besides being there and connecting to each other. The problem is, the agents aren't being drawn in the simulation. Do I need a grid or something similar even if I'm not interested in the specific positions the agents are?

Also, I read in the documentation that to customize the way the connections are made between the nodes, I'd have to implement the EdgeCreator interface. But I'm not sure how the edges between nodes are currently formed. For example, what would be the variables? What is stored once an edge is made between 2 nodes? Where is it stored? etc. I think an example of implementation for this interface would clear things a bit.

Thanks.

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest

Re: How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

by Nick Collier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Did you add the agents to the context? I'm assuming you've created a display.

On the EdgeCreator, created edges are stored in the Network projection. You can get reference to the Network via the Context that it "projects". The EdgeCreator itself is for creating edge classes that extend RepastEdge. You'd use if you need edge properties in addition to what repast provides. It assumes that you've written an edge class that provides those properties and you then write an EdgeCreator that creates edges of that type. Once you've associated the EdgeCreator with the projection via something like:

NetworkBuilder builder = new NetworkBuilder("Network", context, true);
builder.setEdgeCreator(myEdgeCreator);
Any edges that you get from the Network or that are created via Network.addEdge() are created with the EdgeCreator and all the edges in the network will be of that type.
As for implementation, its not much, here's extremely simple example:
 public class TestEdgeCreator implements EdgeCreator {

    /**
     * Creates an Edge with the specified source, target, direction and weight.
     *
     * @param source     the edge source
     * @param target     the edge target
     * @param isDirected whether or not the edge is directed
     * @param weight     the weight of the edge
     * @return the created edge.
     */
    public TestEdge createEdge(Object source, Object target, boolean isDirected, double weight) {
      return new TestEdge(source, target, isDirected, weight);
    }

    /**
     * Gets the edge type produced by this EdgeCreator.
     *
     * @return the edge type produced by this EdgeCreator.
     */
    public Class getEdgeType() {
      return TestEdge.class;
    }
  }

where TestEdge is an empty subclass of RepastEdge.

public class TestEdge extends RepastEdge {

  public TestEdge(Object source, Object target, boolean directed) {
    super(source, target, directed);
  }

  public TestEdge(Object source, Object target, boolean directed, double weight) {
    super(source, target, directed, weight);
  }
}

You'd obviously want to create your own edge class that actually did something.

Nick

On Nov 4, 2009, at 12:17 PM, fdsf dfds wrote:

Hello,

I'm new to Repast, and over the last couple of days I've been analyzing the sample codes as well as reading the documentation, trying to understand it. I would like to simulate a computer network using Repast, to simulate certain behaviors in it. I think the Network Projection would let me connect the agents the way I need. However, I can't see the topology when I run my simulation.

What I did was to take the simplehappy source in the examples. I've implemented a similar context, but only with the network projection. Then I added 2 agents I created that wouldn't do anything, besides being there and connecting to each other. The problem is, the agents aren't being drawn in the simulation. Do I need a grid or something similar even if I'm not interested in the specific positions the agents are?

Also, I read in the documentation that to customize the way the connections are made between the nodes, I'd have to implement the EdgeCreator interface. But I'm not sure how the edges between nodes are currently formed. For example, what would be the variables? What is stored once an edge is made between 2 nodes? Where is it stored? etc. I think an example of implementation for this interface would clear things a bit.

Thanks.
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest

Re: How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

by fdsf dfds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I added the agents to the context, but as far as creating a display goes, I'm not sure.

When I'm in the simulation window, there is the scenario tree. I right click display to add a new one, but I can't progress any further because my classes aren't selectable to be added to the display.

Looking at the sample codes, there are some XML files that seem to describe these displays. Is that what you mean by creating one? Is there a tutorial on what can be done and how in them?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest

Parent Message unknown Re: How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

by fdsf dfds :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I had already added them to the score and set up the .class path correctly.

I added the .xml's to the .rs directory just like the examples and editem them and now I can see the topology. Still, I didn't see anything about this anywhere, so I'm assuming I did it wrong, despite it working.

Another question: How would I go about setting up my own topology? There are the circle and random topologies for example, but what if I want one of my own? Also, is there a way to setup a topology for each agent type and then connect them?

Sorry if I'm asking too much, I just need to learn what I can do with it to know if what I'm trying to do with Repast is actually feasible.

2009/11/7 Justin York <gustaf717@...>
I think you need to add your agents into the score file so that they're available when you create displays. You can read more about it in the section 'Editing the Model Score' following this link: http://repast.sourceforge.net/docs/tutorial/SIM/2-01%20Creating%20a%20Simple%20Repast%20Model.html

On Sat, Nov 7, 2009 at 2:48 PM, fdsf dfds <bananapow3@...> wrote:
I added the agents to the context, but as far as creating a display goes, I'm not sure.

When I'm in the simulation window, there is the scenario tree. I right click display to add a new one, but I can't progress any further because my classes aren't selectable to be added to the display.

Looking at the sample codes, there are some XML files that seem to describe these displays. Is that what you mean by creating one? Is there a tutorial on what can be done and how in them?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest




------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest

Re: How Can I visualize a Network Projection? And how would I go about implementing the EdgeCreator Interface?

by Nick Collier-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

You might want to go through the tutorial. Not necessarily do it, but giving it a read may help in understanding how to set up a simulation and the various files (*.xml) and folders (*.rs). As for the topology, take a look at NetworkBuilder in 


Nick

On Nov 7, 2009, at 7:00 PM, fdsf dfds wrote:

I had already added them to the score and set up the .class path correctly.

I added the .xml's to the .rs directory just like the examples and editem them and now I can see the topology. Still, I didn't see anything about this anywhere, so I'm assuming I did it wrong, despite it working.

Another question: How would I go about setting up my own topology? There are the circle and random topologies for example, but what if I want one of my own? Also, is there a way to setup a topology for each agent type and then connect them?

Sorry if I'm asking too much, I just need to learn what I can do with it to know if what I'm trying to do with Repast is actually feasible.

2009/11/7 Justin York <gustaf717@...>
I think you need to add your agents into the score file so that they're available when you create displays. You can read more about it in the section 'Editing the Model Score' following this link: http://repast.sourceforge.net/docs/tutorial/SIM/2-01%20Creating%20a%20Simple%20Repast%20Model.html

On Sat, Nov 7, 2009 at 2:48 PM, fdsf dfds <bananapow3@...> wrote:
I added the agents to the context, but as far as creating a display goes, I'm not sure.

When I'm in the simulation window, there is the scenario tree. I right click display to add a new one, but I can't progress any further because my classes aren't selectable to be added to the display.

Looking at the sample codes, there are some XML files that seem to describe these displays. Is that what you mean by creating one? Is there a tutorial on what can be done and how in them?

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Repast-interest mailing list
Repast-interest@...
https://lists.sourceforge.net/lists/listinfo/repast-interest