Failure in initial user-supplied nonlinear constraint function evaluation

9 Ansichten (letzte 30 Tage)
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.

Akzeptierte Antwort

Matt J
Matt J am 23 Jul. 2021
Bearbeitet: Matt J am 23 Jul. 2021
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 Kommentare
ugur simsek
ugur simsek am 23 Jul. 2021
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 am 23 Jul. 2021
Bearbeitet: Matt J am 23 Jul. 2021
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

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Get Started with Optimization Toolbox finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2018a

Community Treasure Hunt

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

Start Hunting!

Translated by