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
_______________________________________________
Gecode users mailing list
[email protected]
https://www.gecode.org/mailman/listinfo/gecode-users