MASON-INTEREST-L Archives

September 2012

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:
Tony Bigbee <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Wed, 26 Sep 2012 13:42:47 -0600
Content-Type:
text/plain
Parts/Attachments:
text/plain (233 lines)
SimState.doLoop doesn't print to standard out, only to System.err (at
least as of Mason 16 prerelease).   A first, simple workaround is to
redirect standard err to a file or devnull.
The rest of MASON's core doesn't print anything to the best of my
knowledge with the exception of an Exception stack trace in Schedule
(which you wouldn't want to ignore).

There are only 12 such System.err.print invocations in SimState and
two exception stack trace prints (defaulting to standard error).
The System.err.print statements in SimState:

        Line 377:             System.err.println(
	Line 422:         System.err.println("MASON Version " +
n.format(version()) + ".  For further options, try adding ' -help' at
end.");
	Line 514:                 System.err.println("Loading from checkpoint
" + checkpointFile);
	Line 520:                     System.err.println("Checkpoint contains
some other simulation: " + state + ", should have been of class " +
generator.simulationClass());
	Line 530:                     System.err.println("Recovered job: " +
state.job() + " Seed: " + state.seed());
	Line 532:                 else System.err.println("Renamed job: " +
state.job() + " (unknown seed)");
	Line 542:                 System.err.println("Job: " + state.job() +
" Seed: " + state.seed());
	Line 543:                 System.err.println("Starting " +
state.getClass().getName());
	Line 580:                     System.err.println("Steps: " + steps +
" Time: " + state.schedule.getTimestamp("At Start", "Done") + " Rate:
" + rateFormat.format((1000.0 *(steps - firstSteps)) / (clock -
oldClock)));
	Line 587:                     System.err.println("Checkpointing to
file: " + s);
	Line 594:             if (retval) System.err.println("Exhausted");
	Line 595:             else System.err.println("Quit");



On Wed, Sep 26, 2012 at 1:26 PM, Richard O. Legendi <[log in to unmask]> wrote:
> Yeah, that could definitely work, but just to make clear there's no such
> flag/property for that functionality at the moment. I wanted to avoid such
> workarounds (furthermore I have to search for all System.out references in
> the Mason code to hide them).
>
>
> Best,
> Richard
>
> --
> Richard O. Legendi
> Software developer
> Intelligent Applications and Web Services
> AITIA International, Inc.
> http://people.inf.elte.hu/legendi/
>
> On 2012.09.26. 21:11, Eric 'Siggy' Scott wrote:
>
> You could bestow the behavior you want onto the framework by making a
> subclass of SimState that overrides doLoop(), in which case you would have
> to copy and past all the code from the original doLoop (which is quite long)
> and make the blocks that print the output depend on a flag.
>
> I would roll my eyes and call that kludge if you committed it into my
> repository -- but it'd work, lol.
>
> Siggy
>
> On Wed, Sep 26, 2012 at 1:01 PM, Richard O. Legendi <[log in to unmask]>
> wrote:
>>
>> Hi Chris,
>>
>> Well, not exactly. I'm searching for some magic option that turns off all
>> output of a Mason simulation (i.e., all the log messages it prints out to
>> the console). I'm running some tests which involves running a few
>> mini-models that dumps the whole output of the console log of the CI system
>> I use for nightly builds.
>>
>> For paramsweep there is a nice tool called MEME that supports several
>> platforms (like Repast J, NetLogo or custom Java simulations) which
>> conveniently replaces all custom solutions you described. You can set up the
>> param tree with a few clicks, there is a (by default in-memory) database to
>> store the results, you can split or aggregate them on the GUI (it is also
>> scriptable), you can have a look instantly on the data through several
>> charts, etc.
>>
>> Take a look:
>> http://mass.aitia.ai/screenshots/73-meme-screenshots?showall=1
>>
>> Anyway, thanks for the note.
>>
>>
>> Best,
>> Richard
>>
>> --
>> Richard O. Legendi
>> Software developer
>> Intelligent Applications and Web Services
>> AITIA International, Inc.
>> http://people.inf.elte.hu/legendi/
>>
>> On 2012.09.26. 18:46, Chris Hollander wrote:
>>>
>>> If I understand what you're asking right, the simulation loop that
>>> normally gets used is simple enough to rewrite yourself. For the work
>>> that I do I actually have Scala scripts that automate the simulation
>>> runs so that I can do multiple experiments and replications and
>>> collect additional data. They make use of an "Experiment" class I
>>> wrote.
>>>
>>> Here the code for my experiment class and run loop. It's based on my
>>> needs though, but there's no reason you couldn't add in debugging
>>> information to pull information from the actual simulation.
>>>
>>>
>>>
>>>
>>> public void run(MersenneTwisterFast seedGenerator, int[][]
>>> experiments, int replications, long maxRuntime) {
>>>
>>>          String experimentID;
>>>
>>>          for (int e = 0; e < experiments.length; e++) {
>>>
>>>              // We store the id as a binary number so its easier to
>>> match up configurations with
>>>              // MINITAB experiment ordering. All we have to do is
>>> translate the binary number to
>>>              // a decimal number and match. This is much less error
>>> prone than using raw binary.
>>>              experimentID =
>>> Functions.padBinary(this.getExperimentID(experiments[e]), 6);
>>>
>>>
>>>              // For each replication
>>>              long seed;
>>>              long step;
>>>              long startTime;
>>>              long stopTime;
>>>
>>>              long maxTime;
>>>
>>>              for (int i = 0; i < replications; i++) {
>>>                  System.out.print("Processing replication " + (i + 1) +
>>> " on experiment configuration ");
>>>                  System.out.println(experimentID);
>>>
>>>                  seed = seedGenerator.nextLong();
>>>                  Simulation simObject = new Simulation(seed);
>>>                  simObject.nameThread();
>>>                  simObject.random = seedGenerator;
>>>
>>>                  //simObject.setSeed(seed);
>>>                  //simObject.setUserSeed(true);
>>>
>>>                  // Configure specific experimental settings
>>>                  ics.configureSimulation(simObject, experiments, e);
>>>                  simObject.outputFileId = experimentID + "_" + i +
>>> "_data";
>>>
>>>                  // Adjust max run time to account for the stability
>>> tolerance
>>>                  maxTime = maxRuntime;
>>>
>>>                  // Run the experiment
>>>                  startTime = System.nanoTime();
>>>
>>>                  simObject.setJob(i);
>>>                  simObject.start();
>>>
>>>                  while ((step = (long) simObject.schedule.getSteps())
>>> <= maxTime) {
>>>                      if (!simObject.schedule.step(simObject)) {
>>>                          break;
>>>                      }
>>>                      if (step % 1000 == 0) {
>>>                          System.out.println("Time Step (in Experiment):
>>> " + step);
>>>                      }
>>>                  }
>>>
>>>                  simObject.finish();
>>>                  stopTime = System.nanoTime();
>>>
>>>                  // Calculate the total runtime of the experiment in
>>> seconds
>>>                  double runtime = (double) (stopTime - startTime) /
>>> 1000000000.0;
>>>
>>>                  System.out.println("Replication " + (i + 1) + " of
>>> Experiment " + experimentID + " ended after " + runtime + " seconds");
>>>              } // end replication loop
>>>          } // end experiment loop
>>>
>>>      }
>>>
>>>
>>>
>>> On Wed, Sep 26, 2012 at 8:54 AM, Richard O. Legendi <[log in to unmask]>
>>> wrote:
>>>>
>>>> Just a minor question: is it possible to turn off Mason's output(*)? It
>>>> makes it a bit hard to find an issue in tests where a modell is running
>>>> in
>>>> the background.
>>>>
>>>> Thanks in advance!
>>>>
>>>> (*) =
>>>> MASON Version 16.  For further options, try adding ' -help' at end.
>>>>      Job: 0 Seed: 15
>>>>      Starting ...
>>>>
>>>> Best,
>>>> Richard
>>>>
>>>> --
>>>> Richard O. Legendi
>>>> Software developer
>>>> Intelligent Applications and Web Services
>>>> AITIA International, Inc.
>>>> http://people.inf.elte.hu/legendi/
>
>
>
>
> --
> Ph.D. Student in Computer Science
> Volgenau School of Engineering
> George Mason University

ATOM RSS1 RSS2