MATLAB: Using Simulated Annealing along with Nonlinear Constraints

simulannealbnd simulated annealing optimization minimization

MATHWORKS, Thanks for all your help in the past. I'm trying to find the global minimum for a highly non-linear set of equations (minimizing Gibbs free energy). The book that I'm studying recommends simulated annealing. The MATLAB simulated annealing function (simulannealbnd) works great when I use scalar upper and lower bounds for x (i.e. lb = [0.001 0.001] ub = [0.999 0.999]). Yet, the problem is that my x vector must sum to 1. Do you know if there's a way to do this? Maybe can I have simulannealbnd accept function constraints? Or is it possible to minimize two function? One for Gibbs energy and the other for y = 1 – x(1) – x(2). Thanks so much for your help!

Best Answer

Optimize on one variable with lower bound eps and upper bound 1-eps. Inside the function define x2 as 1-eps