How I create a non-equal restriction for GA problem?

4 ビュー (過去 30 日間)
Gustavo Leal
Gustavo Leal 2017 年 12 月 3 日
回答済み: John D'Errico 2017 年 12 月 3 日
How to say for matlab that all elements in a vector must be different? I need to make a restriction for a GA problem, like V = [x1 x2 x3 x4], and x1~=x2,x3,x4, x2~=x3,x4, x3~=x4;

回答 (1 件)

John D'Errico
John D'Errico 2017 年 12 月 3 日
Essentially, you cannot. Or constraints are not an option for any optimizer, including GA, thus x1>x2 OR x1<x2. And you cannot have strict inequalities anyway.
Are these integers?
Could you require that the x_i are sorted, thus something like:
x1 + tol <= x2
x2 + tol <= x3
x3 + tol <= x4?
Yes, somebody will probably tell you to use a constraint like
abs(x1 - x2) >= tol
etc.
It might even work, SOME of the time, IF you used good starting values. But it will certainly create a problem with multiple local minima, ABSOLUTELY necessitating good starting values.

カテゴリ

Help Center および File ExchangeQuadratic Programming and Cone Programming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by