How to formulate matrix multiplication and inverse using constraint program?
AnsweredHello, I want to formulate a Matrix multiplication and inverse using a strictly integer constraint program, and I don't know how to proceed with it.
G = [ [-4, 2, 1],
[-2, 2, 1],
[-1, 1, 1]
]
C = [ [-2],
[2],
[1)
]
and I want to find W vector such as:
W = G(G⊺G)^−1 C
That is, G(G transpose G)inverse C
is this matrix multiplication and most importantly the INVERSE of the multiplication is possible to formulate
Help will be appreciated :)
0
-
Official comment
This post is more than two years old. Some information may not be up to date. For current information, please check the Gurobi Documentation or Knowledge Base. If you need more help, please create a new post in the community forum, or try Gurobot, our chatbot interface offering instant, expert-level support. -
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)@CThen W = array([1.55431223e-15, 1.00000000e+00, 4.44089210e-16])
- Riley
1
Post is closed for comments.
Comments
2 comments