manbet体育手机客户端


opttoolbox_mip1.m


本例使用Matlab 2017b基于问题的建模特征,其中%需要Optimization T狗万app足彩oolbox,来制定和解决以下%简单的MIP模型,与mip1相同的模型。m % % maximize % x + y + 2z % subject to % x + 2y + 3z <= 4 % x + y >= 1 % x, y, z binary % %x = optimvar('x', 'Type','integer','LowerBound',0,'UpperBound',1);y = optimvar('y', 'Type','integer','LowerBound',0,'UpperBound',1);z = optimvar('z', 'Type','integer','LowerBound',0,'UpperBound',1);概率= optimproblem(“ObjectiveSense”、“最大化”);概率。目标= x + y + 2 * z;prob.Constraints。con1 = x + 2 * y + 3 * z <= 4;prob.Constraints。con2 = x + y >= 1; options = optimoptions('intlinprog'); try sol = solve(prob, options) catch gurobiError fprintf('Error reported\n'); end end