[gecode-users] kernel issues
Filip Konvička
filip.konvicka at logis.cz
Mon Apr 14 14:28:03 CEST 2008
Hi,
so Lubos started working on the FloatVar implementation and he's
discovered something that looks like a bug in Gecode. Initially, we just
copied "integer.vis" to "float.vis" and renamed the identifiers so we
got "_FLOAT_" instead of "_INT_" everywhere. (Later on, we'll probably
at least remove the "DOM" modification event and propagation condition.)
So in short:
[General]
Name: Float
Ifdef: GECODE_HAS_FLOAT_VARS
Namespace: Gecode::Float
and the rest goes exactly the same as with IntVar.
Then we tried posting a propagator on a FloatVar, but unexpectedly
nothing happened. Lubos tracked this down to the following code fragment
in kernel/var-type.icc:
case ME_FLOAT_BND:
{
static const Gecode::ModEvent me_c = (
((ME_FLOAT_NONE ^ ME_FLOAT_BND ) << 0) |
((ME_FLOAT_VAL ^ ME_FLOAT_VAL ) << 4) |
((ME_FLOAT_BND ^ ME_FLOAT_BND ) << 8) |
((ME_FLOAT_DOM ^ ME_FLOAT_BND ) << 12)
);
Gecode::ModEvent me_o = (med & med_mask) >> med_fst;
Gecode::ModEvent me_n = (me_c >> (me_o << 2)) & med_mask;
if (me_n == 0)
return false;
med ^= me_n << med_fst;
break;
}
This is similar to what is generated for IntVars (ME_INT_BND), but it
seems that the condition (me_n == 0) always evaluates to true for
FloatVars, and so nothing ever happens.
Lubos fixed this by changing the appropriate line to
Gecode::ModEvent me_n = (me_c >> (me_o << 2)) & (med_mask >> med_fst);
This seems logical to me. Do you know what script to fix in order to get
it generated this way?
Thanks,
Filip
More information about the gecode-users
mailing list