Optimization problem with 2 unknowns

3 views (last 30 days)
Loic Van Aelst
Loic Van Aelst on 1 Dec 2016
Edited: Loic Van Aelst on 4 Dec 2016
Hello,
I am trying to minimize an equation that is a function of 2 variables: T_u and T_e. The other variables G and r_column are known.
eq = @(T_u, T_e) norm((eye(2488,2488)-G*(eye(933,933)-T_u+T_e*G).^(-1)*T_e)*r_column);
with the constraint: con = norm(T_u - T_e*G) <=1; You could set an initial guess to x0 = (ones(933,2488), ones(933,933) ); With the first term in x0 being an initial guess for T_e (933x2488) and the second one for T_u (933x933)
I have tried to use the function fmincon, however I can't figure out how to properly write this. My notation seems to be off.
I hope someone can help me. Thanks in advance for your help, it is greatly appreciated.
  2 Comments
Torsten
Torsten on 2 Dec 2016
You will have to supply x0 as one long row vector (size (1,933*2488+933*933)).
In "eq" and "con", use "reshape" to recover your matrices from the vector x fmincon supplies.
Best wishes
Torsten.
Loic Van Aelst
Loic Van Aelst on 4 Dec 2016
Edited: Loic Van Aelst on 4 Dec 2016
How about the T_u and T_e? I have 2 matrices as variables. I don't think writing both of them in 1 vector of size (1,933*2488+933*933) will help. How would I do the multiplication of T_e * G? G is a (2488x933) matrix.
Isn't there another matlab function to solve this optimization problem with?

Sign in to comment.

Answers (1)

John D'Errico
John D'Errico on 4 Dec 2016
Edited: John D'Errico on 4 Dec 2016
In terms of the optimization, you don't have TWO variables. You have two unknown matrices, containing 933*2488+933*933 total unknowns. So roughly 3.2e6 unknowns.
933*2488+933*933
ans =
3191793
Will this take a long time? Hell yes!
Just to start, fmincon will attempt to differentiate your objective, with respect to EVERY unknown. So 3.2e6 evaluations of your objective function, just to get a gradient. Then at every iteration, it will compute the gradient again.
As bad, at every iteration, fmincon will probably need to solve a FULL linear system of equations, of size 3.2e6 by 3.2e6. So fmincon will be working with matrices of size
3.2e6*3.2e6
ans =
1.024e+13
Those 10 trillion elements will require 82 terabytes of RAM or so to store the matrix. Then as many to factor it.
3.2e6*3.2e6*8
ans =
8.192e+13
So a while to do this.
Fmincon can only optimize ONE array containing the unknowns. So you will probably want to pass in a matrix of size 933x(2488 + 933). Concatenate both sets of starting values for those arrays into one.
T_eu = [Te,T_u];
Then, inside your objective function, split them apart. Do the computation with them split apart. Fmincon does not care then. All that matters is your objective function is able to deal with a 933x3421 matrix. So this should work:
eq = @(T_eu) norm((eye(2488,2488)-G*(eye(933,933)-T_eu(:,2489:end)+T_eu(:,1:2488)*G).^(-1)*T_eu(:,1:2488))*r_column);
Again, it will run like a dog with only one leg. Ok, stumble is closer to it. All because fmincon will not be terribly efficient in trying to optimize a problem that large.
  1 Comment
Loic Van Aelst
Loic Van Aelst on 4 Dec 2016
Edited: Loic Van Aelst on 4 Dec 2016
Thank you for the answer, but I still have 1 problem: how do I define my A to put in fmincon(eq,x0,A,b)?
Matlab says A needs to have 3191793 columns? I need to find the A that replaces: T_u-T_e*G by A*T_eu, but T_eu has only 933 rows...

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!