fmincon, find integer values as optimal values

4 visualizaciones (últimos 30 días)
Mohamed Musni
Mohamed Musni el 1 de Feb. de 2018
Comentada: Mohamed Musni el 1 de Feb. de 2018
f =@(fr)(50*fr(1)^2 + 100)/fr(1) + (175*fr(2)^2 + 150)/fr(2) + (160*fr(3)^2 + 250)/fr(3)
lb = [0,0,0];
ub = [5,5,5];
A = [];
b = [];
Aeq = [];
beq = [];
fr0 = [1,1,1];
fr = fmincon(f,fr0,A,b,Aeq,beq,lb,ub)
output:
f =
function_handle with value:
@(fr)(50*fr(1)^2+100)/fr(1)+(175*fr(2)^2+150)/fr(2)+(160*fr(3)^2+250)/fr(3)
Local minimum possible. Constraints satisfied.
fmincon stopped because the size of the current step is less than
the default value of the step size tolerance and constraints are
satisfied to within the default value of the constraint tolerance.
<stopping criteria details>
fr =
1.4142 0.9258 1.2500
I want to find positive integer values rather than decimal values for my variables. is there any way to include this condition with fmincon? any help will be highly appreciated. thank you

Respuesta aceptada

Sean de Wolski
Sean de Wolski el 1 de Feb. de 2018
Editada: Sean de Wolski el 1 de Feb. de 2018
fmincon is not designed to deal with integer x values. You should try ga() which has an IntCon option or patternsearch() with a round() on the input values.
Of course for a small problem like this there are only 216 unique combinations of x so you could easily brute force it.
[rr,cc,pp] = ndgrid(0:5);
v = (50*rr.^2 + 100)./rr + (175*cc.^2 + 150)./cc + (160*pp.^2 + 250)./pp;
[val, idx] = min(v(:));
[rr(idx) cc(idx) pp(idx)]
  1 comentario
Mohamed Musni
Mohamed Musni el 1 de Feb. de 2018
thank you. I found tutorial with ga() and abled to get answer with integer values. have a nice day

Iniciar sesión para comentar.

Más respuestas (0)

Categorías

Más información sobre Surrogate Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by