You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the function declarations you state, $$E would be a type-inst variable that (because of the double dollar signs) can be instated with enumerated types or just integers. In this case this ensures that if a enumerated type is used to form the index set of the argument for arg_max, then the returned value is also of that enumerated type (and not just an int).
Creating a version of arg_max that works for higher dimensions is certainly possible. A decomposition can be created using the 1d version of arg_max and an element constraint:
function var tuple($$E, $$F): arg_max(array[$$E, $$F] of var int: x) = let {
any: idxs = [(i, j) | i in index_set_1of2(x), j in index_set_2of2(x)];
any: sel = arg_max(array1d(x));
} in idxs[sel];
Note that it seems that the any type doesn't work for idxs in the current release. You instead can use the array[int] of tuple(int, int) for idxs, although it is technically not fully correct.
First of all, I apologize if this should be an issue for the
libminizinc
project or if it shouldn’t be an issue at all.What does
$$E
mean in the following code?Is it possible to use
arg_max
for 2D arrays or arrays with higher dimensions? Could you provide a working example of how to use it?Thank you in advance.
The text was updated successfully, but these errors were encountered: