JuliaDynamics / ABMFrameworksComparison

Benchmarks and comparisons of leading ABM frameworks
Other
13 stars 8 forks source link

Wolf Sheep Grass in Mason? #31

Closed Datseris closed 1 year ago

Datseris commented 1 year ago

Seems like there is some code for WSG in MASON: https://github.com/isislab-unisa/ABM_Comparison/tree/main/MASON/wsg why haven't we included this here @Tortar ?

Tortar commented 1 year ago

For the same reason we don't include ForestFire: https://github.com/isislab-unisa/ABM_Comparison/blob/main/MASON/forestfire/ForestFire.java

This is part of the step:

            int minmax = (step + 1 < gridHeight - 1) ? (int) step + 1 : gridHeight - 1;
            for (int j = minmax; j >= 0; j--) {
                for (int i = 0; i < gridHeight; i++) {
                    // System.out.println("i: " + i + " j: " + j);
                    int v = myfield.get(i,j);
                    if (v == GREEN) {
                        for (int k = i-1; k <= i+1; k++) {
                            for (int l = j-1; l <= j+1; l++) {
                                if (k >= 0 && k < gridWidth && l >= 0 && l < gridHeight
                                    && (k != i || l != j)) {
                                    if (myfield.get(k,l) == BURNING) {
                                        myfield.set(i,j, BURNING);
                                        break;
                                    }

As you see they don't scan all the grid at each step because of int minmax = (step + 1 < gridHeight - 1) ? (int) step + 1 : gridHeight - 1;, so it's not fair to include it here.

I have more problems reading the code about wsg and so I can't judge if it can be included, let me know if you think it can

Datseris commented 1 year ago

for forest fire i don't understand what you mean.

also, can't we alter the code so that all of the grid is scanned...?

Tortar commented 1 year ago

Yes, sure we can. But for wolf-sheep-grass I find it more difficult to say what are the differences, but in the end I think we can deal with that before merging, will do a PR for each model then :-)