Home > atmlab > gridcreation > annealing > neighbour.m

neighbour

PURPOSE ^

NEIGHBOUR Find neighbour for simulated annealing algorithm.

SYNOPSIS ^

function snew = neighbour(sold)

DESCRIPTION ^

 NEIGHBOUR  Find neighbour for simulated annealing algorithm.

 We will change one active frequency to a random passive
 frequency.

 (I tried more sophisticated neighbour schemes, but they worked
 less good, because they constrained the search too much.)

 The frequency selections are represented by arrays of type
 logical, where active frequencies are flagged true, inactive
 frequencies are flagged false.

 FORMAT snew = neighbour(sold)

 OUT snew   New frequency selection.
 IN  sold   Old frequency selection.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

neighbour.m

SOURCE CODE ^

0001 % NEIGHBOUR  Find neighbour for simulated annealing algorithm.
0002 %
0003 % We will change one active frequency to a random passive
0004 % frequency.
0005 %
0006 % (I tried more sophisticated neighbour schemes, but they worked
0007 % less good, because they constrained the search too much.)
0008 %
0009 % The frequency selections are represented by arrays of type
0010 % logical, where active frequencies are flagged true, inactive
0011 % frequencies are flagged false.
0012 %
0013 % FORMAT snew = neighbour(sold)
0014 %
0015 % OUT snew   New frequency selection.
0016 % IN  sold   Old frequency selection.
0017 
0018 % 2008-09-24 Created by Stefan Buehler.
0019 
0020 function snew = neighbour(sold)
0021 
0022 % Pick random active frequency
0023 r_active = pick_random_freq(sold);
0024 
0025 % Pick random inactive frequency
0026 r_inactive = pick_random_freq(~sold);
0027 
0028 % Activate inactive frequency and inactivate active frequency
0029 snew = sold;
0030 snew(r_active) = 0;
0031 snew(r_inactive) = 1;

Generated on Mon 14-Apr-2014 08:37:29 by m2html © 2005