概述
本帖最后由 真理追求者 于 2016-4-2 11:11 编辑
整数规划问题,matlab版本R2014a目标函数:min f*x
Aeq*x=beq;
A*x<=b
x>=0,均为整数
因为有48个变量,故均用矩阵形式表示
f=[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=1:48;
Aeq=[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=[55;47;42;52;41;32];
A=[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=[60;55;51;43;41;52;43;38];
lb=zeros(48,1);
[x,fval,exitflag,output] =intlinprog(f,intcon,A,b,Aeq,beq,lb,[])
运行结果是Intlinprog stopped because no point satisfies the constraints.
2016-4-2 10:57 上传
这是题目,要求运费最小
2016-4-2 11:00 上传
这是我写的代码,但跑不出答案
最后
以上就是坦率小刺猬为你收集整理的matlab linprog整数,关于整数规划intlinprog函数的问题的全部内容,希望文章能够帮你解决matlab linprog整数,关于整数规划intlinprog函数的问题所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复