In simulannealbnd solver can we use integer data type?
Show older comments
I want to use integer data type in simulannealbnd solver. Is there any way out to do the same?
Answers (2)
Walter Roberson
on 19 Jul 2022
1 vote
No, that optimizer has no way of handling discrete inputs.
If you want to experiment you could try the following strategy (that will probably not work at all well):
- do not use a direct input variable. Instead, use an input variable with lower bound 1.0 and an upper bound 1+delta where delta = (largest desired integer minus lowest desired integer) divided by 2^53
- set the options so that the minimum step size is eps(1)
- inside the function take the input, subtract 1.0, multiply by 2^53 and add the minimum desired integer. The result should in theory be an integer
- you might need to set options about function tolerance
I think this will likely not work well... but it is crazy enough that it just might work.
2 Comments
sejung kim
on 19 Jul 2022
Thank you for your advice.
Since integers and double are both in the input variable of my objective function, it seems difficult to set the step size respectively.
So, I first, use GA to optimize whole variables, fix integer variables by setting LB, UB, and using simulannealbnd to optimize double type variables.
But it tooks a lot of time at simulannealbnd. If I set step size at simulannealbnd, I can shorten the optimization time but I can't find how to set step size. If you know, please help.
Walter Roberson
on 19 Jul 2022
https://www.mathworks.com/help/optim/ug/optim.problemdef.optimizationproblem.optimoptions.html
set the StepTolerance option which defaults to 1e-10
If you are using my outline of how to transform continuous into integer, then you would need about 1e-16 which would potentially take much much longer than what you have now.
Simulated annealing is slow. It does not use any gradient information to make predictions about what to try next, and does not assume continuity.
sejung kim
on 19 Jul 2022
0 votes
I have the same question.
Have you solved it now?
Categories
Find more on Simulated Annealing in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!