How to use minlp with non analytic optimization function

3 views (last 30 days)
Im trying to formulate an optimization problem that minimizes the total passengers time of passengers on buses.
My objective function Z=f(x) in non linear and not analytical, in such that it changes every loop.
I have 72 decision variables (x), 48 are continous and 24 are binary.
I think that minlp is the best method to use here, but I cannot set the optimization function.
Opt = opti('fun',function2optimize,'ineq',A,b,'bounds',min_b_val,max_b_val,...
'xtype',xtype);
My function2optimize contains a lot of calculations and in the final part of its there is the formulation of Z.
My question is how to set the function2optimize? I have wrote:
function2optimize = @ (Z) but have the error:
??? Error: File: function2Optimize.m Line: 1 Column: 27
Expression or statement is incomplete or incorrect.
Thanks a lot,
Hend

Answers (3)

Alan Weiss
Alan Weiss on 30 Apr 2015
I am not sure what you are asking. The only MATLAB solver I know for MINLP problems is ga from Global Optimization Toolbox. Use the Mixed Integer Optimization documentation to guide you in setting up the problem.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

hend ma
hend ma on 26 May 2015
Edited: Walter Roberson on 5 Jun 2015
Thanks a lot Alan for answering me.
My problem has 27 varibles, when the variables 19..27 are binary (0/1).
In addition, I have constraints like x(10)<=x(19), x(11)<=x(20).. x(18)<=x(27). And constraints for the binary variables like: x(19)+x(24)>=1.
I tried to use the ga for solving my mixed integer problem, but I found that the result is always with 1 for all the binary variables, and the matlab did not consider the constraints. because when I tried to fix the binary variables to 0, the values of x(10)..x(18) was bigger than zero (despite the constraints x(10)<x(19) and so).
I read the help of matlab for ga with mixed integer variables and found that I have to put 'PopulationType','doubleVector' in the options of gaoptimset, but it did not help.
Thanks a lot
Hend

Alan Weiss
Alan Weiss on 26 May 2015
You did not state how you included the constraints such as
x(10) <= x(19);
I hope you used linear inequality matrices and not nonlinear constraints.
I do not understand what you mean when you say "the matlab did not consider the constraints." I can assure you that, if you formulate your problem properly, solvers generally return feasible solutions, and warn you if they do not find feasible points.
For more help you will have to be more explicit in describing exactly how you set up your constraints.
Alan Weiss
MATLAB mathematical toolbox documentation
  6 Comments
hend ma
hend ma on 5 Jun 2015
You are right. I tried again with initial population that satisfies my inequalities and it works. My question is: Does GA check other combinations of changing the values of the integer variables? I am asking this because I get that the optimal solution is my initial population. Indeed I do not know if my initial population is the better solution, because I am performing this optimization iteratively and dynamically. So I cannot check for each optimization what the "better solution" is and put it as initial population.
Thanks a lot Hend
Alan Weiss
Alan Weiss on 5 Jun 2015
Of course ga checks other values of the variables. That is what it does to optimize.
But you cannot rely on ga to find the global optimum. The algorithm is stochastic, and cannot guarantee that it finds anything.
If you really want to stick with ga, then I suggest again that you give a much larger initial population, and run it multiple times.
But you would probably do yourself a favor to look carefully at the travelling salesman example I pointed you to earlier, and see whether you can reformulate your problem to be MILP instead of MINLP.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!