CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

optimisation

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   April 21, 2005, 08:25
Default optimisation
  #1
allan
Guest
 
Posts: n/a
Hi

I need a bit of help please, I need to minimize the following function:

a(sin(theta)+cos(theta))+b(sin(2*theta)+cos(2*thet a))+ c(sin(3*theta)+cos(3*theta))+ ....

up to 100 terms.

a, b, c etc are known and interchangable. Theta is known.

Any help would be greatly appreciated.

Thanks in advance.

allan
  Reply With Quote

Old   April 21, 2005, 12:15
Default Re: optimisation
  #2
ag
Guest
 
Posts: n/a
If a, b, c, and theta are all known there are no free parameters to minimize on.
  Reply With Quote

Old   April 21, 2005, 15:58
Default Re: optimisation
  #3
Adrin Gharakhani
Guest
 
Posts: n/a
Perhaps optimization means reduced computational cost in this context. In that case, it appears to me that one possibility is to perform a series expansion of sin() and cos() functions to a desired level of accuracy and collect like terms in terms of polynomial orders (use nested multiplication for the series, not exponentiation). Some preliminary work is needed, of course.

Another possibility might be to use tables for the functions.

Either way, the performance will depend greatly on the capability of the compiler used - some compilers do an excellent job of optimizing math functions (to the point of providing the best possible performance, in which case there is nothing one can do)

Adrin Gharakhani
  Reply With Quote

Old   April 22, 2005, 04:43
Default Re: optimisation
  #4
allan
Guest
 
Posts: n/a
Sorry, I've not made myself clear. The letters a,b,c etc have different values and can be attached to any one of the (sin(theta) + cos(theta)) terms. What I am looking for is a method that will allow me to quickly determine the minimum value of this function rather than going through each combination i.e. 3 factors have 9 combinations. I will have at least 64 factors which corresponds to 64^64 combinations, which would take a while to calculate the value of every combination to determine the minimum.

Thanks for your response.

allan
  Reply With Quote

Old   April 22, 2005, 13:10
Default Re: optimisation
  #5
ag
Guest
 
Posts: n/a
Do you have any constraints on possible values of (a,b,c,...)? For example, if (a,b,c,...) >= 0, then you could possibly use a double sort. Compute the sinusoids and sort the values from largest to smallest. If any of the values are negative, then sort (a,b,c,..) from smallest to largest and multiply the largest value with the most negative sinusoid. If none of the sinusoids are negative then sort the (a,b,c,...) from largest to smallest and multiply the smallest sinusoid by the smallest value of (a,b,c,...). You'd have to work out the details but that may be one way of solving your problem.
  Reply With Quote

Old   April 22, 2005, 22:13
Default Re: optimisation
  #6
diaw
Guest
 
Posts: n/a
Looks like a Fourier infinite series expansion to me...

If so, the a,b,c terms are the Fourier Coefficients derived for the function f(theta) you are evaluating...

diaw...
  Reply With Quote

Old   April 24, 2005, 19:20
Default Re: optimisation
  #7
zxaar
Guest
 
Posts: n/a
and since calculatiing sins and coss are time consuming sometime its better to create tables for them and then use them rather than calculating them again and again.
  Reply With Quote

Old   April 25, 2005, 02:00
Default Re: optimisation
  #8
diaw
Guest
 
Posts: n/a
Step back & look at the 'big picture'... What do lots of sines & cosines tell you?

diaw...
  Reply With Quote

Old   April 25, 2005, 03:21
Default Re: optimisation
  #9
Adrin Gharakhani
Guest
 
Posts: n/a
Well, evaluating sin() and cos() isn't really the issue here. But if it were , the cost could be (almost) halved using the following:

sin(alpha)+cos(alpha)=sqrt(2)*sin(alpha+Pi/4)=sqrt(2)*cos(alpha-Pi/4)

Adrin Gharakhani
  Reply With Quote

Old   April 25, 2005, 06:20
Default Re: optimisation
  #10
zxaar
Guest
 
Posts: n/a
yaa i agree with you that this is really not a issue here, and i feel that the solution suggested by ag is best for the problem he mentioned.

i mentioned that becuae i was reading about efficiency of code someone had to write for a commercial software and he could speed up his code by storing sin and cos, so i was just trying to hint, we never know what thing could be useful.
  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2D airfoil optimisation: the mesh Marta Main CFD Forum 5 February 6, 2008 01:07
Wing Optimisation Miqdad FLUENT 3 October 14, 2005 09:12
Optimisation tools on Fluent? steve Main CFD Forum 2 July 4, 2004 17:22
Design Optimisation Abhinav Sona Main CFD Forum 5 June 30, 2004 11:13
Optimisation Peter Main CFD Forum 1 October 15, 2002 04:43


All times are GMT -4. The time now is 18:34.