I need to be able to set a constraint dist with 64 different, changeble weights:
I need to random pick an index of range 0~63, when every index has its own weight / probability to be chosen.
I can write something like:
constraint pick_chan_constraint {pick_channel dist{ 0:=channel_weight[0], 1:=channel_weight[1], 2:=channel_weight[2], 3:=channel_weight[3], 4:=channel_weight[4], 5:=channel_weight[5], 6:=channel_weight[6], 7:=channel_weight[7], 8:=channel_weight[8], 9:=channel_weight[9], 10:=channel_weight[10], 11:=channel_weight[11], 12:=channel_weight[12], 13:=channel_weight[13], 14:=channel_weight[14], … ...
NUM_OF_CHANS-1 := channel_weight[NUM_OF_CHANS-1] }}
Obviously it's bad writing and a bad idea, out of 2 reasons:
No flexibility- if NUM_OF_CHANS changes, I'll need to change the code.
It's long and ugly and almost unreadable.
Any ideas?
Thanks