MASON-INTEREST-L Archives

July 2012

MASON-INTEREST-L@LISTSERV.GMU.EDU

Options: Use Monospaced Font
Show HTML 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:
Russell Thomas <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Tue, 17 Jul 2012 11:24:50 -0700
Content-Type:
multipart/alternative
Parts/Attachments:
text/plain (2559 bytes) , text/html (4 kB)
Sorry if this is not the right place to post a bug report, but I couldn¹t
find any other list or email address on the MASON page.

Details below.

Russ

------

The suspected bug is in the ³addEdge(Edge e)² method of the Network class. I
get a exception: ³Attempted to add an Edge already added elsewhere² when
actually the network is empty after a clear().

Context: Prior to the code snippet shown, I have initialized a network
³consumerSocialNetwork² and have been updating it for many steps during the
priming process for my agents.  Once priming is complete, I want to reset
the network to its initial topology and continue the run.

> This code works:
>         consumerSocialNetwork.clear();
>         Edge [][] e = softRestartSocialNetwork.getAdjacencyMatrix();
>         for (int i = 0; i < e.length; i++){
>             for (int j = i + 1; j < e[i].length; j++){
>                 if (e[i][j]!=null){
>                   Consumer from = (Consumer)e[i][j].from();
>                   Consumer to = (Consumer)e[i][j].to();
>                   SocialTie tie = (SocialTie)e[i][j].getInfo();
>                   consumerSocialNetwork.addEdge(from,to,tie);
>                 }
>             }
>         }
> ---------------------------------------------------
> This code, which should be equivalent, does not work:
>         consumerSocialNetwork.clear();
>         Edge [][] e = softRestartSocialNetwork.getAdjacencyMatrix();
>         
>         for (int i = 0; i < e.length; i++){
>             for (int j = i + 1; j < e[i].length; j++){
>                 if (e[i][j]!=null){
>                   consumerSocialNetwork.addEdge(e[i][j]);
>                 }
>             }
>         }
> ------------------------------------------------
> OUTPUT
> Diagnostic print statement for e[i][j], i = 0, j = 1:
> 
>    array indices = (0, 1); edge =
> Edge[agents.Consumer@7031086c<->agents.Consumer@2670d85b:
> valueNets.SocialTie@e74917]
> 
> Error message:
> java.lang.RuntimeException: Attempted to add an Edge already added elsewhere
>         at sim.field.network.Network.addEdge(Network.java:355)
>         at valueNets.ValueNets.softRestart(ValueNets.java:1600)
>         at valueNets.ValueNets.access$000(ValueNets.java:73)
>         at valueNets.ValueNets$2.step(ValueNets.java:1384)
>         at sim.engine.Repeat.step(Schedule.java:766)
>         at sim.engine.Schedule.step(Schedule.java:324)
>         at sim.display.GUIState.step(GUIState.java:462)
>         at sim.display.Console$58.run(Console.java:2532)
>         at java.lang.Thread.run(Thread.java:680)



ATOM RSS1 RSS2