求解带边界的线性最小二乘系统

问题描述 投票:0回答:1

我是Eigen的新手,我想使用Eigen求解带边界的线性最小二乘系统。Eigen网站上的示例很简单,但是我不确定如何为解决方案设置界限。

这是示例代码:

#include <iostream>
#include <Eigen/Dense>

using namespace std;
using namespace Eigen;

int main()
{
   MatrixXf A = MatrixXf::Random(3, 2);
   cout << "Here is the matrix A:\n" << A << endl;
   VectorXf b = VectorXf::Random(3);
   cout << "Here is the right hand side b:\n" << b << endl;
   cout << "The least-squares solution is:\n"
        << A.bdcSvd(ComputeThinU | ComputeThinV).solve(b) << endl;
}

正在解决Ax = b。我正在寻找x有界的解决方案。例如,我正在寻找Ax = b的最佳解决方案,以使0

eigen eigen3
1个回答
0
投票

本质上,您正在寻找二次编程问题的解决方案:|| Ax-b || ^ 2_2-> min,但要满足0 <= x <= 1(请注意,不等式并不严格)。 AFAIK,Eigen并未提供现成的功能,但是还有许多其他库可以做到这一点。

© www.soinside.com 2019 - 2024. All rights reserved.