Help with the function fmincon for optimizing a portfolio
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Andrew Burns
el 4 de En. de 2017
Comentada: Andrew Burns
el 4 de En. de 2017
Hi. Simple Q ...
I'm optimizing the weights in the DOW30 for that past 100 weeks (a 100x30 matrix). The constraints are that each of the constituent weights has to be between 0 and 1 AND the total of the 30 weights = 1. Simple.
I'm having a hard time understanding the arguments passed to fmincon. X0,A,B,Aeq,Beq. I get that UB=1, LB=0. But which argument caps the total weight to 1? And which arguments do I not use?
Thanks a ton.
0 comentarios
Respuesta aceptada
Walter Roberson
el 4 de En. de 2017
Use Aeq = ones(1,number_of_variables) and beq = 1 and lb = zeros(1, number_of_variables) and ub = ones(1, number_of_variables) and A empty and b empty
This will express that the sum of 1 times each of the variables, must exactly total 1
Más respuestas (0)
Ver también
Categorías
Más información sobre Linear Programming and Mixed-Integer Linear Programming 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!