Genetic algorithm constraints/optimization toolbox

2 views (last 30 days)
I'm having a problem with my optimization model on matlab , the truth is my model is pretty complicated with 2 types of variables (x,y) and with 6 variables each (x1,x2,x3,x4,x5,x6) (y1,y2,y3,y4,y5,y6) am trying to solve it through the optimization toolbox in the app section with the use of genetic algorithm but I'm going through some issues
first issue was that I don't know the number of variables to put in the number of variables (I originally put 12 since I have 12 variables 6 for x and 6 for y)
the second issue was how to define both x and y constraints in the linear inequality boxes since I have constraints for both x and y

Answers (1)

Matt J
Matt J on 11 Mar 2020
Edited: Matt J on 11 Mar 2020
You need to write your fitness function and all of your constraints in terms of 12 unknowns. The constraint matrices must be written to multiply with a 12-vector [x(:) ; y(:)] containing both your x and y variables.
However, you may find it easier to write your linear constraints and bounds using the Problem-Based framework, which lets you compose constraints in terms of intuitive symbolic expressions in x and y. You can then convert the symbolic constraints to solver-based matrix form using my recent sbmatrices submission to the File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!