How can I add constraint on variable in genetic algorithm which can take both discrete and continuous values.

4 ビュー (過去 30 日間)
Hi everyone,
I am trying to solve an optimization problem using genetic algorithm. I am using the standard function "ga" for this. In the problem, the decision variable can take both discrete and continous values.
For example: Let a be the decision variable, it can take following values
a = {0, 1, 2, 6, 7,} and 45 <= a <= 85.
How can I represent this in [lb <= a <= ub]?
  2 件のコメント
Sky Sartorius
Sky Sartorius 2020 年 2 月 25 日
Can you tell us more about the application? Does this decision variable represent anything physical in the real world?
Himanshu Nagpal
Himanshu Nagpal 2020 年 2 月 25 日
yes it does. It is the total head of a pump station, which can be zero when pump is not operating otherwise between 45 to 85.
Let me rephrase the propblem this way,
minimize
subject to
How do I formulate this problem using ga?

サインインしてコメントする。

採用された回答

Alan Weiss
Alan Weiss 2020 年 2 月 25 日
You can represent this 0-or-in-a-range type of constraint by using an auxiliary variable. Suppose that your variable z can be in the continuous range [1,2] or else it can be zero (this is perfectly general by scaling the range). Set y = 0 means the variable is 0, or y = 1 means the variable is in its range. Then take y as an integer binary variable and x = y*z and minimize f(x).
Alan Weiss
MATLAB mathematical toolbox documentation

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGenetic Algorithm についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by