How can I NOT specify the constraint function in the ga function?

조회 수: 1 (최근 30일)
Riccardo Andreoni
Riccardo Andreoni 2019년 7월 6일
댓글: Matt J 2020년 5월 8일
I'm trying to use the genetic algorithm function ga, which requires the following inputs:
x = ga(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,options)
I need to specify some options, but I don't have any non linear constraint function, so I need to leave the input nonlcon "empty".
How can I do that?
Thank you
  댓글 수: 1
infinity
infinity 2019년 7월 6일
Hello,
You can read instruction of using ga function as follows link
There are several options that you could adapt with your situation. For example, if you don't have nonlinear constrains, you may choose one of them:
x = ga(fun,nvars,A,b) finds a local minimum x to fun, subject to the linear inequalities A*xb. ga evaluates the matrix product A*x as if x is transposed (A*x').
x = ga(fun,nvars,A,b,Aeq,beq) finds a local minimum x to fun, subject to the linear equalities Aeq*x = beq and A*xb. (Set A=[] and b=[] if no linear inequalities exist.) ga evaluates the matrix product Aeq*x as if x is transposed (Aeq*x').
x = ga(fun,nvars,A,b,Aeq,beq,lb,ub) defines a set of lower and upper bounds on the design variables, x, so that a solution is found in the range lb x ub. (Set Aeq=[] and beq=[] if no linear equalities exist.)

댓글을 달려면 로그인하십시오.

답변 (1개)

Matt J
Matt J 2019년 7월 6일
편집: Matt J 2019년 7월 6일
Any of the constraint arguments can be left empty to signify to ga that there are no constraints of that type, e.g.,
x = ga(fun,nvars,A,b,[],[],lb,[],[],options)
  댓글 수: 4
Charles Uko
Charles Uko 2020년 5월 7일
How can one specify linear constraints? it seems like the GA only allow options for non-linear constraints

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Genetic Algorithm에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by