Hello
I see that you wish to write a custom annealing function from “simulannealbnd”. This can be accomplished by modifying the options parameters for algorithm settings, as shown at the documentation link below:
Following the documentation, a custom objective function can be written by modifying the "saannealingfcntemplate.m" file. To keep all iterates within bounds, the custom annealing function should call “sahonorbounds” as the final command.
Hope it helps