def test_optimize(): initial = start_seating() evaluator = TablePositionAgnosticClosnessEvaluator() searcher = SingleThreadedSearcher( ClosenessStepper(evaluator), SquareStateEvaluator(evaluator), PrintLogger() ) state, e1 = searcher.search(initial, n=1) _, e2 = searcher.search(initial, n=100) assert e2 < e1
def run(self): evaluator = TablePositionAgnosticClosnessEvaluator() searcher = SingleThreadedSearcher( ClosenessStepper(evaluator), SquareStateEvaluator(evaluator), PrintLogger() ) while True: response = requests.get('http://%s:%s/get_best_state' % (self.addr, self.port)) state = State.from_json(response.content) state, _ = searcher.search(state, n=1000) requests.post('http://%s:%s/report_state' % (self.addr, self.port), data=state.to_json())
def run(self): evaluator = TablePositionAgnosticClosnessEvaluator() searcher = SingleThreadedSearcher(ClosenessStepper(evaluator), SquareStateEvaluator(evaluator), PrintLogger()) while True: response = requests.get('http://%s:%s/get_best_state' % (self.addr, self.port)) state = State.from_json(response.content) state, _ = searcher.search(state, n=1000) requests.post('http://%s:%s/report_state' % (self.addr, self.port), data=state.to_json())