def _start_binary_search(self, router_table, sorted_bit_fields, target_length, time_to_try_for_each_iteration, use_timer_cut_off, key_atom_map): """ start binary search of the merging of bitfield to router table :param ~.UnCompressedMulticastRoutingTable router_table: uncompressed router table :param list(_BitFieldData) sorted_bit_fields: the sorted bitfields :param int target_length: length to compress to :param int time_to_try_for_each_iteration: the time to allow compressor to run for. :param bool use_timer_cut_off: whether we should use the timer cutoff for compression :param dict(int,int) key_atom_map: map from key to atoms """ # try first just uncompressed. so see if its possible try: self._best_routing_table = self._run_algorithm( [router_table], target_length, time_to_try_for_each_iteration, use_timer_cut_off) self._best_bit_fields_by_processor = [] except MinimisationFailedError: raise PacmanAlgorithmFailedToGenerateOutputsException( "host bitfield router compressor can't compress the " "uncompressed routing tables, regardless of bitfield merging. " "System is fundamentally flawed here") find_max_success( len(sorted_bit_fields), functools.partial( self._binary_search_check, sorted_bit_fields=sorted_bit_fields, routing_table=router_table, target_length=target_length, time_to_try_for_each_iteration=time_to_try_for_each_iteration, use_timer_cut_off=use_timer_cut_off, key_to_n_atoms_map=key_atom_map))
def test_17(): result = find_max_success(12, lambda x: x <= 12) assert result == 12
def test_9(): result = find_max_success(12, lambda x: x <= 9) assert result == 9
def test_8(): result = find_max_success(12, lambda x: x <= 8) assert result == 8
def test_7(): result = find_max_success(12, lambda x: x <= 7) assert result == 7
def test_6(): result = find_max_success(12, lambda x: x <= 6) assert result == 6
def test_5(): result = find_max_success(12, lambda x: x <= 5) assert result == 5
def test_4(): result = find_max_success(12, lambda x: x <= 4) assert result == 4
def test_3(): result = find_max_success(12, lambda x: x <= 3) assert result == 3
def test_2(): result = find_max_success(12, lambda x: x <= 2) assert result == 2
def test_0(): result = find_max_success(12, lambda x: x < 0) assert result == 0