本帖最后由 真理追求者 于 2016-4-2 11:11 编辑
整数规划问题,matlab版本R2014a目标函数:min f*x
Aeq*x=beq;
A*x<&#61;b
x>&#61;0,均为整数
因为有48个变量&#xff0c;故均用矩阵形式表示
f&#61;[6;2;9;7;4;2;5;9;4;5;5;3;8;5;3;2;5;2;1;3;7;4;8;3;7;6;7;9;9;2;7;1;2;3;6;5;7;2;6;5;5;9;2;2;8;1;4;3];
intcon&#61;1:48;
Aeq&#61;[1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0;
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1];
beq&#61;[55;47;42;52;41;32];
A&#61;[6,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0;
0,2,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,9,0,0,0,0,0,0;
0,0,9,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,2,0,0,0,0,0;
0,0,0,7,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,2,0,0,0,0;
0,0,0,0,4,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,8,0,0,0;
0,0,0,0,0,2,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,4,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,1,0,0;
0,0,0,0,0,0,5,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,7,0,0,0,0,0,0,0,6,0,0,0,0,0,0,0,4,0;
0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,5,0,0,0,0,0,0,0,3];
b&#61;[60;55;51;43;41;52;43;38];
lb&#61;zeros(48,1);
[x,fval,exitflag,output] &#61;intlinprog(f,intcon,A,b,Aeq,beq,lb,[])
运行结果是Intlinprog stopped because no point satisfies the constraints.
2016-4-2 10:57 上传


这是题目&#xff0c;要求运费最小

2016-4-2 11:00 上传


这是我写的代码&#xff0c;但跑不出答案
