MATLAB: How does Matlab’s simulannealbnd enforce bound constraints

constraintssimulannealbndsimulated annealingxyz

Hello
I'm using the simulannealbnd Function of Matlab for finding the minimum of a function using simulated annealing. As arguments one can pass lower and upper bounds of the variables. In the documentation it is described how simulated annealing works but there is nothing about how the bound constraints are enforced.
Does somebody know (or can imagine) how this is done in this case?

Best Answer

The AnnealingFcn that you designate is responsible for ensuring that the constraints are honoured. The standard annealingfast routine calls sahonorbounds for this purpose. The code there projects randomly a portion of the way between the current point and the bound when a bound would be violated. See toolbox/globaloptim/globaloptim/private/sahonorbounds.m
Related Question