How to code the given below nonlinear constrained optimization problem using genetic algorithm in matlab?
Show older comments
I need to optimize (minimize) the function,
f = (632.7*((x(1)*1000)^1.327)) + (506.16*((x(2)*1000)^1.327))...
+ (759.24*((x(3)*1000)^1.327)) + (253.08*((x(4)*1000)^1.327));
subjected to the following nonlinear constraints:
ceq(1) = (100*0.971014*(x(1)^2.63)/((abs(100 - x(5)))^0.46))...
- (x(5)*((0.971014*(x(1)^2.63)/((abs(100 - x(5)))^0.46))...
+ (1.09536*(x(2)^2.63)/((abs(x(5) - x(6)))^0.46))))...
+ (x(6)*1.09536*(x(2)^2.63)/((abs(x(5) - x(6)))^0.46)) - (2/60);
ceq(2) = (x(5)*1.09536*(x(2)^2.63)/((abs(x(5) - x(6)))^0.46))...
- (x(6)*((0.879969*(x(3)^2.63)/((abs(x(6) - x(7)))^0.46))...
+ (1.09536*(x(2)^2.63)/((abs(x(5) - x(6)))^0.46))))...
+ (x(7)*0.879969*(x(3)^2.63)/((abs(x(6) - x(7)))^0.46)) - (5/60);
ceq(3) = (100*1.592623*(x(4)^2.63)/((abs(100 - x(7)))^0.46))...
- (x(7)*((0.879969*(x(3)^2.63)/((abs(x(6) - x(7)))^0.46))...
+ (1.592623*(x(4)^2.63)/((abs(100 - x(7)))^0.46))))...
+ (x(6)*0.879969*(x(3)^2.63)/((abs(x(6) - x(7)))^0.46))...
- (3/60);
c = [];
number of variables = 7
LB = [0.15 0.15 0.15 0.15 90 90 90];
UB = [1 1 1 1 100 100 100];
There are no linear (equality and inequality) constraints. >>When I used the ga in solver, I got incorrect answers. Kindly help me by providing the coding for this problem.
2 Comments
Torsten
on 4 Nov 2015
Use fmincon instead of ga.
Best wishes
Torsten.
Alan Weiss
on 4 Nov 2015
In addition to what Torsten suggested, allow me to suggest that you mark your question with the {} Code button so that we might be able to read it more easily.
Alan Weiss
MATLAB mathematical toolbox documentation
Answers (1)
If you know the solution that ga() gave you is incorrect, then you must know, approximately at least, what the solution must be. You can use gaoptimset to put that approximate point in the initial population and inform ga's search. You would be well-advised incorporate all prior knowledge that you have into the the initial population somehow, since the problem does look pretty horrible...
There are no linear (equality and inequality) constraints
You might want to add some. Denominator expressions like abs(x(6) - x(7) need to be kept away from zero.
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!