Question about batch experiment

51 views
Skip to first unread message

Thibaut Démare

unread,
Oct 29, 2015, 1:36:03 PM10/29/15
to GAMA
Hello,

I am wondering about how do to do something with a batch experiment.
In a GUI experiment, I can define an output which will save, step by step, the evolution of a variable into a file (let's say a CSV file).
It is done like this:
experiment exp_save_results type: gui {
    output {
        file name: "my_file_name" type: text data: "" +my_variable;
    }
}

But in a batch experiment, it seems that I can not save the evolution of my variable. I just can save its last value at the end of the simulations.
Am I wrong? If yes, how can I save in different files the evolution of this variable for each different simulation?

Best regards,

Thibaut

Patrick Taillandier

unread,
Oct 29, 2015, 1:46:36 PM10/29/15
to gama-p...@googlegroups.com
Hi,

If you want to save something during the simulation, the only way is to use the save statement inside your model : https://code.google.com/p/gama-platform/wiki/G__Statements#save

For example, you can used it in an global reflex and save every n steps the values of some variables.

To have example of use of the save statement, you can have a look at the models inside the Model Library/Features/Save statement folder.

Cheers,

Patrick

--
You received this message because you are subscribed to the Google Groups "GAMA" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gama-platfor...@googlegroups.com.
To post to this group, send email to gama-p...@googlegroups.com.
Visit this group at http://groups.google.com/group/gama-platform.
For more options, visit https://groups.google.com/d/optout.

Thibaut Démare

unread,
Oct 29, 2015, 2:19:58 PM10/29/15
to GAMA
Yes, I knew about this statement, but I wanted to keep away the "saving" part from the reflex of the model. I have some different experiments and I do not always want to save these data.
But OK, I will deal with it.

Thank you for your quick answer :)

Thibaut

Patrick Taillandier

unread,
Oct 29, 2015, 2:26:47 PM10/29/15
to gama-p...@googlegroups.com
Unfortunately, the use of the save statement is the only way. However, you can define in the reflex condition a condition that will depends on the experiment:

global {
     string xp <- "base";
     ...
      reflex save_xp1 when: xp = "xp1" { ...} 
      reflex save_xp2 when: xp = "xp2" {...} 
}

experiment xp1 type: batch ... {
      parameter "xp" var: xp among:["xp1"];
}

experiment xp2 type: batch ... {
      parameter "xp" var: xp among:["xp2"];
}

Thibaut Démare

unread,
Nov 3, 2015, 8:39:49 AM11/3/15
to GAMA
Sorry I am late to answer.
Indeed, I did something like this with a boolean. It works fine :)

Thank you!
Reply all
Reply to author
Forward
0 new messages