simulated annealing with constraints or shifting to genetic algorithm

5 views (last 30 days)
So i have a problem to solve similar to the job machine scheduling problem. So far, i used simulated annealing (from global optim toolbox) and got the problem solved however i have inequality constraints that need to be satisfied. So after looking in older posts, i found it is not supported in simulated annealing and i tried to use a penality in the cost function to skip the bad solutions but i don't feel like it changed anything (i still get solutions mostly not responding to the inequality constraints.)
Any better way to get rid of these solutions? (any hint would be appreciated since i don't have much time to shift to another solution).
If not, i saw in some posts the recommandation to use genetic algorithm (although it might slow the solution). So if i want to shift to it, what should i use for population, crossover and mutation functions and what are their analogy with simulated annealing?
Thanks in advance

Answers (1)

Alan Weiss
Alan Weiss on 4 Jan 2016
Edited: Alan Weiss on 4 Jan 2016
I do not understand exactly what problem you are trying to solve. If it can be formulated as an integer programming problem, perhaps along the lines of this example, then it will almost certainly be the case that you will get faster, more reliable answers using intlinprog than either simulated annealing or the genetic algorithm.
If your problem is a smooth continuous problem, then you would almost certainly get faster, more reliable answers using fmincon than either simulated annealing or the genetic algorithm.
If you have a nonsmooth problem, then you would almost certainly get faster, more reliable answers using patternsearch than either simulated annealing or the genetic algorithm.
Basically, simulated annealing is the slowest and least reliable solver in the toolbox. The genetic algorithm is the second-slowest and second-least-reliable solver. I heartily recommend using the aforementioned solvers instead.
If you need a global solution for fmincon or patternsearch, and you have finite bounds on all components, you can repeatedly try different random start points as follows:
x0 = lb + rand(size(lb)).*(ub-lb);
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!