The best way to code this optimization problem

1 回表示 (過去 30 日間)
mohamed Faraj
mohamed Faraj 2019 年 11 月 13 日
編集済み: Matt J 2019 年 11 月 14 日
I have a large optimization problem (a small part of this problem is given below)
max
s.t
Note that I have equality constraints
I need to code this in Matlab in an eficient way for a large-scale problem
  2 件のコメント
Hank
Hank 2019 年 11 月 13 日
Can you share what you've tried?
mohamed Faraj
mohamed Faraj 2019 年 11 月 14 日
I have not coded it yet. I just need a general advice on how to code it. Should I make a mapping from (b,l,n) to a one index variable r_k for example. For example, r_k, k=1,2,......24 or I better use the indexes (b,l,n). I prefer to use the three indexes as my problem is large and it is easier to track if I use the three indexes (b,l,n)

サインインしてコメントする。

回答 (2 件)

Matt J
Matt J 2019 年 11 月 14 日
編集済み: Matt J 2019 年 11 月 14 日
It should be very straightforward using the problem-based solvers in the Optimization Toolbox,
  1 件のコメント
mohamed Faraj
mohamed Faraj 2019 年 11 月 14 日
I have matlab 2013b

サインインしてコメントする。


Matt J
Matt J 2019 年 11 月 14 日
編集済み: Matt J 2019 年 11 月 14 日
I have matlab 2013b
Because the array sizes are fairly small here, the easiest thing might be to use my func2mat submission to express all your summations as matrix multiplications.
For example, a summation of a 4x1x12x12 array along its 3rd dimension can be represented by a matrix A obtained as follows,
z0=rand(4,1,12,12);
A=func2mat(@(z)sum(z,3) , z0);
To convince yourself of the equivalence, you can do
calc1=sum(z0,3);
calc2=A*z0(:);
>> norm(calc2(:)-calc1(:))
ans =
0

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by