[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Optimization in Octave
From: |
Julien Bect |
Subject: |
Re: Optimization in Octave |
Date: |
Wed, 12 Mar 2014 17:19:03 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 |
On 12/03/2014 16:03, Urs Hackstein wrote:
Dear Julien, thanks a lot for your detailed explanations. I just
started to check them. F->-F doesn't work better. A better starting
point improves the result, but I don't know how to choose the
appropriate starting point. I assumed that our problem has local
optima, but I can't prove it.
Then let's assume that your problem has local optima => you need
something "less local" than sqp.
The simplest than you can do is use a "random start" approach : use a
local solver (e.g., sqp) repeatedly from random starting points.
This is very easy to implement with a for loop around the code that you
already have written :
x_opt = [];
obj_opt = Inf;
n_try = 100;
for i = 1:n_try,
lbound = [0.5,0.5,0.5,0.5,5]';
ubound = [20,20,20,20,200]';
x_init = lbound + (lbound - ubound) .* rand (5, 1);
F=@(x)(real(p(x(1),x(2),x(3),x(4),x(5))));
G=@(x)(imag(p(x(1),x(2),x(3),x(4),x(5)))-b);
h=@(x) (1.85.*x(1:2,1) - x(3:4,1))
[x, obj] = sqp(x_init,F,G,h,lbound,ubound,500)
if obj < obj_opt,
x_opt = x;
obj_opt = obj
endif
endfor
If your problem is very difficult you might have to increase n_try, of
course.