[gecode-users] Expr() in GECODE
Zhu Zichen's cse
zzhu at cse.cuhk.edu.hk
Tue Sep 3 04:38:27 CEST 2013
Hi,
I have a question.
For GECODE,
When I use expressions:
BoolVar sofar = expr( home,( !_A[i] || x[index] != val ));// where
_A[i] is a BoolVar, and x is IntVarArray, index and val are integer.
If I rewrite it as:
if(_A[i].one())
sofar = expr( home, x[index] != val);
else
sofar = expr( home,( !_A[i] || x[index] != val));
There will be a great improvement on runtime, say 40%.
If I rewrite it as:
if(_A[i].one())
x[index].nq(val);
else
sofar = expr( home,( !_A[i] || x[index] != val));
There will be another improvement on the latest one for runtime, say 30%.
For ILOG,
IlcConstraint sofar = (! _A[i]) || x[index] != val ) ;
Rewrite as:
if(_A[i].isTrue()==IlcTrue)
sofar = x[index] != val;
else
sofar = (! _A[i]) || x[index] != val ) ;
Running times of the above two methods are the same.
Is this because the "inefficient" of expr() to handle Boolean expressions
and relations in GECODE?
Thanks!
Zichen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130903/def5808f/attachment.html>
More information about the users
mailing list