Good morning, I'm implementing a Grasp Heuristic, and I need to randomly select an element from a 2-dimensional set, there is any command in AMPL to make this selection?
Code:
set RCL dimen 2 default {}; #set of items that have hik within the defined range
#function to determine the RCL set
for {i in I, k in K}{
if (h[i,k]>=h_inf and h[i,k]<=h_sup) then {
let RCL:= RCL union {(i,k)};
}
}
Example:
set RCL: (1,1), (2,1), (3,1), (3,3), (4,1)
I need to randomly select one of these elements.
Thanks.