|
"sparky" wrote in message <k0k3gc$qcp$1@newscl01ah.mathworks.com>...
> Hi,
> I am trying to use GA, fmincon for optimization.
[snip]
> i.e. if J(1) is the value of J calculated in the first iteration, then I want to change my objective function to "R" where R(i)= J(i)/ J(1) for the "i"th iteration.
[snip]
The algorithm you suggest should work. Obviously, when you call fmincon, you have an initial seed value. Call this initial seed value b0.
Now, before you run fmincon, call your optimization function 'opt' at this initial value and save the result. Next, define an anonymous function that calls 'opt' as usual but then scales any outputs by that initial value. Finally, call fmincon using your scaled function. Haven't tried it, but I think this should even work if your function 'opt' generates a gradient.
b0 = 0; % Initial seed value
J1 = opt(parameters, b0); % Initial value
R = @(b)opt(parameters,b) / J1; % New, scaled objective function
fmincon( R , ..., 'tolx',1e-3,...)
|