Failure in initial user-supplied nonlinear constraint function evaluation

Hi,
Basically, objective value is determined by Ansys analyses and the constraint function is dependent to a special sum
of x values. But, the initial value of constraint function can not be calculated. Can anyone point me about the problem? I attached the matlab file
and error message below.
Thank you
Error using ga (line 393)
Not enough input arguments.
Error in run_script (line 27)
[x,fval,output,population,exitflag] = ga(ObjectiveFunction,nvars,...
Caused by:
Failure in initial user-supplied nonlinear constraint function evaluation.

 採用された回答

Matt J
Matt J 2021 年 7 月 23 日
編集済み: Matt J 2021 年 7 月 23 日
One problem:
nonlcon = @simple_constraint;
There is no function called 'simple_constraint' in your attached script. There is a function called 'simple_const' which is never used.

4 件のコメント

ugur simsek
ugur simsek 2021 年 7 月 23 日
Thank you Matt, I fixed it, but unfortunately I get same error. Probably, I forgot it when I was debugging.
Matt J
Matt J 2021 年 7 月 23 日
Well, the error message says you are not giving simple_constraint (whatever it is) enough input arguments so you should check to see what inputs it expects.
ugur simsek
ugur simsek 2021 年 7 月 23 日
It needs only integer variables as input assigned by the GA.Then this simple constraint function converts them a value. I could not understand why constraint function can not take the variables.
Matt J
Matt J 2021 年 7 月 23 日
編集済み: Matt J 2021 年 7 月 23 日
ga() will try to pass a single vector argument to your constraint function (and nothing else). Your constraint function needs to be prepared for that

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File Exchange で Get Started with Optimization Toolbox についてさらに検索

製品

リリース

R2018a

タグ

質問済み:

2021 年 7 月 23 日

編集済み:

2021 年 7 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by