[gecode-users] kernel issues
Christian Schulte
cschulte at kth.se
Mon Apr 21 11:50:33 CEST 2008
Hi Filip,
sorry for the long delay, but I was away from my keyboard. Yes, you are
right! I just added your fix to the trunk. For the integer variables it did
not show, as med_fst == 0 for them.
The script that generates the variable stubs is misc/genvariables.perl (line
608).
Thanks for the fix!
Cheers
Christian
--
Christian Schulte, www.ict.kth.se/~cschulte/
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Filip Konvicka
Sent: Monday, April 14, 2008 2:28 PM
To: users at gecode.org
Cc: lmoric at logis.cz
Subject: [gecode-users] kernel issues
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
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the gecode-users
mailing list