No License

Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.

» Watch video

Highlights from
mixed-integer LP

4.3 | 23 ratings Rate this file 33 Downloads (last 30 days) File Size: 3.67 KB File ID: #6990 Version: 1.0

mixed-integer LP


Sherif Tawfik (view profile)


23 Feb 2005 (Updated )

This function solves the mixed integer linear programming problems.

| Watch this File

File Information

This function solves the mixed integer linear programming problems. It uses the linprog.m function that comes with the optimization toolbox of MATLAB. It employs the branch and bound algorithm. It uses depth first search.

Required Products Optimization Toolbox
MATLAB release MATLAB 6.5 (R13)
Tags for This File   Please login to tag files.
Please login to add a comment or rating.
Comments and Ratings (35)
13 Feb 2017 y li

y li (view profile)

when solving milp, I got infeasible solution!

01 Sep 2016 pengzhan wang

27 Jan 2016 RK

RK (view profile)

27 Jan 2016 RK

RK (view profile)

Hi Amani,

Click on the tag ( general integer linear programming), then you will see the code.


Comment only
04 Jan 2016 Amani mahdy

why i cannot download it ><

Comment only
16 Oct 2014 ABY SUBIN

Thank you very much for the code.It saved a lot of my time.For binary integer (0,1) problems , just set the upper and lower bound as 0 and 1.

Comment only
18 Feb 2014 Thalita Monteiro

02 Nov 2013 Muhammad Faraz Sahito

It was very helpful, Thanks

Comment only
02 Nov 2013 Muhammad Faraz Sahito


25 Jun 2013 Ziba

Ziba (view profile)

Thank you very much

Comment only
05 May 2013 mostafa amer

how to u use?

Comment only
19 Sep 2012 protein

16 May 2012 TUNG LE

thank you very much!

08 May 2012 Marino Pagan

Thank you!

24 Feb 2012 Erdal Bizkevelci

06 Jan 2012 Hamidreza Nourzadeh

Try a large scale Integer linear programming problem (e.g. 100000 variable). Because of rec function you will get the following error.

Maximum recursion limit of 500 reached. Use set(0,'RecursionLimit',N)
to change the limit. Be aware that exceeding your available stack space can
crash MATLAB and/or your computer.

Error in optimget>optimgetfast
is there any way to fix it ?

Comment only
29 Oct 2011 Sivaramakrishnan Raman

It does not work for only 2 integer variables. Please bother to at least understand the syntax. M is a vector which denotes the indices of 'x' which are integers.

12 Oct 2011 Tom

Tom (view profile)

what datatype do the inputs have to be? I've tried all except 'e' being single, double, int16/32/64, uint16/32/64 with no luck...i keep getting the error message 'Undefined function 'IP1' for input arguments of type 'XXXX'.'

Comment only
22 Jul 2011 Naveen

Naveen (view profile)

some of my variables are binary integers (0 or 1). how can i specify them by using this function?

Comment only
19 Nov 2008 Varun

Varun (view profile)

Does this code work for only 2 variable problems???

Comment only
18 Nov 2008 Varun

Varun (view profile)

I used the code for a model but I got the following error- Please Comment on the same:

??? Error using ==> vertcat
CAT arguments dimensions are not consistent.
Error in ==> IP>rec at 86
Error in ==> IP at 36
[x,val,status,b]=rec(f,A,b,Aeq,beq,lb,ub,x0,val0,M,e,bound); % a recursive function that processes the BB tree
Error in ==> Full at 573
[x v s]= IP(f,A,b,Aeq,beq,lb,ub,M,e)

I am getting very close to my deadline so a fast solution would be appreciated.

Comment only
09 Aug 2008 Ez Zaza

Can you provide the code for finding 0/1 optimization? Thank you

13 May 2008 Bojan Oslaj

15 Sep 2007 Arendo B

Many Thanks, but for some example if i chang the arrangment of rows for A(and b) or Aeq(and beq), the result is changed. for exapmle when the A or Aeq are very narrow. (the columns are more than rows)

29 Jun 2007 P Banerjee

I spent 5 days trying to write my code on similar lines to the way bintprog is written and finally I gave up. This free code is simply very good and serves all my purposes.

29 May 2007 Hanen Hanna

22 Jan 2007 akro makro

02 Aug 2006 sun bo

This is a very good function However m=1 or 2 respectively mean?

03 May 2006 3adel Emam

it solves a problem with 2 integer variables only. what if we have more continues or discrete variables?
the other thing is the MILP function has to create and search the whole branch and bound tree,not just two subproblems.

06 Apr 2006 Altaf Alfarhan

IP function is excellent for solving pure integer linear programming problems.
It was very helpful for me as a student.

14 Feb 2006 David Zeng

Only one word, Excellent!

08 Jan 2006 Vincenzo Manzoni

I am an italian student of engineering. Thanks a lot for your Matlab function: it works very good.

04 Sep 2005 Ruoyu Cheng

Based on the solution to several test MILP problems, I would like to say that this function is rather valuable for academic studies on mixed-integer linear programming.
The interested researchers can conveniently modify the file to adapt to their own purposes, .e.g., to incorporate more advanced techniques.

14 Jun 2005 zhang lipu

i am a teacher from china.
tks a lot.

Comment only
26 May 2005 Toni Jarimo

28 Feb 2005

An example of how to use the function is added

Contact us