Matlab中混合整数最近最优解

Mar*_*ary 8 optimization matlab approximation mixed-integer-programming

是否有可能找到最接近混合整数问题的解决方案?例如,我想要下面的简化问题:

f = [1;1;1];
intcon = 1:3;

Aeq = [0.99,0.97,0.15];
beq = 0.16;
lb = zeros(3,1);
ub = [1;1;1]; 

x = intlinprog(f,intcon,[],[],Aeq,beq,lb,ub)
Run Code Online (Sandbox Code Playgroud)

返回,x=[0;0;1]因为这是目标值的最接近的整数解0.16.相反,它现在返回

Intlinprog因为没有任何一点满足约束而停止了.

不一定要跑intlinprog.beq例如,如果低,理想情况下也需要工作0.14.

m79*_*13d 6

您可以在需要时引入一些松弛变量以允许某些约束违规,如下所示:

largeValue = 100; % choose some large value to penalise the constraint violation
f_ = [f; largeValue; largeValue]; % penalise both slack variables
Aeq_ = [Aeq, 1, -1]; % add a positive and negative slack variable to the constraint
beq_ = beq;
lb_ = [lb; 0; 0]; % limit the constraint to a positive number
ub_ = [ub; inf; inf];

x_ = intlinprog(f_,intcon,[],[],Aeq_,beq_,lb_,ub_); % solve the adapted problem
x = x_(1:3) % extract the solution of the original problem
Run Code Online (Sandbox Code Playgroud)

备注

  • 我添加了两个(正)松弛变量,一个用于正约束违规,另一个用于负约束违规.

  • 您应该使用较大的值来惩罚松弛变量,否则违反您的约束超出严格要求是有益的.更通用的方法是基于例如f和中的值来确定良好的惩罚值Aeq

    largeValue = 2*max(abs(f))/min(abs(Aeq(Aeq ~= 0)))
    
    Run Code Online (Sandbox Code Playgroud)