Closed benoitgaudou closed 3 years ago
Actually, this is a problem that goes beyond the headless part of GAMA and concerns the use of among
with floating point values (I guess we could reproduce the same problem in the GUI). The conversion problem you describe is normal, AFAIK, maybe a bit exacerbated by the use of Float
instead of Double
in headless (why ? I don't know). However, the fact that it is not found in the list of possible values (among
) is a real issue, which should lead us to find a new way to check whether or not a value is "inside" a list
of float
values.
Have you been able to test the changes introduced in https://github.com/gama-platform/gama/commit/507895f615e71bfd0ce64431fc7117466fc0a8ed ?
The fix should be tested. It seems to work on my side.
Tested and fixed with the gaml exemple :)
bash ./headless/gama-headless.sh ./test.xml ./output
******************************************************************
* GAMA version 1.8.2 *
* http://gama-platform.org *
* (c) 2007-2021 UMI 209 UMMISCO IRD/SU & Partners *
******************************************************************
> GAMA: version 1.8.2 loading on____ linux 5.12.19-1-MANJARO, x86_64, JDK 15.0.2
> JAI : ImageIO extensions loaded for____ jpg||tiff|bmp|gif|arx|tf8|TF8|png|ppm|jp2|tif|TIF|asc|TIFF|btf|BTF|pgm|wbmp|jpeg|pbm
> GAMA: msi.gama.core loaded in_____ 1226ms
> GAMA: ummisco.gaml.extensions.maths loaded in_____ 15ms
> GAMA: irit.gaml.extensions.database loaded in_____ 13ms
> GAMA: ummisco.gaml.extensions.stats loaded in_____ 19ms
> GAMA: ummisco.gama.java2d loaded in_____ 1ms
> GAMA: msi.gama.headless loaded in_____ 3ms
> GAMA: msi.gaml.extensions.fipa loaded in_____ 14ms
> GAMA: espacedev.gaml.extensions.genstar loaded in_____ 3ms
> GAMA: miat.gaml.extension.pedestrian loaded in_____ 23ms
> GAMA: ummisco.gama.network loaded in_____ 6ms
> GAMA: ummisco.gama.serialize loaded in_____ 5ms
> GAMA: ummisco.gama.opengl loaded in_____ 8ms
> GAMA: native Bullet library loaded in_____ 13ms
> GAMA: simtools.gaml.extensions.physics loaded in_____ 28ms
> GAMA: simtools.gaml.extensions.traffic loaded in_____ 40ms
> GAMA: msi.gaml.architecture.simplebdi loaded in_____ 76ms
> GAMA: msi.gama.lang.gaml loaded in_____ 15ms
> GAMA: all plugins loaded in_____ 1537ms
GAMA configuring and loading...
> GAMA: GAML artefacts built in______ 214ms
Number of cpus used:1 (available: 8)
$ cat ./output/console-outputs-0.txt
/tmp/test.gaml model is being compiled...
-----------------------------
float_among -: 0.1
float_no_constraint -: 0.1
float_min_max -: 0.6
=============================
..............................Simulation duration 6ms
$ cat ./output/console-outputs-1.txt
/tmp/test.gaml model is being compiled...
-----------------------------
float_among -: 0.3
float_no_constraint -: 0.3
float_min_max -: 0.75
=============================
..............................Simulation duration 5ms
Describe the bug Please consider the following model:
The experiment
shortExplo_GridV1
will run in headless using the following XML file:To Reproduce Steps to reproduce the behavior:
headless
folder of GAMAsh ./gama-headless.sh -m 6000m TestHeadless.xml toto
We get the following results:
This shows that there is some conversions in the number taken in the XML to GAMA as for
float_no_constraint
the values given in the XML file are:0.1
and0.3
, and the variable receives the values:0.10000000149011612
and0.30000001192092896
.The main issue here is when the parameter is defined with the
among
facet ( as it is the case forfloat_among
): the values given in the XML are in the range of possible values. But with the approximation error, it becomes out of the possible values, and thus the parameter receives the first value of the possible values.Expected behavior No precision error is expected.
Desktop (please complete the following information):