I study simulated annealing algorithms and ask a few questions about how to change the example algorithm to solve the 0-1 backpack problem.
I found this great CP code:
http://www.codeproject.com/KB/recipes/simulatedAnnealingTSP.aspx
I am sure that I understand how all this works now (with the exception of Boltzmann's whole fortune, as far as I know, this is black magic, although I understand that I avoid local optima and, apparently, this does just that). I would like to redesign this to solve the problem with knife 0-1 - "ish". Basically I put one of 5000 objects in 10 bags and need optimization for the least unused space. The actual “score” that I assign for the solution is a bit more complicated, but not related to the algorithm.
It seems simple enough. This means that the Anneal () function will be basically the same. I would need to implement the GetNextArrangement () function to fit my needs. In the TSM problem, it simply replaces two random nodes along the way (i.e., it makes a very small change at each iteration).
For my problem, in the first iteration, I would select 10 random objects and look at the remaining space. For the next iteration, would I choose 10 new random objects? Or is it best for me to sort through a few objects, like half of them, or just one of them? Or maybe the number of objects that I change should be relative to the temperature? Any of them seem to suit me, I'm just wondering if anyone has any advice on the best approach (although I can manage with improvements when the code works for me).
Thank!
Mike
source
share