So I can certainly add a gizmo which prevents SimState from printing out the startup message and jobs messages. But it's a bit more challenging to turn off printing for all of MASON, since it includes a lot of utility classes which print out occasional warnings.
However I *can* (and just did) modify the MASON core code so that System.out is never used, only System.err. This would allow you to redirect all messages to System.err to go straight to /dev/null, like this (using bash):
java sim.app.heatbugs.HeatBugs 2> /dev/null
Anything you print with System.out.println() will still show up on-screen. But System.err.println() will go to /dev/null silently.
Alternatively of course you can just not use doLoop(), which is a convenience function. The manual, and initial tutorials, show how to do your own loop.
On Sep 26, 2012, at 1:01 PM, Richard O. Legendi 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/
|