How to use minlp with non analytic optimization function
Show older comments
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
on 30 Apr 2015
0 votes
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
on 26 May 2015
Edited: Walter Roberson
on 5 Jun 2015
0 votes
Alan Weiss
on 26 May 2015
You did not state how you included the constraints such as
x(10) <= x(19);
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
Alan Weiss
on 29 May 2015
There are many reasons why ga might not have converged to a satisfactory answer.
- You have a lot of variables. ga might need a larger population size.
- ga is random. If you run it multiple times does it come up with different answers?
- Did you try seeding ga with a partial initial population? If not, please try doing so with your better final point. If so, did ga improve the answer, or return a poorer solution?
Finally, I suspect that you could reformulate your problem somewhat along the lines of the travelling salesman example to convert it to a MILP. Then you would be able to use the faster and more reliable intlinprog solver instead of ga.
Good luck,
Alan Weiss
MATLAB mathematical toolbox documentation
hend ma
on 3 Jun 2015
Alan Weiss
on 3 Jun 2015
Did you try putting in a partial population with the better solution as an initial point? If so, what happened?
I suspect that your "better" point does not satisfy your linear inequalities. You can check by evaluating
A*x - b
where x is your better point, and checking whether the maximum entry is positive.
Alan Weiss
MATLAB mathematical toolbox documentation
hend ma
on 5 Jun 2015
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
Categories
Find more on Get Started with Optimization Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!