Constrained minimization of a variable-dependent function
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
I have a set of data to which I need to optimize a multi-variable function. For example the data is:
A=[7 8 9 10 11 12 13 14 15]; B=[0 0 0 1 1.5 2 2.7 4 7];
Where dependant variable B can be estimated using the following function: if A>C B=alpha*(A^p-C^p)^(1/p) else B=0 endif
I want to optimize the variables (alpha, p, C) to obtain the best predictions of B. There are constrains on the variables, namely: 0 < alpha < 1; p > 1; C > 0
It seems that fmincon is the best way to solve this problem, where the function to be minimised would just be: sum(abs(B_predicted-B_actual))
However, I can't figure out how to define the function for use with fmincon because of the "if".
Any help would be much appreciated!
0 comentarios
Respuestas (1)
Vitali Avagyan
el 20 de Ag. de 2014
Editada: Vitali Avagyan
el 20 de Ag. de 2014
Dear Shannon,
Sorry for replying so late - just saw your question. You do not need to consider "if" in your constrained optimisation if your data is as given in the question. Just start from the 4th element of C since if A<=C -> B=0 we can conclude that any number that satisfies c1>=7, c2>=8 and c3>=9 will be optimal for the first three elements of C. Hence, you need to optimise c4, c5 etc along with alpha and p. Also, you should add the following constraints to the elements of the C, i.e. c4<10, c5<11,c6<12,c7<13, c8<14 and c9<15. The rest is as you defined:
min sum(abs(B_predicted-B_actual))
s.t
0 < alpha < 1;
p > 1;
0<ci<ai, i=4,5...9
Hope, this helps.
0 comentarios
Ver también
Categorías
Más información sobre Get Started with Optimization Toolbox en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!