首页 > 解决方案 > Mosek 中的二次和线性约束(来自 Matlab)

问题描述

我有一个关于如何在 Mosek(来自 Matlab)中运行二次约束最小化问题的问题。这是我的问题

在此处输入图像描述

假设不存在线性等式和不等式约束。Mosek 文档(此处)很好地解释了如何实现优化问题。首先,我们应该将问题改写为

在此处输入图像描述

二、我们应该设置

clear prob;

% Specify the linear objective terms.
prob.c      = [0, -1, 0];

% Specify the quadratic terms of the constraints.
prob.qcsubk = [1     1    1   1  ]';
prob.qcsubi = [1     2    3   3  ]';
prob.qcsubj = [1     2    3   1  ]';
prob.qcval  = [-2.0 -2.0 -0.2 0.2]';

% Specify the quadratic terms of the objective.
prob.qosubi = [1     2    3    3  ]';
prob.qosubj = [1     2    3    1  ]';
prob.qoval  = [2.0   0.2  2.0 -1.0]';

% Specify the linear constraint matrix
prob.a      = [1 1 1];

% Specify the lower bounds
prob.blc    = [1];
prob.blx    = [-3;-3;-4];
prob.ulx    = [3;3;5];

[r,res]     = mosekopt('minimize',prob);

问题:如何在上面的代码中引入我的示例中的两个线性等式和不等式约束?

我试图查看有关线性编程的示例,但它们似乎并不容易与我上面的代码混合。

标签: matlabmosek

解决方案


推荐阅读