我是靠谱客的博主 坦率小刺猬,最近开发中收集的这篇文章主要介绍matlab linprog整数,关于整数规划intlinprog函数的问题,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

本帖最后由 真理追求者 于 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 上传

b4d287d1aacbf0cf95a77c41289acfe6.gif

c5006d1a5b4047f80d42a7082635a87b.gif

这是题目,要求运费最小

68df5e30c1681f53255a54c8d445f607.png

2016-4-2 11:00 上传

b4d287d1aacbf0cf95a77c41289acfe6.gif

c5006d1a5b4047f80d42a7082635a87b.gif

这是我写的代码,但跑不出答案

fa67ac091b4f1b4726e6490d36e52e77.png

最后

以上就是坦率小刺猬为你收集整理的matlab linprog整数,关于整数规划intlinprog函数的问题的全部内容,希望文章能够帮你解决matlab linprog整数,关于整数规划intlinprog函数的问题所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(63)

评论列表共有 0 条评论

立即
投稿
返回
顶部