Hi Kish, I agree that this is a matter of taste but I actually prefer that I have the option to catch possible modeling errors. And one idea is that min and argmin should behave the same.
In the scenario you describe you could then use a wrapper (or just have sanity check when you generate the model). Cheers Christian -- Christian Schulte, www.gecode.org/~schulte Professor of Computer Science, KTH, [email protected] Expert Researcher, SICS, [email protected] -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Kish Shen Sent: Friday, June 26, 2015 8:25 PM To: [email protected] Subject: [gecode-users] empty array with argmin (and min) Hi, argmin throws an exception when the array is empty, which surprised me. I expected the constraint to fail, because for an empty array, the index for the minimum does not exist, i.e. the index has an empty domain, which should mean failure. It seems that min also throws an exception for an empty array. and although it looks less clear-cut in this case, it still seem more logical to me that min should also fail rather than throw an exception. I guess you might not want to do this with min as it will mean that IntExpr might fail, but argmin cannot occur in IntExpr. To me, it seems reasonable that the user may want to call these constraints with an empty array -- the array may be generated from data, and finding no variables seems a reasonable possibility. Cheers, Kish _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
