Discrete optimization with Genetic Algorithm - help

Hi again, I have trouble carrying out this optimization procedure. I know that I should use penalty functions when I have a constrained problem. Does MATLAB implement any penalty? Is there any example on this method?!

 Accepted Answer

The documentation deals with nonlinear inequality constraints. The underlying algorithm for the nonlinear constraint solver uses penalty functions, but you don't have to do anything special, such as write your own penalty.
Alan Weiss
MATLAB mathematical toolbox documentation

9 Comments

Thanks, But mixed integer optimization deals with integer values, I want want GA to find the optimum among values like [1.2 , 1.5 , ...]. Is it possible?
There are several ways to make integer ga use discrete values. If you want values that are any decimal value to one point, such as 1.2, 1.5, etc, just make your variable x take integer values, and divide it by 10.
If instead you have some discrete values a(1),...,a(n) that you want to sample, let x take integer values, and use a(x) as your variables. Be sure to bound x between 1 and n. This is an example using that technique.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
Itachi
Itachi on 7 Sep 2012
Edited: Itachi on 13 Sep 2012
Thanks, What should I do if I had linear equality constraints? Because I have to insert coefficients of x in "A". please help me out, thanks in advance.
There is documentation on dealing with equality constraints. That's all I can tell you.
Alan Weiss
MATLAB mathematical toolbox documentation
Itachi
Itachi on 13 Sep 2012
Edited: Itachi on 13 Sep 2012
I'm very sorry, I meant linear inequality constraints, please help me out.
I'm sorry, I do not understand what you are asking. There is plenty of documentation on including linear inequality constraints. What is it that you are trying to do that you are unable to?
Alan Weiss
MATLAB mathematical toolbox documentation
Hi again, thanks for your answer. As you said earlier I have some discrete values a(1),...,a(n) that I want to sample, x taking integer values, and using a(x) as my variables. But for linear inequality constraints how should I do that?
Again, I do not understand you. Sorry.
Perhaps you have a linear constraint in the variables a(x). You can write that as a nonlinear inequality constraint.
Perhaps you have a linear constraint in x. You can use the A, b matrices to represent that constraint.
You might mean something else. In that case, feel free to ask again, but I am afraid we are not communicating well.
Alan Weiss
MATLAB mathematical toolbox documentation
Itachi
Itachi on 20 Sep 2012
Edited: Itachi on 22 Sep 2012
Hi again, thank you so much. I had linear inequality constraint in the variables a(x).So by writing them in nonlinear inequality constraint I can fix this.
Best regards,

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!