## simulated annealing; error in looping; bestfval

### simulated annealing; error in looping; bestfval

ello,

I'm using simulated annealing (SA) to estimate parameters in a high-dimensional space (10--20 p). The code that I will show you (below) is a simplification of my programs but is useful for describing my problem.

SA requires that starting parameter estimates (seeds) be provided and bounds on these parameters are also useful to finding a solution. I have ten years of time series data for nonnative lake trout in Yellowstone Lake; in this case, the data are length-frequency histograms. The SA solver's objective is to minimize the least-squares fit of the observed (measured) length-frequency distribution to the distribution predicted by my model.

Because environmental conditions vary significantly among years, the seeds and their bounds differ among years. (Both types of data are preliminarily estimated using simple regression techniques.) Accordingly, I must send a year-specifc set of parameter seeds and their bounds to the solver with each time step (year). This is where my problem seems to come in.

Here's my MasterFunction code; I've put some of my addtional comments in quotes:

function [ParaEstsOut]=MasterFunc
randn('state',sum(100*clock));
rand('state',sum(100*clock));
% =========================================================================
fits = 3; "3 SA fits of the model to the data per year"
Paras = 6; "6 parameters to be estimated"
% =========================================================================
load DataQuadParameters "this is the file that contains data for parameter seeds and their bounds, indexed by year"
% =========================================================================
options = saoptimset;
% Modify options setting
options = saoptimset(options,'TemperatureFcn',@temperatureexp); % @temperatureexp @temperatureboltz @temperaturefast
options = saoptimset(options,'AnnealingFcn', @annealingfast); % @annealingboltz @annealingfast
options = saoptimset(options,'TolFun', 1e-8); % 1e-6
options = saoptimset(options,'StallIterLimit', 3000); % Default: 500 x number of parameters.
options = saoptimset(options,'MaxFunEvals', 180); % 3000*Paras
options = saoptimset(options,'Display', 'off');
options = saoptimset(options,'PlotFcns', { @saplottemperature @saplotbestx @saplotf @saplotstopping });
options = saoptimset(options,'OutputFcns', { [] });
options = saoptimset(options,'InitialTemperature', 250); % 100
options = saoptimset(options,'ReannealInterval', 50); % 100
% =========================================================================
ParaEstsOut=zeros((fits*(ProjectYrs-71)),Paras+5); % 1998 (72) is first year with data.
Counter = 1;
for yr = 72:ProjectYrs %:ProjectYrs % 1998 (72) is first year when minimum data requirements were met for Control; 2004 (78) for Spawner.
save yr
lb1(1,:) = DataQuadParameters(yr,1,:,2); % Year-specific parameter bounds applied.
Year(yr) "I like to see data printed out from time to time, to make sure that the code is running properly"
for kk = 1:fits
tic

RandVect = rand(1,Paras);
x = lb1 + ((ub1-

In the literature, most of the works
use the following acceptance function for SA:

IF ( The modifiedsolution is better than the currentsolution )
OR
( random[0..1] < exp(-deltachanges/T)
THEN currentsolution=modifiedsolution

Note: deltachanges=cost(currentsolution)-cost(modifiedsolution)

However, a few works propose the following acceptance creteria:

IF ( random[0..1] < 1.0/(1.0+exp(deltachanges/T)) )
THEN currentsolution=modifiedsolution
What is the difference between them? Which one is preferable?

[ comp.ai is moderated. To submit, just post and be patient, or if ]
[ that fails mail your article to < XXXX@XXXXX.COM >, and ]