Originally posted by: SystemAdmin
[dgravot@noos.fr said:]
Well, then the result should be the value of the cell itself when
. either this value is the highest value (that was implemented in the model shown in one of my previous post)
. or this value is duplicated (*)
otherwise, we take the next higher value (also already implemented in the previous model)
To modify the model to address (*) , we can just define :
int occur[r in rows][c in cols] = count(all(r2 in rows) data[r2][c], data[r][c]);
and modify result as :
int result[r in rows][c in cols] = (card(s[r][c])==1 || occur[r][c]>1)?data[r][c]:item(s[r][c],1);
Indeed, by definition of "occur" , it counts the number of occurrences of the value of the cell data[r][c] in the column c of the matrix data.
#DecisionOptimization#OPLusingCPLEXOptimizer