Pattern search with integer decision variable.
10 views (last 30 days)
Show older comments
Hello.
I tried to solve Nonlinear integer programming to minimize using Optimization tool box.
I understand how I input both objective function and nonlinear constraint function.
However, I don't know how I obtain some decision variable are integer and others are real variable. Cuz, there is no option in pattern search tool box and function in matlab.
Are there any method to get integer variable using pattern search in matlab tool box?
0 Comments
Accepted Answer
Alan Weiss
on 25 May 2016
If you have mixed (some integer, some continuous) variables, then no, there is currently no patternsearch solution. Use ga for this type of problem.
However, if all your variables are integer-valued, then you might be able to use patternsearch. Start at an integer point, set ScaleMesh off, and set TolMesh to 0.9 or so. I believe that, with those settings, patternsearch will search only integer points.
Alan Weiss
MATLAB mathematical toolbox documentation
11 Comments
Ryan Potter
on 7 Feb 2019
Hi, I just wanted to check whether this advice was still valid? I have followed the points above but still generate non-integer values. I'm using the following code:
fun = @computeMagVol;
x0 = [10,25,20,2];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [1, 1, 1,1];
ub = [21,51,41,4];
nonlcon = @combineConstraints;
options = optimoptions('patternsearch', ...
'PollMethod' , 'GPSPositiveBasis2N', ...
'Display' , 'Iter', ...
'ScaleMesh' , 'off', ...
'AccelerateMesh' , false, ...
'TolMesh' , 0.9, ...
'PlotFcn' ,{@psplotbestf,@psplotmeshsize});
[x,fval,exitflag,output] = patternsearch(fun,x0,A,b,Aeq,beq,lb,ub,nonlcon,options);
My objective function use the integer variables to select discrete, non-integer variables from a list. After the following computations:
Iter Func-count f(x) Constraint MeshSize Method
0 1 75615.1 104.4 0.9
1 50 71970.7 0 0.001 Increase penalty
I obtain that x = [1 44.5, 21, 4] which causes my objective function calculation to fail. The same functions work with the ga algorithm, however I was hoping to use patternsearch as it supports having the object function and non-linear constraints in a single function. Any advice would be greatly appreciated.
Alan Weiss
on 7 Feb 2019
As I said earlier, I am not at all sure that this method works when you have nonlinear constraints. Sorry.
Alan Weiss
MATLAB mathematical toolbox documentation
More Answers (1)
Benjamin Duquenne
on 1 Jun 2017
Hi, I would like to use patternsearch for full integer problems. To do so, I set the ScaleMesh off, and set TolMesh to 0.9. However I still have problems with the TolBind that has to be way too high (~1e3) to make the code work, otherwise I have errors like 'Constraints are dependent at current iterate'. Could you help me? Thanks in advance.
0 Comments
See Also
Categories
Find more on Direct Search 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!