0

I have two matrix r and w. r is a (3,4) matrix which is constant and w is a (4,3) matrix which is variable and the target I'm trying to optimize

r = [[0.1,0.15,0.03,0.2],
     [0.1,0.15,0.11,0.1],
     [-0.3,0.37,0.25,-0.1]]

-I want to minimize the result of np.prod(np.dot(r,w).diagonal())

-The constraints are:

  1. Two of the four elements in each column of w are zero and the remaining two elements are opposite to each other.

-The bounds are:

  1. The absolute value of each element in w cannot be greater than 10

-I'm stuck in how to set the constraints and bounds of scipy.optimize.minimize
-or anyone can give me some suggestion on other methods to solve this optimization problem?

Talha Tayyab
  • 8,111
  • 25
  • 27
  • 44
xlian
  • 1
  • 2
  • Can you give an example of your first constraint? It's not really clear what you mean with *two elements are opposite to each other*. – joni May 29 '22 at 18:42
  • "*Two of the four elements in each column of w are zero and the remaining two elements are opposite to each other*." Do you know which elements or does the model have to decide? – Erwin Kalvelagen May 29 '22 at 21:36

0 Answers0