simulated annealing; error in looping; bestfval

simulated annealing; error in looping; bestfval

Post by Lynn » Fri, 10 Apr 2009 23:43:02


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
% =========================================================================
fits = 3; "3 SA fits of the model to the data per year"
Paras = 6; "6 parameters to be estimated"
% =========================================================================
load ProjectYrs "load required data from current directory"
load LTGNMeshesMM
load LTBinTLIndex
load MethodsCount
load DataAnnLTLngFrqByMethodMesh
load DataAnnLTTLCountByMethodMesh
load DataQuadParameters "this is the file that contains data for parameter seeds and their bounds, indexed by year"
% =========================================================================
% Start with the default options
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.
ub1(1,:) = DataQuadParameters(yr,1,:,3);
lb2(1,:) = DataQuadParameters(yr,1,:,4);
ub2(1,:) = DataQuadParameters(yr,1,:,5);
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

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

1. Optimization using fmincon & simulated annealing and its error

2. Acceptance Function of a Simulated Annealing

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

IF ( The modifiedsolution is better than the currentsolution )
( 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?

[ is moderated. To submit, just post and be patient, or if ]
[ that fails mail your article to < XXXX@XXXXX.COM >, and ]
[ ask your news administrator to fix the problems with your system. ]

3. coloring graphs using simulated annealing

4. Problem with Simulated Annealing-- Cost Function

5. simulated annealing in matlab code for image segmentation

6. Simulated Annealing to solve N-Puzzle

7. Simulated Annealing and timetables

8. simulated annealing

9. Simulated Annealing Application Papers Needed

10. Simulated annealing for constrained minimization

11. Matlab's Simulated Annealing toolbox has no constrained opmization?

12. about simulated annealing algorithm

13. when to stop a simulated annealing when it doesn't stop by itself

14. Simulated Annealing: Prob. of acceptance gone wrong

15. can anybody please point me to a good simulated annealing C/C++ code?