# Discrete optimization with Genetic Algorithm - help

32 views (last 30 days)
Itachi on 6 Sep 2012
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?!

Alan Weiss on 6 Sep 2012
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

Itachi on 18 Sep 2012
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?
Alan Weiss on 19 Sep 2012
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 on 20 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,