Messages from list : cormas@cirad.fr

Choose a topic among the following archives :

Re: initialization of girds

New Message Reply Date view Thread view Subject view Author view

Subject: Re: initialization of girds
le_page@cirad.fr
Date: Sat Dec 06 2003 - 14:04:18 CET

Bonjour Joelle !

I'm not sure what you have in mind is realistic... Even with a small grid (10 is
the total number of your grid cells, right ? 5 lines * 2 columns ? something
like that ?), and just 3 different values for the state attribute, you already
have 3^10 (and not 10^3) different configurations !!! More than 60000!!!

Anyway, if I had to do it, and assuming the 3 possible state values are kind of
integer (for instance 0; 1; 2), I would proceed like this:

1. define 10 attributes (state1, state2, ... state10) at the level of your model
class, with 0 as the default value when you create the accessors.

2. write a "initCells" method that will look like this:
   i := 0.
   self theCells do: [:c |
     i := i+1.
     c state: (self perform: 'state', i printString) asSymbol].

3. When you initialize the simulation, go to set some values for the parameters,
and set a range of variation for all the 10 attributes statei from 0 to 2 with a
step = 1.

Then, click on "OK", and go for 3-weeks holidays ;->>

Bon courage !!!
clp

En réponse à Joelle Noailly <noailly@tinbergen.nl>:

> Hi,
>
> I am trying to program a systematic initialization method, such that
> all
> possible initial grids (given the total number of cells and the number
> of
> possible states) are generated one after the other. For instance, on a
> grid of 10 cells in which each cell can have initially 3 possible
> states,
> there are 10^3 different possible initial grids. The initialization
> method
> should then look like:
> -initialize 10 cells with state 1
> -initialize 9 cells with state 1 and 1 cell with state 2 (here all the
> 10
> different spatial grids corresponding to this combination are
> generated)
> - 9 cells with state 1, 1 cell with state 3
> etc.
> I was wondering if such a method already exists in Cormas. Otherwise
> could
> you possibly give me some tips on how I could implement it?
>
> Many thanks for your help,
> Cheers,
> Joelle Noailly
>
>
>
>
>

New Message Reply Date view Thread view Subject view Author view
 

Back to home