MASON-INTEREST-L Archives

August 2014

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:
Sean Luke <[log in to unmask]>
Reply To:
MASON Multiagent Simulation Toolkit <[log in to unmask]>
Date:
Mon, 4 Aug 2014 18:43:59 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (31 lines)
On Aug 4, 2014, at 6:07 PM, Simone Gabbriellini <[log in to unmask]> wrote:

> thanks for your help... I saw the main on page 86, and did something similar in my main, but Sean suggested to use doLoop() instead... thus my question about how to pass the two parameters if I use doLoop() and not the explicit for()...
> 
> so far, I didn't see in manual at 4.2 any reference on this, but it might be me of course...

You can't pass parameters from the command line into doLoop() -- you either state them outright in your start() or load them from a parameter file (we have a very good parameter file system in ECJ which is fully compatible with MASON, see ec.util.ParameterDatabase).

Anyway, here's how I'd do it.  One option in doLoop is to run for some N jobs.  Each time, MASON will set a job number for your experiment, starting at 0.  You can get this number for your model with job().

You could use this in start(), for example, to specify parameters.  Let's say you want to run 10 times, and your first parameter is a String called foo, which could be various things, and your second parameter is a double called bar, which should be equal to 10^j where j is the job number (assuming the first job is 0, that is, 1, 10, 100, 1000, etc.).  You could write this in your start() method:

	public double bar;
	public String foo;
	
	public void start()
		{
		super.start();
		String[] foos = new String[] { "a", "b", "c", "d", "e",
		                               "f", "g", "h", "i", "Bob" };
		int job = job();
		foo = foos[job];
		bar = Math.pow(10, job);
	
		// ... do your other start() stuff here
		}

... I *think* this should work right.

Sean

ATOM RSS1 RSS2