public float T; // Temperature

        public SimulatedAnnealing(AtomGrid g)
        {
            this.G = g;
            this.R = new Random();
            this.T = 10;
            // Too large temperature just takes longer to converge due to too much
            // randomization allowed in the metropolis part of the annealing algorithm.
        }
예제 #2
0
        protected override void Initialize()
        {
            OnePx = new Texture2D(_graphics.GraphicsDevice, 1, 1);
            OnePx.SetData <Color>(new Color[1] {
                Color.White
            });

            // NOTE: Too large a grid takes a long time per frame.
            G  = new AtomGrid(14, 4);
            SA = new SimulatedAnnealing(G);
            //SA.Anneal();

            _graphics.PreferredBackBufferWidth  = G.GetSize() * CellWidth;
            _graphics.PreferredBackBufferHeight = G.GetSize() * CellHeight;
            _graphics.ApplyChanges();
            base.Initialize();
        }