整数线性规划word版
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
第三章 整数线性规划
本章, 我们介绍三种解决整数线性规划问题的软件:
第一种: MATLAB 中的optimization toolbox 中的若干程序;
第二种: LINDO 软件;
第二种: LINGO 软件.
1. MATLAB 程序说明
程序名: intprogram, L01p_e, L01p_ie, transdetobi, biprogram
intprogram 是利用分支定界法解决整数规划问题, 是全部的整数规划问题;
L01p_e 是利用枚举法解决0-1规划问题, 变量要求全部为0或者1;
L01p_ie 是利用隐枚举法解决0-1规划问题, 变量要求全部为0或者1;
Transdetobi 是枚举法和隐枚举法中利用到的将十进制数转化为二进制数的函数;
Biprogram 是MATLAB6.5以上版本中有的求解0-1规划的函数的程序.
intprogram 执行实例1:
12
121212max 2010s.t.5424
2513
,0, f x x x x x x x x =++≤+≤≥ 且为整数
在命令窗口的程序执行过程和结果如下:
>> c=[-20,-10]; %将最大转化为最小;
>> a=[5,4;2,5];
>> b=[24;13];
>> [x,f]=intprogram(c,a,b,[0;0],[inf;inf],[],0,0.0001) % c,a,b 之后[0;0] is the value of low bound;[inf;inf] is the value of up bound;[] is the initialization;0 is the number of the equation constraints; 0.0001 is the concise rate. x =
4.0000
1.0000
f =
-90
intprogram 执行实例2: 书中例题3.3.1
在命令窗口的程序执行过程和结果如下:
>> c=[-1,-1];
>> a=[-4,2;4,2;0,-2];
>> b=[-1;11;-1];
>> [x,f]=intprogram(c,a,b,[0;0],[inf;inf],[],0,0.0001)
x =
2 2
1 1
f =
-3
L01p_e 和L01p_ie 执行实例:
123
1231231223123max 325s.t.22
44
3
46
,,01
f x x x x x x x x x x x x x x x x =-++-≤++≤+≤+≤= - 或
在命令窗口的程序执行过程和结果如下:
>> c=[3,-2,5]; %将最大转化为最小;
>> a=[1,2,-1;1,4,1;1,1,0;0,4,1];
>> b=[2;4;3;6];
>> x1=L01p_e(c,a,b);x2=L01p_ie(c,a,b); %x1表示利用枚举法解决0-1规划问题,x2表示用隐% 枚举法解决问题, 结果是一样的
>> x1
x1 =
1
>> x2
x2 =
1
biprogram 执行实例: 1234
1234341324min ()9564s.t.63529
1
f x x x x x x x x x x x x x x x =---+++≤+≤+≤-+≤ - -
在命令窗口的程序执行过程和结果如下:
the program is with the binary linear programming
Please input the constraints number of the programming m=4
m =
4
Please input the variant number of the programming n=4
n =
4
Please input cost array of the objective function c(n)_T=[-9,-5,-6,-4]'
c =
-9
-5
-6
-4
Please input the coefficient matrix of the constraints A(m,n)=[6,3,5,2;0,0,1,1; -1,0,1,0;0,-1,0,1]
A =
6 3 5 2
0 0 1 1
-1 0 1 0
0 -1 0 1
Please input the resource array of the program b(m)_T=[9,1,0,0]'
b =
9
1
Optimization terminated successfully.
x =
1
1
程序的相关知识:
Solve binary integer programming problems of the form
where f, b, and beq are vectors, A and Aeq are matrices, and the solution x is required to be a binary integer vector -- that is, its entries can only take on the values 0 or 1.
语法如下:
x = bintprog(f)
x = bintprog(f, A, b)
x = bintprog(f, A, b, Aeq, beq)
x = bintprog(f, A, b, Aeq, beq, x0)
x = bintprog(f, A, b, Aeq, beq, x0, options)
[x, fval] = bintprog(...)
[x,fval, exitflag] = bintprog(...)
[x, fval, exitflag, output] = bintprog(...)
解释:
x = bintprog(f) solves the binary integer programming problem
x = bintprog(f, A, b) solves the binary integer programming problem
x = bintprog(f, A, b, Aeq, beq) solves the preceding problem with the additional equality constraint.
x = bintprog(f, A, b, Aeq, beq, x0) sets the starting point for the algorithm to x0. If x0 is not in the feasible region, bintprog uses the default initial point.
x = bintprog(f, A, b, Aeq, Beq, x0, options) minimizes with the default optimization options replaced by values in the structure options, which you can create using the function optimset.
[x, fval] = bintprog(...) returns fval, the value of the objective function at x.
[x,fval, exitflag] = bintprog(...) returns exitflag that describes the exit condition of bintprog. See Output Arguments.