I am trying to implement a tabu list for a metaheuristic I am developing that will ban the movment of Patient objects to Room objects. I though the easiest way to do this would be to implement a Dictionary where I would add Patient Room pairs to be tabued. The problem I countered with this is that, if I want the tabu list to be say 30 keys long and I want to be able to remove the last key-value pair every time a new one needs to be added I have to way of indexing the "oldest" entry in a Dictionary.
Does anyone have any suggestions for how I could do this in a smarter way?
Thank you!
I managed to solve this on my own by implementing a
List<Dictionary<Patient,Room>>
and creating a new dictionary element for each element that needed to go in the tabu list. I used the list.Add()
method and then checked the size of the list. If it exceeded a predefined maxsize I simply called list.RemoveAt(0)
.