[gecode-users] empty array with argmin (and min)

Christian Schulte cschulte at kth.se
Mon Jun 29 15:51:36 CEST 2015


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, cschulte at kth.se
Expert Researcher, SICS, cschulte at sics.se

-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Kish Shen
Sent: Friday, June 26, 2015 8:25 PM
To: users at gecode.org
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
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list