I checked out the threads with this error message, but the solutions didn't really apply to my case
Here's my code. I saw in the debugger that the arrays work fine, they have values etc, but the condition fails.
matrix = np.zeros((self.data_set.nfeatures, self.data_set.A.shape[0], self.R.shape[0]))
for i in range(self.data_set.nfeatures):
for a in range(self.data_set.A.shape[0]):
for b in range(self.R.shape[0]):
if self.R[1]-self.R[0] <= self.Q[i]: # Program crashes here
matrix[i][a][b] = 0
elif self.R[1]-self.R[0] >= self.P[i]:
matrix[i][a][b] = 1
else:
matrix[i][a][b]= self.R[1]-self.R[0]-self.Q[i]
Error message: if self.R[1]-self.R[0] <= self.Q[i]: ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()