Optimization of an objective function with matrix as a variable
22 views (last 30 days)
Show older comments
I have a function to be maximized with takes as input a 100 x 100 matrix. How do i dynamically optimize this using optimization toolbox, i.e. varying the entire (100 x 100) matrix simultaneously [not cell by cell or row by row]. In addition, i also need to put constraint on every element of matrix. In short it becomes a single objective function, 10000 variables, 10001 constraints problem. Code attached (main & function) in which I want to optimize the Terminal_Wealth with constraint on variable alpha matrix [0<a(i,j)<1] & Risk<10 (--> this would be a non-linear constraint, I suppose).
0 Comments
Answers (1)
Matt J
on 15 May 2014
Edited: Matt J
on 15 May 2014
This is probably what you're looking for
Essentially, there is nothing stopping you from writing an objective function that takes a 100x100 matrix as input. However, if you have linear in/equality constraint matrix data A,b,Aeq,beq then A,Aeq will have 10000 columns and will be expected to be written so that
A*X(:)<=b
Aeq*X(:)=beq
are the constraints on a given 100x100 matrix X.
2 Comments
Matt J
on 15 May 2014
Maybe an example would be best. Suppose, I have a 2x2 matrix X and I want to minimize the sum over all the elements, subect to the constraints 0<=X(i,j)<=1 and
sum(X(i,j)^2)=1
Then I could do so as follows
nonlcon=@(X) deal([],norm(X(:))^2-1);
X= fmincon(@(X) sum(X(:)),rand(2),[],[],[],[],...
zeros(2), ones(2), nonlcon );
See Also
Categories
Find more on Get Started with Optimization Toolbox 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!