def reach(self, s: star.Star): # s is one star #print (s) #print (s.getBox()) #print (self.W) #print (self.b) #try: s.AffineTransform(self.W, self.b) #except Exception as e: # print (s.dim) # print (self.W) # print (self.b) # raise e #print (s) #apply halfspace intersection #print (s.getBox()) stars = [s] if self.RELU_output: for d in range(self.output_dim): new_stars = [] for s in stars: P = s N = s.copy() H1 = np.zeros((self.output_dim, 1)) H1[d] = -1.0 G1 = np.array([0.0]) P.ApplyHalfSpaceIntersection(H1, G1) if not P.isEmpty(): new_stars.append(P) #else: # print ('Empty') H1[d] = 1.0 # 1.0 * xn <= 0 N.ApplyHalfSpaceIntersection(H1, G1) if not N.isEmpty(): W1 = np.eye(self.output_dim) W1[d][d] = 0 N.AffineTransform(W1, np.zeros(self.output_dim)) new_stars.append(N) #else: # print ('Empty') stars = new_stars return stars