フィルターのクリア

Optimization Toolbox Genetic algorithm

2 ビュー (過去 30 日間)
Azime Beyza Ari
Azime Beyza Ari 2022 年 3 月 13 日
コメント済み: Azime Beyza Ari 2022 年 3 月 14 日
hello everyone, I am currently working on a maximum coverage problem and i would like to solve it with genetic algorithm solver. But i am having trouble. I am using live editor and in the parameters and data section i calculated some values that i want to use in my objective function. In the same page i have objective function space where i can write my function. But the values i previously calculated in the data section is seem to be not recognized by the function below. So any suggestions on how to solve this problem?
thank you in advance.

採用された回答

Benjamin Thompson
Benjamin Thompson 2022 年 3 月 13 日
The Live Editor has diferent types of "Run" functions. You probably want "Run" all instread of running a single section. Or if you are talking about the input controls like a slider, right click each control and make sure the options match your requirements. There are usually some options like when the control value changes does it just run the current section, the current section and everything after, or curren section and everything before. If you can post the code that would help give a better answer.
  11 件のコメント
Benjamin Thompson
Benjamin Thompson 2022 年 3 月 14 日
It does not look like the Optimize task for Live Editor is meant for matrix-valued inputs. It does not generate anything for the lb lower bound argument to ga other than zeros(V, 1). And if you try setting V to 36x36 to make the problem two-dimensional the call to zeros fails.
Maybe you leave xij as a 1296x1 vector as the input to objectivefunct and in objectivefunct you convert to a temporary 36x36 matrix for your calculation, like this:
function z = objectivefunct(ai, rij,xij)
temp = reshape(xij,36,36);
for i = 1:36
for j = 1:36
z = (-1)*(ai(i,1)*temp(i,j)*rij(i,j));
end
end
end
This seem to run and do something at least. Hopefully it is doing what you want.
Azime Beyza Ari
Azime Beyza Ari 2022 年 3 月 14 日
Thank you very very much for your time!! I will Try it.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by