forum.alglib.net

ALGLIB forum
It is currently Thu Mar 28, 2024 8:58 am

All times are UTC


Forum rules


1. This forum can be used for discussion of both ALGLIB-related and general numerical analysis questions
2. This forum is English-only - postings in other languages will be removed.



Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: minlmoptimize in commercial edition
PostPosted: Wed Nov 22, 2017 10:35 pm 
Offline

Joined: Wed Nov 22, 2017 10:30 pm
Posts: 4
I use in my program the function of minlmoptimize. Will there be an acceleration of the performance of this function when buying a commercial library edition (multithreaded version with "smp_" prefix)?


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 9:24 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
In minlm - no multithreading. Optimization is inherently sequential, so it is very hard to parallelize. In ALGLIB 3.14 we will introduce more fine-grained parallelism, but still optimization is a tricky.

However, on large-scale problems you may get speed-up from utilizing high performance linear algebra kernels (Intel MKL). Two questions: a) do you use C++ or C#? b) how many variables do you have?


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 9:53 am 
Offline

Joined: Wed Nov 22, 2017 10:30 pm
Posts: 4
Sergey.Bochkanov wrote:
Two questions: a) do you use C++ or C#? b) how many variables do you have?

a) C++
b) The number of variables is from 3 to 12


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 10:13 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
It is quite small-scale problem. So, both commercial and open source versions should have similar performance.

By the way, about performance - what is running time for LM? Is it fast or not?


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 10:25 am 
Offline

Joined: Wed Nov 22, 2017 10:30 pm
Posts: 4
Sergey.Bochkanov wrote:
By the way, about performance - what is running time for LM? Is it fast or not?

For simple models with 3 parameters and a total number of approximations 50, the speed of the function is about 280 ms. In this case, for each approximation, a model function is performed for each of the 100 points of the curve.


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 11:58 am 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
1. 280 ms for 50 runs of algorithm... not 100% sure, but sounds like a bit more than expected. Did you set scale of the variables with minlmsetscale()?
2. Do you provide derivatives? Or you let algorithm calculate them numerically?
3. How many iterations algorithm performs? (Optimization report has iteration counter)

If you need parallel speed-up, you can perform these independent approximations in parallel. ALGLIB is thread-safe, so if you create N independent instances of the optimizer, they will work correctly when used from N threads.


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 12:10 pm 
Offline

Joined: Wed Nov 22, 2017 10:30 pm
Posts: 4
Sergey.Bochkanov wrote:
1. 280 ms for 50 runs of algorithm... not 100% sure, but sounds like a bit more than expected. Did you set scale of the variables with minlmsetscale()?
2. Do you provide derivatives? Or you let algorithm calculate them numerically?
3. How many iterations algorithm performs? (Optimization report has iteration counter)

1. Yes, I specify the boundaries of each variable using the function minlmsetscale, Ymin = 0.1*Y, Ymax=10*Y
2. 10 iterations are performed with accuracy 0.01
Source code for the function minlmoptimize:
Code:
   minlmcreatev(NT, x, 0.01, state);
   minlmsetbc(state, bndl, bndu);
   minlmsetscale(state, scale);
   minlmsetcond(state, epsg, epsf, epsx, maxits);
   minlmsetxrep(state, true);

   minlmoptimize(state, ThreadFitFunction, UpdateFunctionPtr, this);
   minlmresults(state, x, rep);


Top
 Profile  
 
 Post subject: Re: minlmoptimize in commercial edition
PostPosted: Thu Nov 23, 2017 12:22 pm 
Offline
Site Admin

Joined: Fri May 07, 2010 7:06 am
Posts: 903
I feel that significant amount of time is spent in numerical differentiation. 12 additional evaluations per step (3 vars, 4-point formula). You may get up to 10x speed-up if you calculate derivatives yourself.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 52 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group