The Starting Point (Vector) generated by Genetic Algorithm doesn't satisfy the nonlinear constraint, why?
1 view (last 30 days)
Show older comments
Sabrina Langer
on 11 Dec 2014
Edited: Sabrina Langer
on 12 Dec 2014
Identification of 57 unknow parameter: (I'm using Matlab R2014a)
I have two series of measurement Gm and Vm as a function of wm . Both functions are characterised by the same 57 unknow parameter.
I want to generate a good starting vector with the 57 unknow parameter so that the sum of squares logarithmic
f= sum((log(G(wm))-log(Gm)).^2+10*(log(V(wm))-log(Vm)).^2);
becomes minimal.
-
- There are specific bounds for the parameters
Ginf= x(1); %[0;1]
gi= [x(2:(length(x)-1)/2 +1)]; %[0;1]
taui = [x((length(x)-1)/2 +2:length(x))]; %[0,1E+10]
G0= [Ginf/(1-sum(gi))]; %[in this case >922,15]
-
- And the nonlinear constraint mycon is (what is really important otherwise the G0 is getting negativ)
sum(gi)<1
-
-
My problem is that the nonlinear constraint isn't always statisfied . I tried to change the bounds, so that the sum(gi)is smaller than 1 and I also tried sum(gi)<0.25, but still I'm getting a lot of G0 s, which are negativ. In addition the GA isn't working really efficiently.
-
Also I was wondering about:
- rng(0, 'twister'); the reproducibility. How it works with entering there another number than 0?
- What are good settings for the options of the GA - TolFun, PopulationSize, Generations, ...?
-
See attached the matlab files with the code.
-
I never have programmed a GA, so it would be really great if somebody can help me with this problem. Thank you!
0 Comments
Accepted Answer
Alan Weiss
on 11 Dec 2014
Edited: Alan Weiss
on 11 Dec 2014
You might have better luck by turning your nonlinear constraint into a linear constraint. The constraint
sum(gi) <= 1
is a linear inequality constraint in the parlance of MATLAB solvers. I am assuming that the gi are decision variables, the ones you called Gm. For linear inequality constraints, ga is a strictly feasible solver, meaning it generates only feasible points. But it does regard its inequalities as not being strict, so you might want to make the inequality
sum(gi) <= 1-ep
where ep is a small number such as 1e-6.
Also, make sure to place bounds on your variables as a vector. If all the variables are supposed to be positive, use
lb = zeros(57,1);
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
0 Comments
More Answers (1)
Sean de Wolski
on 11 Dec 2014
The ga solver may not generate points that are feasible with regard to the nonlinear constraints. This doc page explains how it works:
4 Comments
See Also
Categories
Find more on Genetic Algorithm in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!