def get_new_runner(self,
                       mp: 'Map',
                       algorithm_type: Type['Algorithm'],
                       algorithm_parameters: Tuple[List, Dict] = None,
                       algorithm_testing: Optional[
                           Type['BasicTesting']] = None,
                       with_animations: bool = False) -> 'AlgorithmRunner':
        if not algorithm_parameters:
            algorithm_parameters = [], {}

        from simulator.services.services import Services
        config = Configuration()
        config.simulator_initial_map = mp
        config.simulator_algorithm_type = algorithm_type
        config.simulator_testing_type = algorithm_testing
        config.simulator_algorithm_parameters = algorithm_parameters

        if with_animations and algorithm_testing:
            config.simulator_graphics = True
            config.simulator_key_frame_speed = self._services.settings.simulator_key_frame_speed
            config.simulator_key_frame_skip = self._services.settings.simulator_key_frame_skip

        s = Services(config)

        if with_animations and algorithm_testing:
            s.algorithm.__pass_root_key_frame = self.__pass_root_key_frame

        return s.algorithm
Exemplo n.º 2
0
def configure_visualiser(config: Configuration, args: argparse.Namespace) -> bool:
    if args.visualiser:
        config.load_simulator = True
        config.simulator_graphics = True

    if args.visualiser_flags is not None and not arg_valid("visualiser", args):
        return False

    return True
Exemplo n.º 3
0
    def __start_simulator_callback(gui): #Setting the configuration file.
        config = Configuration()

        mp = gui.__maps[gui.__map_choice.get()]
        algo = gui.__algorithms[gui.__algorithm_choice.get()]
        ani = gui.__animations[gui.__animations_choice.get()]
        debug = gui.__debug[gui.__debug_choice.get()]

        config.load_simulator = True
        config.simulator_graphics = True
        config.simulator_initial_map, config.simulator_grid_display = mp
        config.simulator_algorithm_type, config.simulator_testing_type, config.simulator_algorithm_parameters = algo
        config.simulator_key_frame_speed, config.simulator_key_frame_skip = ani
        config.simulator_write_debug_level = debug

        MainRunner(config).run()
Exemplo n.º 4
0
train_start = True
sim_start = False
config.generator_house_expo = False
analyzer_start = False
config.generator_size = 64  # Change the size of the maps generated

# Cache
config.clear_cache = True

# Generator
mp = maps[chosen_map]
# Chooses map for generation

# Simulator
config.load_simulator = sim_start
config.simulator_graphics = False
config.simulator_initial_map = mp
config.simulator_algorithm_type, config.simulator_testing_type, config.simulator_algorithm_parameters = algo
config.simulator_key_frame_speed, config.simulator_key_frame_skip = ani
config.simulator_write_debug_level = debug

# These are for training
config.generator_labelling_features = labelling[training_algo][0]
config.generator_labelling_labels = labelling[training_algo][1]
config.generator_single_labelling_features = labelling[training_algo][2]
config.generator_single_labelling_labels = labelling[training_algo][3]

config.generator_aug_labelling_features = []
config.generator_aug_labelling_labels = []
config.generator_aug_single_labelling_features = []
config.generator_aug_single_labelling_labels = []
Exemplo n.º 5
0
train_start = False
sim_start = False
config.generator_house_expo = True
analyzer_start = False
config.generator_size = 64  # Change the size of the maps generated

#Cache
config.clear_cache = True

#Generator
mp = maps[chosen_map]
#Chooses map for generation

#Simulator
config.load_simulator = sim_start
config.simulator_graphics = True
# config.simulator_initial_map, config.simulator_grid_display = mp
# config.simulator_algorithm_type, config.simulator_testing_type, config.simulator_algorithm_parameters = algo
# config.simulator_key_frame_speed, config.simulator_key_frame_skip = ani
config.simulator_write_debug_level = debug

#Generator
config.generator = gen_start
if config.generator_house_expo:
    gen_map = '_house_expo'
    config.generator_labelling_atlases = [gen_map]
    config.generator_nr_of_examples = nbr_ex

else:
    gen_map = gen_maps[chosen_map]
    config.generator_labelling_atlases = [gen_map + '_' + str(nbr_ex)]