October 2015


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
Rashi Aswani <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Tue, 27 Oct 2015 17:20:05 +0530
text/plain (2960 bytes) , text/html (4 kB)

I am sorry for not being clear earlier. I believe my question is a Mason
related one. More specifically I want to run an experiment that will be
repeated 100 times (each iteration has some randomly generated parameters).
One obvious way is to run an iteration and then manually start the program.
However this is time consuming, hence I am trying to automate the runs.

In each iteration, there are multiple agents each modeled as thread in
Mason. There is a display frame that gets created in each iteration which
gets closed at the end of the iteration. In order to make it automated I am
setting the display frame to null by using displayFrame.dispose() and then
displayFrame = null after the run is completed so in the next iteration a
new display frame comes up. However this is creating an issue since the old
display frame was not getting killed. In order to make sure it gets killed
correctly, I had to put in an arbitrary sleep so that all the threads are
finished and then the frame is killed. However the sleep is leading to:
(a) Long run times (hours) once I set up more runs.
(b) As I am making the frame null, it is not freeing up the memory hence I
get memory dump after some point. I also tried using unregisterFrame() and
unregisterAllFrames() but none of these worked.

In short, I'm trying to find out,
(a)Is there a functionality in Mason that can detect when all the threads
are done so we know when to close the display frame?
(b)Is there a way to close the display frame instead of specifically
nullifying it?


On Mon, Oct 12, 2015 at 11:09 PM, Eric 'Siggy' Scott <[log in to unmask]>

> Rashi,
> How to wait for threads until they complete is a general Java question
> <>,
> not a Mason question.  General multithreaded programming is out of the
> scope of this list.
> Of course, perhaps I've misunderstood your question, and you are using
> something Mason-specific to control your threads.  In that case perhaps you
> could give us a little more detail about what you're doing and what you'd
> like to do.
> Cheers,
> Siggy
> On Mon, Oct 12, 2015 at 11:18 AM, Rashi Aswani <[log in to unmask]>
> wrote:
>> Hello,
>> I'm using mason for a simulation having various threads and I'm trying to
>> run the same simulation again with different parameter values. I'm
>> currently using thread.sleep (to pause main thread) before creating one
>> more simulation (in next iteration) so as provide enough time for existing
>> simulation to run.
>> It would be great to know if there is any other way of handling threads,
>> as the sleep increases runtime to a great extent.
>> Thanking you in advance.
>> Regards,
>> Rashi Aswani
> --
> Ph.D student in Computer Science, George Mason University
> CFO and Web Director, Journal of Mason Graduate Research