Returns the output of the function called with current x and y coordinates. >>> def test_function(x, y): ... return x + y >>> SearchProblem(0, 0, 1, test_function).score() # 0 + 0 = 0 0 >>> SearchProblem(5, 7, 1, test_function).score() # 5 + 7 =
(self)
| 23 | self.function = function_to_optimize |
| 24 | |
| 25 | def score(self) -> int: |
| 26 | """ |
| 27 | Returns the output of the function called with current x and y coordinates. |
| 28 | >>> def test_function(x, y): |
| 29 | ... return x + y |
| 30 | >>> SearchProblem(0, 0, 1, test_function).score() # 0 + 0 = 0 |
| 31 | 0 |
| 32 | >>> SearchProblem(5, 7, 1, test_function).score() # 5 + 7 = 12 |
| 33 | 12 |
| 34 | """ |
| 35 | return self.function(self.x, self.y) |
| 36 | |
| 37 | def get_neighbors(self): |
| 38 | """ |
no outgoing calls
no test coverage detected