Effacer les filtres
Effacer les filtres

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

1 vue (au cours des 30 derniers jours)
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 commentaire
Jan le 20 Fév 2023
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.

Connectez-vous pour commenter.

Réponses (1)

Torsten le 20 Fév 2023
Modifié(e) : Torsten le 20 Fév 2023
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 commentaires
Sadiq Akbar
Sadiq Akbar le 25 Fév 2023
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];
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 le 25 Fév 2023
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.

Connectez-vous pour commenter.

Community Treasure Hunt

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

Start Hunting!

Translated by