Python Forum
Improve the velocity of the minimization
Thread Rating:
  • 2 Vote(s) - 2.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Improve the velocity of the minimization
#1
Hi guys,

I'm using Python to do the inversion of a problem with many variables. The number of variables changes with the desired model, in some cases can be 4 in others 40. Basically my code has a objective function that I want to minimize. This function calls another function to calculate the desired model and use the results to calculate the mean squared residual.

At this moment I already tried the "particle swarm optimization (pso)", and the "optimize.fmin_l_bfgs_b". Here's an example that I use to call these algorithms:   

xopt, fopt = pso(fobjB, lb, ub, dim)
In this example I used pso. The "xopt" is the array with the exit model, "fopt" the value of the adjust, "fobjB" my object function, "lb" and "ub" are the lower and upper bounds and "dim" the dimension size of my problem.

results = optimize.fmin_l_bfgs_b(fobjB, kick, mybounds, approx_grad=1)
In this second exemple I used a gradient algorithm based. The "kick" is an aleatory array with initial values.

The problem is that after 20 variables, these routines are slow to reach the convergence. I realize that only 20% of my cpu is in use during the execution of my program. Can you give me some tips to how improve the use of my cpu and try to run my code faster? I know that's not an easy question, but some tips about improvements in minimization problems can be great !!! Thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Plotting streamlines of the velocity field within an ice sheet verhaegenyoni 1 352 Mar-23-2024, 10:09 PM
Last Post: verhaegenyoni
  Lidar in python - Quaternions, Angular Velocity, Linear Accelleration? jttolleson 2 500 Nov-27-2023, 02:05 AM
Last Post: jttolleson
  Want to create my own version of Notational Velocity FrankHuell123 3 3,088 May-25-2018, 10:45 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020