MATLAB: In optimization toolbox, in function “gamultiobj” how to define ConstraintFile.m function in which constraints are not functions of design variables. This facility is available in “ga” under “nonlin”.
gagamultiobjnonlin
ga(fitnessfsn,…….lb,ub,nonlin,options)
gamultiobj(fitnessfsn,…….lb,ub,options)
Best Answer
If the constraints are not functions of design variables, then how are they constraints?
gamultiobj gained the ability to use nonlinear constraints in R2014b, as you can see in therelease notes.
The first 9 arguments for gamultiobj() are the same as the first 9 arguments for ga(). (The 10th argument for ga() is different.) This includes the nonlinear constraint function.
If you are using some kind of visual tool to generate code, then if you need to you could configure it with ga and nonlinear constraints, and then you could edit the code to change ga() to gamultiobj()
In general, ga is not as reliable a solver as fmincon. So if you have smooth objective and constraints, you should use fmincon. See Table for Choosing a Solver.
Best Answer