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

조회 수: 4 (최근 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 CenterFile Exchange에서 Data Preprocessing에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by