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

1 visualizzazione (ultimi 30 giorni)
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;

Risposte (1)

John D'Errico
John D'Errico il 3 Dic 2017
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.

Categorie

Scopri di più su Get Started with Optimization Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by