opttoolbox_mip1.m


opttoolbox_mip1.m


本示例使用Matlab 2017b问题的建模特性,其中%需要优化工具箱,来制定和解决以下%狗万app足彩简单的MIP模型,与mip1的模型相同。% x + y + 2 z % subject % x + 2 y + 3 z <= 4 % x + y >= 1 % x, y, z二进制% %m必须在当前%目录或添加到Matlab路径x = optimvar('x', 'Type','integer','LowerBound',0,'UpperBound',1);y = optimvar('y', 'Type','integer','LowerBound',0,'UpperBound',1);z = optimvar('z', '类型','整数','LowerBound',0,'UpperBound',1);概率= optimproblem(“ObjectiveSense”、“最大化”);概率。目标= x + y + 2 * z;prob.Constraints。n = x + 2 * y + 3 * z <= 4;prob.Constraints。con2 = x + y >= 1; options = optimoptions('intlinprog'); % For Matlab R2017b use the following % sol = solve(prob, options) % Syntax for R2018a and later sol = solve(prob, 'Options', options); end