How do I write inequality constraints within NSGA-II

2 views (last 30 days)
Lily McIvor
Lily McIvor on 14 Jun 2021
Answered: Abhishek Gupta on 17 Jun 2021
i need to add the constraint 1<x< 3 to my objectve functinos but dont know how to write it

Answers (1)

Abhishek Gupta
Abhishek Gupta on 17 Jun 2021
As per my understanding, you want to add a constraint to your function. You can do the same using "if, elseif, else" as follows: -
function my_objective()
if (1<=x) && (x<=3)


Community Treasure Hunt

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

Start Hunting!