0

我有一个表格问题: 约束


其中 X^_JW:

在此处输入图像描述


和 delta_R_LV:

在此处输入图像描述

在哪里:

- 所有大写的 delta 和 epsilon 都是常数

-R_WV 是一个 3,3 旋转矩阵,有 1000 个样本

-R^_LV 是一个 3,3 不变的旋转矩阵

-I 是一个 3,3 旋转矩阵

-Delta_R_LV 是我们希望求解的 3,3 矩阵

-X_JLI 是具有 1000 个样本的 3,1 向量

-T_LV 是我们希望求解的 3,1 向量

-T_VW 是具有 1000 个样本的 3,1 向量

-X*_JW 是具有 1000 个样本的 3,1 向量

我无法理解如何将具有 1000 个样本的 3,3 矩阵拟合成可以进行优化的 2d 形式。我的想法是在最后一个维度上展平,以便得到维度为 1000,9 的矩阵,但我不明白这些矩阵如何在 3,1 向量上运行。

我了解这些示例如何适用于 dim (N,1) 的样本向量,以及如何通过示例将这样的内容转换为矩阵:

objective = cp.Minimize(cp.sum_squares(A*x - b))
constraints = [0 <= x, x <= 1]
prob = cp.Problem(objective, constraints)

# The optimal objective value is returned by `prob.solve()`.
result = prob.solve()
# The optimal value for x is stored in `x.value`.
print(x.value)
# The optimal Lagrange multiplier for a constraint is stored in
# `constraint.dual_value`.
print(constraints[0].dual_value)


x = cp.Variable((1275,3))
objective = cp.Minimize(cvx.sum_squares(A*x - b))
constraints = [0 <= x, x <= 1]
prob = cvx.Problem(objective, constraints)

在此链接中还有另一个示例可能更接近我的问题:

http://nbviewer.jupyter.org/github/cvxgrp/cvx_short_course/blob/master/intro/control.ipynb

4

1 回答 1

0

您可以尝试对和使用矩阵列表numpy。一个更简单的示例,用于约束(1x3)(3x3)和向量(1x3)的 2 个样本。这看起来像:RXSum(R*X) = YXRY

R = [np.matrix([[1/3, 2/3, 0], [3/4, 1/4, 0 ], [0, 5/6, 1/6]]),
     np.matrix([[0, 2/3, 1/3], [3/4, 1/4, 0 ], [0, 1/6, 5/6]])]
Y = np.matrix([1, 1, 1])

for i in range(Y.shape[1]):
    constraint += [sum([R[j]*X[t].T for t in range(len(X)) for j in range(len(R))])[i] == Y[0, i]]
于 2018-07-17T22:53:05.643 回答