Cut data when equilibrium begins
1 view (last 30 days)
Show older comments
I am simulating the traveling samlsman problem(TSP) whit Metropolis (500000 sweeps) and i want to cut my data when it at the "equilibrium"
3 Comments
Geoff Hayes
on 4 Jun 2014
If tourLength is the vector of all tour lengths, then you could just find within it all indices for elements that are within a certain window around 100:
wdwLen = 10;
idcs = find(tourLength>(100-wdwLen) & tourLength<(100+wdwLen));
data = tourLength(idcs);
data are all the tour lengths that fluctuate around 100 (within 10 units). The catch here is that idcs would not have any index that refers to an element whose tour length is just outside of the window. So data will not be complete in the sense that it may be missing some tour lengths… A check for missing data could be
if (idcs(end)-idcs(1)+1) ~= length(idcs)
% then at least one element within the start and end of idcd
% falls outside of our window around 100
end
Answers (0)
See Also
Categories
Find more on Particle & Nuclear Physics in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!