Describe the bug
I noticed that one of my gecode models (using float variables) had a different result when running it twice in succession.
the first time the model finds a result, the second time it doesn't.
a lot of searching showed that after the first gecode search, the rounding control for floating point numbers was changed. (the _controlfp() or _control87() function can change this flag).
I noticed in the gecode sourcecode (some parts are really boost) that in most cases where
the rounding control is changed, it is reset to the original value again. (using the gecode_boost::numeric::interval_lib::save_state wrapper class).
in at least one case, this wrapper isn't used (float.hh):
typedef gecode_boost::numeric::interval_lib::rounded_arith_stdRoundingBase;
when I replaced the above line with this one:
typedef gecode_boost::numeric::interval_lib::save_state< gecode_boost::numeric::interval_lib::rounded_arith_std > RoundingBase;
my problem went away.
I don't know if this change fixes all cases, but it fixed my problem.
To Reproduce
I can't provide a gecode model that shows the problem. the model I have the problem with is very complex and I didn't succeed in making it simple enough to include here.
check the floating point control word before and after running a search on a model containing floating point variables. the result will be different.
unsigned int controlfp = _controlfp (0, 0);
Gecode and Platform Configuration
gecode 6.1.1 (and 5.1.0)
windows server 2016
visual studio 2017
Describe the bug
I noticed that one of my gecode models (using float variables) had a different result when running it twice in succession.
the first time the model finds a result, the second time it doesn't.
a lot of searching showed that after the first gecode search, the rounding control for floating point numbers was changed. (the _controlfp() or _control87() function can change this flag).
I noticed in the gecode sourcecode (some parts are really boost) that in most cases where
the rounding control is changed, it is reset to the original value again. (using the gecode_boost::numeric::interval_lib::save_state wrapper class).
in at least one case, this wrapper isn't used (float.hh):
typedef gecode_boost::numeric::interval_lib::rounded_arith_stdRoundingBase;
when I replaced the above line with this one:
typedef gecode_boost::numeric::interval_lib::save_state< gecode_boost::numeric::interval_lib::rounded_arith_std > RoundingBase;
my problem went away.
I don't know if this change fixes all cases, but it fixed my problem.
To Reproduce
I can't provide a gecode model that shows the problem. the model I have the problem with is very complex and I didn't succeed in making it simple enough to include here.
check the floating point control word before and after running a search on a model containing floating point variables. the result will be different.
unsigned int controlfp = _controlfp (0, 0);
Gecode and Platform Configuration
gecode 6.1.1 (and 5.1.0)
windows server 2016
visual studio 2017