## Resolution of optimization variable in nonlinear optimization problem like simulannealbnd patternsearch

### mumin chy (view profile)

on 25 Apr 2019
Latest activity Edited by Alan Weiss

### Alan Weiss (view profile)

on 29 Apr 2019
Hey,
I am doing a real time optimization problem. The cost function is not super sensitive to optimization variable. But I found that nonlinear optimization problem like simulannealbnd patternsearch keep repeating eveluation with very low resulution to get a better solution even though it see very small change in cost function. I even see sometime it keep reaping evaluation with the same value of optimization variable. But I don't care about the resolution much as long as I get a solution with ~1 resolution. I want to say the optimization method not to search a solution with very good resolution. Is there any option for nonlinear optimization problem like simulannealbnd patternsearch in Matlab? example: if the optimization technique already did an evaluation of the cost finction f(x) at x=1.5, I don't want it to try another evaluation within x= 1 and x =2.

on 25 Apr 2019
Edited by Matt J

### Matt J (view profile)

on 25 Apr 2019

In ga, you can constrain certain variables x(i) to be integers using the IntCon input. Then, inside your objective, you can use a scale factor to change the minimum "resolution" as you call it to some possibly non-integer value:
function val=fitness(xInteger)
x=res*xInteger;
val=....something dependending on x ....
end

### Alan Weiss (view profile)

on 29 Apr 2019
Edited by Alan Weiss

### Alan Weiss (view profile)

on 29 Apr 2019

For patternsearch you can set the MeshTolerance option to 1/2 or something like that.If your objective function is very expensive, you can also set the Cache option to 'on'. You might also want to set the InitialMeshSize option to something larger than 1, maybe 4 or 32 or something.
Alan Weiss
MATLAB mathematical toolbox documentation