c10-9 (Numerical Recipes in C), страница 4

PDF-файл c10-9 (Numerical Recipes in C), страница 4 Цифровая обработка сигналов (ЦОС) (15322): Книга - 8 семестрc10-9 (Numerical Recipes in C) - PDF, страница 4 (15322) - СтудИзба2017-12-27СтудИзба

Описание файла

Файл "c10-9" внутри архива находится в папке "Numerical Recipes in C". PDF-файл из архива "Numerical Recipes in C", который расположен в категории "". Всё это находится в предмете "цифровая обработка сигналов (цос)" из 8 семестр, которые можно найти в файловом архиве МГТУ им. Н.Э.Баумана. Не смотря на прямую связь этого архива с МГТУ им. Н.Э.Баумана, его также можно найти и в других разделах. Архив можно найти в разделе "книги и методические указания", в предмете "цифровая обработка сигналов" в общих файлах.

Просмотр PDF-файла онлайн

Текст 4 страницы из PDF

(You must be sure thatthe best-ever point is not currently in the simplex when you do this!) We have foundproblems for which restarts — every time the temperature has decreased by a factorof 3, say — are highly beneficial; we have found other problems for which restartshave no positive, or a somewhat negative, effect.You should compare the following routine, amebsa, with its counterpart amoebain §10.4. Note that the argument iter is used in a somewhat different manner.10.9 Simulated Annealing Methods453psum=vector(1,ndim);tt = -temptr;GET_PSUMfor (;;) {ilo=1;Determine which point is the highest (worst),ihi=2;next-highest, and lowest (best).ynhi=ylo=y[1]+tt*log(ran1(&idum));Whenever we “look at” a vertex, it getsyhi=y[2]+tt*log(ran1(&idum));a random thermal fluctuation.if (ylo > yhi) {ihi=1;ilo=2;ynhi=yhi;yhi=ylo;ylo=ynhi;}for (i=3;i<=mpts;i++) {Loop over the points in the simplex.yt=y[i]+tt*log(ran1(&idum));More thermal fluctuations.if (yt <= ylo) {ilo=i;ylo=yt;}if (yt > yhi) {ynhi=yhi;ihi=i;yhi=yt;} else if (yt > ynhi) {ynhi=yt;}}rtol=2.0*fabs(yhi-ylo)/(fabs(yhi)+fabs(ylo));Compute the fractional range from highest to lowest and return if satisfactory.if (rtol < ftol || *iter < 0) {If returning, put best point and value inswap=y[1];slot 1.y[1]=y[ilo];y[ilo]=swap;for (n=1;n<=ndim;n++) {swap=p[1][n];p[1][n]=p[ilo][n];p[ilo][n]=swap;}break;}*iter -= 2;Begin a new iteration.

First extrapolate by a factor −1 through the face of the simplexacross from the high point, i.e., reflect the simplex from the high point.ytry=amotsa(p,y,psum,ndim,pb,yb,funk,ihi,&yhi,-1.0);if (ytry <= ylo) {Gives a result better than the best point, so try an additional extrapolation by afactor of 2.ytry=amotsa(p,y,psum,ndim,pb,yb,funk,ihi,&yhi,2.0);} else if (ytry >= ynhi) {The reflected point is worse than the second-highest, so look for an intermediateSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).crease temptr according to your annealing schedule, reset iter, and call the routine again(leaving other arguments unaltered between calls). If iter is returned with a positive value,then early convergence and return occurred. If you initialize yb to a very large value on the firstcall, then yb and pb[1..ndim] will subsequently return the best function value and point everencountered (even if it is no longer a point in the simplex).{float amotsa(float **p, float y[], float psum[], int ndim, float pb[],float *yb, float (*funk)(float []), int ihi, float *yhi, float fac);float ran1(long *idum);int i,ihi,ilo,j,m,n,mpts=ndim+1;float rtol,sum,swap,yhi,ylo,ynhi,ysave,yt,ytry,*psum;454Chapter 10.Minimization or Maximization of Functions}free_vector(psum,1,ndim);}#include <math.h>#include "nrutil.h"extern long idum;extern float tt;Defined and initialized in main.Defined in amebsa.float amotsa(float **p, float y[], float psum[], int ndim, float pb[],float *yb, float (*funk)(float []), int ihi, float *yhi, float fac)Extrapolates by a factor fac through the face of the simplex across from the high point, triesit, and replaces the high point if the new point is better.{float ran1(long *idum);int j;float fac1,fac2,yflu,ytry,*ptry;ptry=vector(1,ndim);fac1=(1.0-fac)/ndim;fac2=fac1-fac;for (j=1;j<=ndim;j++)ptry[j]=psum[j]*fac1-p[ihi][j]*fac2;ytry=(*funk)(ptry);if (ytry <= *yb) {Save the best-ever.for (j=1;j<=ndim;j++) pb[j]=ptry[j];*yb=ytry;}yflu=ytry-tt*log(ran1(&idum));We added a thermal fluctuation to all the currentif (yflu < *yhi) {vertices, but we subtract it here, so as to givey[ihi]=ytry;the simplex a thermal Brownian motion: It*yhi=yflu;likes to accept any suggested change.for (j=1;j<=ndim;j++) {psum[j] += ptry[j]-p[ihi][j];p[ihi][j]=ptry[j];}}free_vector(ptry,1,ndim);return yflu;}There is not yet enough practical experience with the method of simulatedannealing to say definitively what its future place among optimization methodsSample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use.

Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).lower point, i.e., do a one-dimensional contraction.ysave=yhi;ytry=amotsa(p,y,psum,ndim,pb,yb,funk,ihi,&yhi,0.5);if (ytry >= ysave) {Can’t seem to get rid of that high point.for (i=1;i<=mpts;i++) {Better contract around the lowestif (i != ilo) {(best) point.for (j=1;j<=ndim;j++) {psum[j]=0.5*(p[i][j]+p[ilo][j]);p[i][j]=psum[j];}y[i]=(*funk)(psum);}}*iter -= ndim;GET_PSUMRecompute psum.}} else ++(*iter);Correct the evaluation count.10.9 Simulated Annealing Methods455CITED REFERENCES AND FURTHER READING:Kirkpatrick, S., Gelatt, C.D., and Vecchi, M.P.

1983, Science, vol. 220, pp. 671–680. [1]Kirkpatrick, S. 1984, Journal of Statistical Physics, vol. 34, pp. 975–986. [2]Vecchi, M.P. and Kirkpatrick, S. 1983, IEEE Transactions on Computer Aided Design, vol. CAD2, pp. 215–222. [3]Otten, R.H.J.M., and van Ginneken, L.P.P.P. 1989, The Annealing Algorithm (Boston: Kluwer)[contains many references to the literature]. [4]Metropolis, N., Rosenbluth, A., Rosenbluth, M., Teller A., and Teller, E. 1953, Journal of ChemicalPhysics, vol.

21, pp. 1087–1092. [5]Lin, S. 1965, Bell System Technical Journal, vol. 44, pp. 2245–2269. [6]Vanderbilt, D., and Louie, S.G. 1984, Journal of Computational Physics, vol. 56, pp. 259–271. [7]Bohachevsky, I.O., Johnson, M.E., and Stein, M.L. 1986, Technometrics, vol. 28, pp. 209–217. [8]Corana, A., Marchesi, M., Martini, C., and Ridella, S. 1987, ACM Transactions on MathematicalSoftware, vol. 13, pp. 262–280.

[9]Bélisle, C.J.P., Romeijn, H.E., and Smith, R.L. 1990, Technical Report 90–25, Department ofIndustrial and Operations Engineering, University of Michigan, submitted to MathematicalProgramming. [10]Christofides, N., Mingozzi, A., Toth, P., and Sandi, C. (eds.) 1979, Combinatorial Optimization(London and New York: Wiley-Interscience) [not simulated annealing, but other topics andalgorithms].Sample page from NUMERICAL RECIPES IN C: THE ART OF SCIENTIFIC COMPUTING (ISBN 0-521-43108-5)Copyright (C) 1988-1992 by Cambridge University Press.Programs Copyright (C) 1988-1992 by Numerical Recipes Software.Permission is granted for internet users to make one paper copy for their own personal use. Further reproduction, or any copying of machinereadable files (including this one) to any servercomputer, is strictly prohibited. To order Numerical Recipes books,diskettes, or CDROMsvisit website http://www.nr.com or call 1-800-872-7423 (North America only),or send email to trade@cup.cam.ac.uk (outside North America).will be.

The method has several extremely attractive features, rather unique whencompared with other optimization techniques.First, it is not “greedy,” in the sense that it is not easily fooled by the quickpayoff achieved by falling into unfavorable local minima. Provided that sufficientlygeneral reconfigurations are given, it wanders freely among local minima of depthless than about T . As T is lowered, the number of such minima qualifying forfrequent visits is gradually reduced.Second, configuration decisions tend to proceed in a logical order.

Changesthat cause the greatest energy differences are sifted over when the control parameterT is large. These decisions become more permanent as T is lowered, and attentionthen shifts more to smaller refinements in the solution. For example, in the travelingsalesman problem with the Mississippi River twist, if λ is large, a decision to crossthe Mississippi only twice is made at high T , while the specific routes on each sideof the river are determined only at later stages.The analogies to thermodynamics may be pursued to a greater extent than wehave done here.

Quantities analogous to specific heat and entropy may be defined,and these can be useful in monitoring the progress of the algorithm towards anacceptable solution. Information on this subject is found in [1]..

Свежие статьи
Популярно сейчас
Почему делать на заказ в разы дороже, чем купить готовую учебную работу на СтудИзбе? Наши учебные работы продаются каждый год, тогда как большинство заказов выполняются с нуля. Найдите подходящий учебный материал на СтудИзбе!
Ответы на популярные вопросы
Да! Наши авторы собирают и выкладывают те работы, которые сдаются в Вашем учебном заведении ежегодно и уже проверены преподавателями.
Да! У нас любой человек может выложить любую учебную работу и зарабатывать на её продажах! Но каждый учебный материал публикуется только после тщательной проверки администрацией.
Вернём деньги! А если быть более точными, то автору даётся немного времени на исправление, а если не исправит или выйдет время, то вернём деньги в полном объёме!
Да! На равне с готовыми студенческими работами у нас продаются услуги. Цены на услуги видны сразу, то есть Вам нужно только указать параметры и сразу можно оплачивать.
Отзывы студентов
Ставлю 10/10
Все нравится, очень удобный сайт, помогает в учебе. Кроме этого, можно заработать самому, выставляя готовые учебные материалы на продажу здесь. Рейтинги и отзывы на преподавателей очень помогают сориентироваться в начале нового семестра. Спасибо за такую функцию. Ставлю максимальную оценку.
Лучшая платформа для успешной сдачи сессии
Познакомился со СтудИзбой благодаря своему другу, очень нравится интерфейс, количество доступных файлов, цена, в общем, все прекрасно. Даже сам продаю какие-то свои работы.
Студизба ван лав ❤
Очень офигенный сайт для студентов. Много полезных учебных материалов. Пользуюсь студизбой с октября 2021 года. Серьёзных нареканий нет. Хотелось бы, что бы ввели подписочную модель и сделали материалы дешевле 300 рублей в рамках подписки бесплатными.
Отличный сайт
Лично меня всё устраивает - и покупка, и продажа; и цены, и возможность предпросмотра куска файла, и обилие бесплатных файлов (в подборках по авторам, читай, ВУЗам и факультетам). Есть определённые баги, но всё решаемо, да и администраторы реагируют в течение суток.
Маленький отзыв о большом помощнике!
Студизба спасает в те моменты, когда сроки горят, а работ накопилось достаточно. Довольно удобный сайт с простой навигацией и огромным количеством материалов.
Студ. Изба как крупнейший сборник работ для студентов
Тут дофига бывает всего полезного. Печально, что бывают предметы по которым даже одного бесплатного решения нет, но это скорее вопрос к студентам. В остальном всё здорово.
Спасательный островок
Если уже не успеваешь разобраться или застрял на каком-то задание поможет тебе быстро и недорого решить твою проблему.
Всё и так отлично
Всё очень удобно. Особенно круто, что есть система бонусов и можно выводить остатки денег. Очень много качественных бесплатных файлов.
Отзыв о системе "Студизба"
Отличная платформа для распространения работ, востребованных студентами. Хорошо налаженная и качественная работа сайта, огромная база заданий и аудитория.
Отличный помощник
Отличный сайт с кучей полезных файлов, позволяющий найти много методичек / учебников / отзывов о вузах и преподователях.
Отлично помогает студентам в любой момент для решения трудных и незамедлительных задач
Хотелось бы больше конкретной информации о преподавателях. А так в принципе хороший сайт, всегда им пользуюсь и ни разу не было желания прекратить. Хороший сайт для помощи студентам, удобный и приятный интерфейс. Из недостатков можно выделить только отсутствия небольшого количества файлов.
Спасибо за шикарный сайт
Великолепный сайт на котором студент за не большие деньги может найти помощь с дз, проектами курсовыми, лабораторными, а также узнать отзывы на преподавателей и бесплатно скачать пособия.
Популярные преподаватели
Добавляйте материалы
и зарабатывайте!
Продажи идут автоматически
5167
Авторов
на СтудИзбе
437
Средний доход
с одного платного файла
Обучение Подробнее