comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Optimization "AMOEBA"
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Optimization "AMOEBA" [message #68029 is a reply to message #68024] Wed, 23 September 2009 06:41 Go to previous messageGo to previous message
Wout De Nolf is currently offline  Wout De Nolf
Messages: 194
Registered: October 2008
Senior Member
On Wed, 23 Sep 2009 04:49:42 -0700 (PDT), Jeremy Bailin
<astroconst@gmail.com> wrote:

> I seem to remember Craig mentioning that implementing a constraint
> using a brick wall like that can give you problems.


Yes, for non-linear least squares refinement. See CONSTRAINT in code
below.



FUNCTION CONSTRAINT,Pin
; P must be with ]P0-dP,P0+dP[
COMMON FUNC_XY, P0, dP
return,P0+2*dP/!pi*atan(Pin)
END

FUNCTION FUNC, Pin, NOCONSTR=NOCONSTR

; NOCONSTR is just for plotting
if keyword_set(NOCONSTR) then P=Pin $
else P=CONSTRAINT(Pin)

z=120.0
N_rows=3.0
d_fov=67
mu=438.689
R_tot=1.5
a_max=30
N=P[1]
R_i=P[0]
;a_max=P[2]

x=N*tan(a_max/2.0*!pi/180.0)*1.1/N_rows/!pi-1.0

a=2.0*asin((1.0/x+1.0)*d_fov/2/z)*180/!pi

d=sqrt(R_tot^2-x^2*(R_i)^2)/(x+1)-alog(2)/mu*tan(a/2*!pi/180 )

S=N*(1+x)^2/16/x^2/z^2*(d^2+2/mu*d*tan(a/2*!pi/180)+2/mu^2*( tan(a/2*!pi/180))^2)*100

if ~finite(s) then stop
RETURN, -S

END

pro test34

COMMON FUNC_XY, P0, dP
P0=[0.3, 60]
dP=[0.5,15]

R=AMOEBA(1.0e-5,SCALE=dP, P0=P0, FUNCTION_VALUE=fval)
if r[0] eq -1 then begin
print,'No minimum found.'
return
endif
xmax=CONSTRAINT(r[0:1])
ymax=-fval[0]
PRINT, 'x_Value:', xmax
PRINT, 'maximum:', ymax

; Plot
n=200
L=P0-dP
H=P0+dP
inc1=(2*dP[0])/n
inc2=(2*dP[1])/n
b1=L[0]
b2=L[1]

x=b1+inc1*indgen(n)
y=b2+inc2*indgen(n)
z=fltarr(n,n)
for i=0,n-1 do $
for j=0,n-1 do $
z[i,j]=-func([x[i],y[j]],/NOCONSTR)

isurface,z,x,y
end
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLDE and java crashes
Next Topic: Nearest neighbors

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:17:41 PDT 2025

Total time taken to generate the page: 0.00474 seconds