我是靠谱客的博主 英俊鸭子,最近开发中收集的这篇文章主要介绍matlab 整数规划函数,关于整数规划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 上传

442a53943febe9465fc072b4fbe10813.gif

b2a5a3e0dcc7d508e00275fe42fce1b5.gif

这是题目,要求运费最小

dcbc0ddee97d4322ef0d6bde3cd268f3.png

2016-4-2 11:00 上传

442a53943febe9465fc072b4fbe10813.gif

b2a5a3e0dcc7d508e00275fe42fce1b5.gif

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

270b2d0071cd1e35296dfc69642b6402.png

最后

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

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

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

评论列表共有 0 条评论

立即
投稿
返回
顶部