Is there a way to reduce execution time of the following because it took 6 hours and still is executing?

3 ビュー (過去 30 日間)
I have attached a file 'main.m'. I started to run main.m at 1:50pm today and still its going on executing and I don't know when will it stop its execution? So, is there a way to reduce its execution time so that instead of taking too much time it is complted in less time?
  1 件のコメント
Jan
Jan 2023 年 2 月 20 日
Use the profiler to find the bottleneck. If it is the exp() calculation, an acceleration might be possible. But it is not worth to try it before clarifying, if a relevant amount of time is spent there.

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

回答 (1 件)

Torsten
Torsten 2023 年 2 月 20 日
編集済み: Torsten 2023 年 2 月 20 日
Are you sure you can use "ga" with stochastic inputs that change from iteration to iteration ? I doubt it.
Look up "stochastic optimization" instead.
  26 件のコメント
Sadiq Akbar
Sadiq Akbar 2023 年 2 月 25 日
Thanks a lot for your kind response dear Walter Roberson. Actually 'GA' generates its random population of vectors having the same size as u.And then it sends each member of that generated population to the function 'Vectorized.m' .So, we don't know in advance each memebr. That's why we re-arrange them inside the function 'Vectorized.m'. Further, I am not talking about lb and ub. They are passed as they are.No problem in that. I am re-stating that it is the generated vector by GA whose order (i.e., arrangement of elements) is some times different and some time same as u (not lb or ub). However, what you are saying is beyond my understanding. If you can do it, then please do it for me.
If you need random values that match in order with what is in u : Yes, I want that but I don't want to generate it myself. I am interested in those values which are gnerated by GA itself.
which is the requirement that the b entries are in increasing order and so matching the now-sorted u values: Here you are misunderstanding it. The values of u are not in increasing order. These values may be any real number like:
u=[-34, 34, -50, 50, -45, 45, -65, 65];
u=[3, 4, 0, 5, -4, 5, -5, 6];
u=[0, 4, -5, 0, -45, 59, -65, 65];
u=[1,, 2, 0, 5, -4, 45, 5, 15];
etc.
What I want?
I want that whatever values are put in vector u, the same values or nearly the same values and in the same arrangement should be returned by GA to me.
Walter Roberson
Walter Roberson 2023 年 2 月 25 日
Okay, go ahead and do that. Be advised that your approach is likely to have poor performance. But if you need your code to be written that way in order for you to understand it, then go with it.

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

カテゴリ

Help Center および File ExchangeData Preprocessing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by