예제 #1
0
파일: tests.py 프로젝트: jlubcke/seating
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
예제 #2
0
파일: client.py 프로젝트: jlubcke/seating
 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())
예제 #3
0
 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())