📄 loadfile.do.htm
字号:
examples of possible solution generators: @(x) (rand(3,1)): Picks a
random point in the unit cube. @(x) (ceil([9 5].*rand(2,1))): Picks a
point in a 9-by-5 discrete grid.<br>
Note that if you use the default generator, ANNEAL only works on row
vectors. For loss functions that operate on column vectors, use this
generator instead of the default: @(x)
(x(:)'+(randperm(length(x))==length(x))*randn/100)'<br>
InitTemp: The initial temperature, can be any positive number. Default is 1.<br>
StopTemp: Temperature at which to stop, can be any positive number smaller than InitTemp. Default is 1e-8.<br>
StopVal: Value at which to stop immediately, can be any output of LOSS that is sufficiently low for you. Default is -Inf.<br>
CoolSched: Generates a new temperature from the previous one. Any
function handle that takes a scalar as input and returns a smaller but
positive scalar as output. Default is @(T) (.8*T).<br>
MaxConsRej: Maximum number of consecutive rejections, can be any positive number. Default is 1000.<br>
MaxTries: Maximum number of tries within one temperature, can be any positive number. Default is 300.<br>
MaxSuccess: Maximum number of successes within one temperature, can be any positive number. Default is 20.<br>
<br>
<br>
Usage:<br>
[MINIMUM,FVAL] = ANNEAL(LOSS,NEWSOL,[OPTIONS]);<br>
MINIMUM is the solution which generated the smallest encountered value when input into LOSS.<br>
FVAL is the value of the LOSS function evaluated at MINIMUM.<br>
OPTIONS = ANNEAL();<br>
OPTIONS is the default options structure.<br>
<br>
<br>
Example:<br>
The so-called six-hump camelback function has several local minima in
the range -3<=x<=3 and -2<=y<=2. It has two global minima,
namely f(-0.0898,0.7126) = f(0.0898,-0.7126) = -1.0316. We can define
and minimise it as follows:<br>
camel = @(x,y)(4-2.1*x.^2+x.^4/3).*x.^2+x.*y+4*(y.^2-1).*y.^2;<br>
loss = @(p)camel(p(1),p(2));<br>
[x f] = anneal(loss,[0 0])<br>
We get output:<br>
Initial temperature: 1<br>
Final temperature: 3.21388e-007<br>
Consecutive rejections: 1027<br>
Number of function calls: 6220<br>
Total final loss: -1.03163<br>
x =<br>
-0.0899 0.7127<br>
f =<br>
-1.0316<br>
Which reasonably approximates the analytical global minimum (note that
due to randomness, your results will likely not be exactly the same). <br>
</td>
</tr>
<tr>
<td valign="top" width="10"> </td>
<td colspan="3" valign="top"> </td>
</tr>
</tbody></table>
<input name="fileId" value="10548" type="hidden">
<input name="fileName" value="anneal" type="hidden">
<input name="fileExt" value=".m" type="hidden">
<input name="contributorId" value="1095062" type="hidden">
</form>
<br>
<table style="background-color: rgb(255, 255, 255);" width="536" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<table width="514" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td width="286"> <b class="feh4blk"> File Details</b></td>
<td width="228"> </td>
</tr>
<tr>
<td colspan="2"><img src="loadFile.do_files/blue_band_536x5.gif" alt="" width="536" height="5"></td>
</tr>
</tbody></table>
</td>
</tr>
</tbody></table>
<table width="536" border="0" cellpadding="0" cellspacing="0">
<tbody><tr bgcolor="#f4f4f4">
<td colspan="5" valign="top"> </td>
</tr>
<tr bgcolor="#f4f4f4">
<td valign="top" width="1%"> </td>
<td valign="top" width="25%"><b>File Id:</b></td>
<td width="20%">10548</td>
<td valign="top" width="25%"><b>Average rating:</b></td>
<td width="29%">4.0</td>
</tr>
<tr bgcolor="#f4f4f4">
<td valign="top"> </td>
<td valign="top"><b>Size:</b></td>
<td>7 KB</td>
<td valign="top"><b># of reviews:</b></td>
<td>28</td>
</tr>
<tr bgcolor="#f4f4f4">
<td valign="top"> </td>
<td valign="top"><b>Submitted:</b></td>
<td>2006-03-28</td>
<td valign="top"><b>Downloads:</b></td>
<td>8978</td>
</tr>
<tr bgcolor="#f4f4f4">
<td valign="top"> </td>
<td valign="top"><b>Subscribers:</b></td>
<td>8</td>
<td colspan="2"> </td>
</tr>
<tr bgcolor="#f4f4f4">
<td> </td>
<td valign="top"><b>Keywords:</b></td>
<td colspan="3" valign="top"><span class="__mozilla-findbar-search" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">Simulat</span>ed annealing, stochastic optimization, anneal, <span class="__mozilla-findbar-search" style="padding: 0pt; background-color: yellow; color: black; display: inline; font-size: inherit;">simulat</span>ion</td>
</tr>
<tr bgcolor="#f4f4f4">
<td valign="top" width="10"> </td>
<td colspan="4" valign="top"> </td>
</tr>
</tbody></table>
<br>
<!--Acknowledgements -->
<!--Acknowledgements -->
<br>
<table style="background-color: rgb(255, 255, 255);" width="536" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td>
<table width="514" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td width="286"> <b class="feh4blk"> User Reviews</b></td>
<td width="228"> <div class="small" align="right">Number
of Reviews: 28</div></td>
</tr>
<tr>
<td colspan="2"><img src="loadFile.do_files/blue_band_536x5.gif" alt="" width="536" height="5"></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
<table width="536" border="0" cellpadding="3" cellspacing="0">
<tbody><tr>
<td width="9" bgcolor="#dcdfe4"></td>
<td bgcolor="#dcdfe4"><b>Date</b>: 2008-07-09<br>
<strong>From</strong>: Hom Gharti (hng.email@gmail.com) <br>
<strong>Rating</strong>:
<img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1">
<br>
<strong>Comments</strong>: It's very nice code. But I could not obtain the correct minimum value for Goldstein-Price's function as defined in <a href="http://www.geatbx.com/docu/fcnindex-01.html" target="_blank">http://www.geatbx.com/docu/fcnindex-01.html</a>. Do I have to change something in the option?
</td>
</tr>
<tr>
<td width="10" bgcolor="#dcdfe4"></td>
</tr>
<tr>
<td width="9" bgcolor="#dcdfe4"></td>
<td bgcolor="#dcdfe4"><b>Date</b>: 2008-07-05<br>
<strong>From</strong>: woosung yang <br>
<strong>Rating</strong>:
<img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar_grey.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar_grey.gif" alt="" width="12" height="12" hspace="1">
<br>
<strong>Comments</strong>: good
</td>
</tr>
<tr>
<td width="10" bgcolor="#dcdfe4"></td>
</tr>
<tr>
<td width="9" bgcolor="#dcdfe4"></td>
<td bgcolor="#dcdfe4"><b>Date</b>: 2008-06-23<br>
<strong>From</strong>: Vlad Lazar (clusty1@gmail.com) <br>
<strong>Rating</strong>:
<img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar_grey.gif" alt="" width="12" height="12" hspace="1"><img src="loadFile.do_files/fullstar_grey.gif" alt="" width="12" height="12" hspace="1">
<br>
<strong>Comments</strong>:
Its a nice general purpose implementation. Could make it more versatile
by allowing uphill steps with different probability distributions (this
uses Boltzmann) and different freezing conditions </td>
</tr>
<tr>
<td width="10" bgcolor="#dcdfe4"></td>
</tr>
</tbody></table>
<br>
<img src="loadFile.do_files/submitfile.gif" alt="" width="9" border="0" height="11">
<a href="http://www.mathworks.com/matlabcentral/fileexchange/loadRatings.do?objectId=10548&objectType=file&all=true">See more reviews</a>
<form name="rForm" method="post" action="/matlabcentral/fileexchange/saveRating.do"><input name="org.apache.struts.taglib.html.TOKEN" value="54b90173cf24d765b8b3506c6888c924" type="hidden">
<input name="objectType" value="file" type="hidden">
<input name="objectId" value="10548" type="hidden">
<br>
<table style="background-color: rgb(255, 255, 255);" width="536" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td> <table width="514" border="0" cellpadding="0" cellspacing="0">
<tbody><tr>
<td width="286"> <b class="feh4blk"><a name="review_submission"> Review this Submission</a></b></td>
<td width="240"> <div align="right"> <img src="loadFile.do_files/doc.gif" alt="" width="9" border="0" height="11">
<a href="http://www.mathworks.com/matlabcentral/fileexchange/ratingGuidelines.jsp" onclick="window.open(this.href,'small','toolbar=no,resizable=yes,status=yes,menu=no,scrollbars=yes,width=536,height=320');return false;">Guidelines for Reviewing a Submission</a></div></td>
</tr>
<tr>
<td colspan="2"><img src="loadFile.do_files/blue_band_536x5.gif" alt="" width="536" height="5"></td>
</tr>
</tbody></table></td>
</tr>
</tbody></table>
<table width="536" bgcolor="#dcdfe4" border="0" cellpadding="2" cellspacing="2">
<tbody><tr valign="top">
<td colspan="3"><b><img src="loadFile.do_files/exclamation.gif" alt="" width="12" height="11">
Bold Indicates Required Information</b> </td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -