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:
Wed, 13 Aug 2014 15:15:55 +0200
Content-Type:
text/plain
Parts/Attachments:
text/plain (102 lines)
No, what I would do is just run from the command line like this

	java yourModel -for 5000 -repeat 100

If you want these to be different in a specific way based on the job number, then inside your start() method (get rid of all the jobs gunk you have there now) you'd access the "job" variable, which will be an integer from 0 to 99 in your case.

Simone, from the code below I am afraid that you may be in over your head with the java involved.  I strongly suggest you talk to someone on your side about the code in question.

Sean


On Aug 12, 2014, at 6:31 PM, Simone Gabbriellini <[log in to unmask]> wrote:

> Sean,
> 
> I am a newbie, I spent a bit of time on your solution but I have to apologize because I am definitely not  able to pick up your solution... I would like to run MC = 100 experiments, and each experiment should last for T = 5000 time units. In each of these time units, something has to happen, a pretty standard setting. 
> 
> I have MC and T in the UI, so I can change these values. What should I do at this point in my start?
> 
> public void start() {
>         super.start();
>         
>         int[] foos = new int[MC];
>         for(int i=0;i<MC;i++){
>            foos[i]=i;
>         }
>         int job = job();
>         foo = foos[job];
>         for(int job =0;job<foos.length;j++){
>           if(schedule.getSteps()<T){
>           schedule.scheduleRepeating(
>                 new Steppable() {
>                     @Override
>                     public void step(SimState state) {
>                         FirstBunch.ofCode((SimulationEnvironment) state);
>                     }
>                 }, 0, 1);
> 
>           schedule.scheduleRepeating(
>                 new Steppable() {
>                     @Override
>                     public void step(SimState state) {
>                         ASecondBunch.ofCode((SimulationEnvironment) state);
>                         
>                     }
>                 }, 1, 1);
>         }
>        }
> }
> 
> Is this what you mean? 
> 
> Best,
> Simone
> 
> 
> 2014-08-04 18:43 GMT+02:00 Sean Luke <[log in to unmask]>:
> 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
> 
> 
> 
> -- 
> -----------------------------------------------------------------
> 
> Simone Gabbriellini, PhD
> 
> Post-doctoral Researcher
> ANR founded research project "DIFFCERAM"
> GEMASS, CNRS & Paris-Sorbonne.
> 
> mobile: +39 340 39 75 626
> email: [log in to unmask]

ATOM RSS1 RSS2