How can I avoid trivial solution (norm(x) =0) for binary ga optimization?

Hi, I'm trying to do an optimization using binary ga and after 25 hours of processing, the best result of the algorithm was the trivial solution. How can I insert a constraint for norm(x)=0?

 Accepted Answer

If you have a vector of unknowns x(i) with each x(i) = 0 or 1, then include a linear constraint:
A*x <= -1
where A is a row vector of negative ones.
Alan Weiss
MATLAB mathematical toolbox documentation

3 Comments

Dear Alan,
Unfortunately, binary ga doesn't allow constraints.
I'll associate null solution with high value to avoid its choice. Thank you very much!
Perhaps you are using the bitstring data type. Indeed, this data type does not allow for constraints.
However, you can formulate the problem for binary GA by using mixed integer optimization, and setting lower bounds of 0 and upper bounds of 1. You can use linear inequality constraints with mixed integer GA.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

More Answers (0)

Categories

Community Treasure Hunt

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

Start Hunting!