// Update map
private void UpdateMap( DistanceNetwork network )
{
// get first layer
Layer layer = network[0];
// lock
Monitor.Enter( this );
// run through all neurons
for ( int i = 0, n = layer.NeuronsCount; i < n; i++ )
{
Neuron neuron = layer[i];
int x = i % networkSize;
int y = i / networkSize;
map[y, x, 0] = (int) neuron[0];
map[y, x, 1] = (int) neuron[1];
map[y, x, 2] = 0;
}
// collect active neurons
for ( int i = 0; i < pointsCount; i++ )
{
network.Compute( trainingSet[i] );
int w = network.GetWinner( );
map[w / networkSize, w % networkSize, 2] = 1;
}
// unlock
Monitor.Exit( this );
//
mapPanel.Invalidate( );
}