不等式的线性系统 [英] Linear systems of inequations

查看:120
本文介绍了不等式的线性系统的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,所以我有一个包含6个不等式和3个变量的系统,以及一个可能会或可能不会解决此系统的点.要检查这一点是否能够解决不等式很简单,我的问题是,当它不能解决不等式时,找到可以解决问题的最接近点.

Ok so I have a systems with 6 inequations and 3 variables, and a point that may or may not solve this system. To check whether this point solves the inequations is straightforward, my problem is when it does not solve the inequations to find the closest point that does solve the problem.

我将提供这样一个系统的示例:Ax <= b

I will present an example of such a system: Ax<=b

A =

[  C11,  C12,  C13]
[ -C21, -C22, -C23]
[  C31,  C32,  C33]
[ -C41, -C42, -C43]
[  C51,  C52,  C53]
[ -C61, -C62, -C63]

b =

[ Cb1]
[ Cb2]
[ Cb3]
[ Cb4]
[ Cb5]
[ Cb6]

Pxyz =

[  pX,  pY,  pZ]

Pxyz解决Ax <= B吗?

Does Pxyz solve Ax<=B ?

if all(A*Pxyz<=b)
accept point
else
get the closest point to Pxyz (by Euclidean distance) that solves the system. How?
end

推荐答案

尝试以下方法之一(已测试2D问题):

Try one of these (tested with a 2D problem):

方法1:

[Psol,fval,exitflag] = fmincon(@(Psol) norm(Pxyz-Psol), Pxyz, A, b)


方法2:

如果我理解正确,那么您会遇到一个约束线性优化问题,更具体地说是一个约束线性最小二乘问题,可以使用

If I understand correctly, you have a constrained linear optimization problem, more specifically a constrained linear least-squares problem which can be solved using lsqlin. It would be something like this:

if all(A*Pxyz <= b)
  % accept point
else
  % get the closest point to Pxyz (by Euclidean distance) that solves the system
  C = eye(length(b));
  [Psolu, resnorm, residual, exitflag] = lsqlin(C, Pxyz, A, b);
end

希望这有助于解决您的问题.

Hope this helps to solve your problem.

这篇关于不等式的线性系统的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆