[gecode-users] Bug when I sort variables
Mohamed Rezgui
kyo.alone at gmail.com
Tue Mar 5 09:13:27 CET 2013
Hi,
I found a bug when I sort variables iv of FlatZincSpace.
<code>
template<class Var, bool Less=true>
class VarCompare {
public:
bool operator ()(const Var& lhs, const Var& rhs) {
return Less ? lhs.size() < rhs.size() : lhs.size() > rhs.size();
}
};
IntVarArgs iva(iv.size());
for(int i = 0; i < iv.size(); i++) {
iva[i] = iv[i];
}
std::stable_sort(iva.begin(), iva.end(), VarCompare<Gecode::IntVar>());
//Update index optVar
....
iv = IntVarArray(*this, iva);
</code>
I get this assertion when I resolve the problem in parallel :
Assertion failed: (i>=0) && (i<n), file
C:\Users\REZGUI\gecode\gecode/kernel/shared-array.hpp, line 202
--
Best Regards,
Mohamed REZGUI
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20130305/7086bab9/attachment.html>
More information about the users
mailing list