help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

minimization problem


From: Urs Hackstein
Subject: minimization problem
Date: Mon, 29 Apr 2013 11:08:06 +0200

Hello,

I am dealing with the following minimization problem:

(real(b)-real(dominant2(roots(poly(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))))).^2+(imag(b)-imag(dominant2(roots(poly(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))))).^2

Here b is a complex number and poly(x(1),x(2),x(3),x(4),x(5),x(6),x(7)) is a polynomial of degree 7, parametrized by the seven real parameters x(1),x(2),x(3),x(4),x(5),x(6) and x(7). Note that poly is here not octave's build-in-function poly.m. dominant2 selects the root of the polynomial with the biggest real part. The term should be minimized with respect to 0.5<=x(1),x(2),x(3),x(4),x(5),x(6)<=20 and 5<=x(7)<=200.

I tried to solve this minimization problem using sqp and it runs through in octave version 3.2.4, but no longer in version 3.6.4. Thus my question is whether there are alternatives to sqp solving the problem as fast as sqp. Unfortunately, I have not a good overview over the optimization routines in octave yet.

As a test case, we can take
function poly=poly(la, lb, lc, Ia, Ib, Ic, RC)
poly=[1 la+lb*RC*45*la.^7 lb+lc-RC-3*Ib*Ic Ia*RC+Ib+87*RC Ib*Ic.^3+Ic/(Ia+Ic-la) RC-Ia*Ia*lc la*RC*Ib+Ia*RC la-lb*lc+Ia*Ib/RC+(la.^2*lb*lc-Ia)]
endfunction

My attempt with sqp was the following:

function mini=minimize6(b)
funp6wrap = @(x)funp6(x,[real(b),imag(b)])
y0  = 2*ones(7,1);
lbound = [0.5,0.5,0.5,0.5,0.5,0.5,5]';
ubound = [20,20,20,20,20,20,200]';
mini=sqp (y0,funp6wrap,[],[],lbound,
ubound)
endfunction

function erg=funp6(x,p)
erg=(p(1)-real(dominant2(roots(poly(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))))).^2+(p(2)-imag(dominant2(roots(poly(x(1),x(2),x(3),x(4),x(5),x(6),x(7)))))).^2
endfunction

function domi=dominant2(ns)
anfang=time();
if ( real(ns(1))>=real(ns(2)) & real(ns(1))>=real(ns(3)) & real(ns(1))>=real(ns(4)) & real(ns(1))>=real(ns(5)) & real(ns(1))>=real(ns(6)) & real(ns(1))>=real(ns(7)) )
domi=real(ns(1))+abs(imag(ns(1)))*i
else if (real(ns(2))>=real(ns(1)) & real(ns(2))>=real(ns(3)) & real(ns(2))>=real(ns(4)) & real(ns(2))>=real(ns(5)) & real(ns(2))>=real(ns(6)) & real(ns(2))>=real(ns(7)))
domi=real(ns(2))+abs(imag(ns(2)))*i
else if (real(ns(3))>=real(ns(1)) & real(ns(3))>=real(ns(2)) & real(ns(3))>=real(ns(4)) & real(ns(3))>=real(ns(5)) & real(ns(3))>=real(ns(6)) & real(ns(3))>=real(ns(7)) )
domi=real(ns(3))+abs(imag(ns(3)))*i
else if( real(ns(4))>=real(ns(1)) & real(ns(4))>=real(ns(2)) & real(ns(4))>=real(ns(3)) & real(ns(4))>=real(ns(5)) & real(ns(4))>=real(ns(6)) & real(ns(4))>=real(ns(7)) )
domi=real(ns(4))+abs(imag(ns(4)))*i
else if (real(ns(5))>=real(ns(1)) & real(ns(5))>=real(ns(2)) & real(ns(5))>=real(ns(3)) & real(ns(5))>=real(ns(4)) & real(ns(5))>=real(ns(6)) & real(ns(5))>=real(ns(7)) )
domi=real(ns(5))+abs(imag(ns(5)))*i
else if (real(ns(6))>=real(ns(1)) & real(ns(6))>=real(ns(2)) & real(ns(6))>=real(ns(3)) & real(ns(6))>=real(ns(4)) & real(ns(6))>=real(ns(5)) & real(ns(6))>=real(ns(7)) )
domi=real(ns(6))+abs(imag(ns(6)))*i
else if ( real(ns(7))>=real(ns(1)) & real(ns(7))>=real(ns(2)) & real(ns(7))>=real(ns(3)) & real(ns(7))>=real(ns(4)) & real(ns(7))>=real(ns(5)) & real(ns(7))>=real(ns(6)))
domi=real(ns(7))+abs(imag(ns(7)))*i
endif
endif
endif
endif
endif
endif
endif
ende=time();
ende-anfang;
endfunction

Thanks a lot in advance!

reply via email to

[Prev in Thread] Current Thread [Next in Thread]