メインコンテンツへスキップ

How to formulate matrix multiplication and inverse using constraint program?

回答済み

コメント

1件のコメント

  • Riley Clement
    • Gurobi Staff

    Hi Sanket,

    This isn't an optimization problem, it just requires matrix arithmetic, which can be achieved with Python and numpy for example:

    import numpy as np

    G = np.array([
        [-4, 2, 1],
        [-2, 2, 1],
        [-1, 1, 1]
    ])

    C = np.array([-2,2,1])

    W = G@np.linalg.inv(G.transpose()@G)@C

    Then W = array([1.55431223e-15, 1.00000000e+00, 4.44089210e-16])

    - Riley

    1

サインインしてコメントを残してください。