fminunc for upper and lower bound variable definition ?
18 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Isn't it possible to give upper and lower bound for the variables in the objective function while using fminunc ?
Thank you.
0 comentarios
Respuesta aceptada
Ameer Hamza
el 4 de Nov. de 2020
No, fminunc() is for unconstrained optimization. If you want to do constrained optimization, then use fmincon().
2 comentarios
Más respuestas (1)
Bruno Luong
el 4 de Nov. de 2020
Editada: Bruno Luong
el 4 de Nov. de 2020
You could transform variables, x will be opened bounded by lo/hi
xfun = @(y) lo + (hi-lo).*sin(y).^2
...
y = fminunc(obj(xfun(y)), ...)
x = xfun(y)
Honestly I don't like those kind of transformation.
Use the right tool: fmincon as others have suggested.
9 comentarios
Walter Roberson
el 5 de Nov. de 2020
fun = @(x)[x1L;x2L;x3L]+([x1U;x2U;x3U]-[x1L;x2L;x3L]).*PRSopt_QN1(x(1,:),x(2,:),x(3,:))
Unless two of x1L, x2L, x3L are empty and the third is a scalar, then you can be sure that function is going to return something that is not a scalar. You do not take the mean() there.
Ver también
Categorías
Más información sobre Get Started with Optimization Toolbox 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!