Linear Inequality Constraints not satisfied while using the GA. Premaure Convergence of the GA

8 views (last 30 days)
My problem is a large size Mixed integer programming problem with some variables binary and others continuous. My code does not have any non-linear constraints or equality constraints. Still the GA is violating the Linear Inequalty constraints.
My script always return error
Optimization terminated: average change in the penalty fitness value less than options.TolFun
but constraints are not satisfied.
I have tried to implement the code for small size problems but still it violates the constraints. In some cases the ans is very much near to the global optimum value but even less than that for minimisation problem, which is a strict no no.
In other cases it just converges prematurely. I feed the linprog function solution of the problem to the ga as the Feasible Initial population.
Please Suggest me the corrections to be made in the attached code

Answers (1)

Alan Weiss
Alan Weiss on 3 Mar 2016
Your objective function mat_eqn is linear. So why are you trying to use ga instead of intlinprog? In almost every case, intlinprog is faster and more reliable.
Furthermore, your option setting of TolCon = 0 is likely to make your solution procedure fail. Don't give tolerances less than 1e-14 or so.
Alan Weiss
MATLAB mathematical toolbox documentation
  2 Comments
TEEH
TEEH on 4 Mar 2016
I am using GA because MILP problem I am trying to solve is NP hard. So though the problem in code is small scale, the actual testing of code will be on problem having thousands of variables. Thus (theoretically) Intlinprog will take much more time than the GA in solving the problem.
Furthermore, even when i keep TolCon = 1, the constraints are violated. This is always happening on using the Intcon option.
Alan Weiss
Alan Weiss on 4 Mar 2016
ga is not suitable for integer programming when you have more than about 100 variables. Do not even try it, it will fail miserably on thousands of variables.
If you try to solve an MILP using intlinprog and find that it violates constraints, even with all options set to their defaults, then I suggest that you contact technical support. Perhaps you are running into a bug that I don't know about.
In other words, before changing tolerances or any other options, first run your problem with default options. You should not see any errors or constraint violations beyond the defaults. If you do, then contact technical support.
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Products

Community Treasure Hunt

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

Start Hunting!