Exemplo n.º 1
0
def on_start_simple_clicked(_):
    # "linking function with output"
    res_out.value = ''
    with out:
        # what happens when we press the button
        clear_output()
        settings = {
            'file': txt_eventlog.value,
            'epsilon': sl_epsilon.value,
            'eta': sl_eta.value,
            'alg_manag': sl_alg_manag.value,
            'repetitions': sl_rep.value,
            'simulation': True
        }
        change_enablement(box_simple, True)
        results = sim.single_exec(settings)
    df = pd.DataFrame.from_records(results)
    df = df[df.status == 'ok']
    similarity = lambda x: 1 - x['loss']
    df['similarity'] = df.apply(similarity, axis=1)
    df = df[['alg_manag', 'epsilon', 'eta',
             'similarity']].sort_values(by=['similarity'], ascending=False)
    res_out.value = df.to_html(classes="table table-borderless table-sm",
                               float_format='%.3f',
                               border=0,
                               index=False)
    # Reactivate controls
    change_enablement(box_simple, False)
Exemplo n.º 2
0
def main(argv):
    settings = dict()
    args = dict()
    # Exec mode 'single', 'optimizer'
    settings['exec_mode'] = 'single'
#   Parameters setting manual fixed or catched by console for batch operations
    if not argv:
    #   Event-log filename    
        settings['file'] = 'Production.xes.gz'
        settings['repetitions'] = 1
        settings['simulation'] = True
        if settings['exec_mode'] == 'single':
        #   Splittminer settings [0..1]   
            settings['epsilon'] = 0.7
            settings['eta'] = 0.7
        #   'removal', 'replacement', 'repairment'
            settings['alg_manag'] = 'removal'
            # Single Execution
            sim.single_exec(settings)
        else:
            args['epsilon'] = [0.3, 0.7]
            args['eta'] = [0.3, 0.7]
            args['max_eval'] = 2
            settings['temp_file'] = sup.folder_id()
            # Execute optimizer
            if not os.path.exists(os.path.join('outputs', settings['temp_file'])):
                open(os.path.join('outputs', settings['temp_file']), 'w').close()
                sim.hyper_execution(settings, args)
    else:
#       Catch parameters by console
        try:
            opts, _ = getopt.getopt(argv, "hf:e:n:m:r:",
                  ['eventlog=', "epsilon=", "eta=", "alg_manag=", "repetitions="])
            for opt, arg in opts:
                key = catch_parameter(opt)
                if key in ['epsilon','eta']:
                    settings[key] = float(arg)
                elif key == 'repetitions':
                    settings[key] = int(arg)
                else:
                    settings[key] = arg
        except getopt.GetoptError:
            print('Invalid option')
            sys.exit(2)
        settings['simulation'] = True
        sim.single_exec(settings)
Exemplo n.º 3
0
def main(argv):
    settings = dict()
    args = dict()
    settings = define_general_settings(settings)
    # Exec mode 'single', 'optimizer'
    settings['exec_mode'] = 'optimizer'
    # Similarity metric 'tsd', 'dl_mae', 'tsd_min', 'mae'
    settings['sim_metric'] = 'tsd_min'
    # Parameters settled manually or catched by console for batch operations
    if not argv:
        # Event-log filename
        settings['file'] = 'Production.xes'
        settings['repetitions'] = 2
        settings['simulation'] = True
        if settings['exec_mode'] == 'single':
            # gateways probabilities 'discovery', 'random', 'equiprobable'
            settings['gate_management'] = 'equiprobable'
            # Similarity btw the resources profile execution (Song e.t. all)
            settings['rp_similarity'] = 0.5
            # Splitminer settings [0..1] default epsilon = 0.1, eta = 0.4
            settings['epsilon'] = 0.1
            settings['eta'] = 0.4
            # 'removal', 'replacement', 'repair'
            settings['alg_manag'] = 'removal'
            # Processing time definition method:
            # 'manual', 'automatic', 'semi-automatic'
            settings['pdef_method'] = 'automatic'
            # temporal file for results
            settings['temp_file'] = sup.file_id(prefix='SE_')
            # Single Execution
            simod = sim.Simod(settings)
            simod.execute_pipeline(settings['exec_mode'])
        elif settings['exec_mode'] == 'optimizer':
            args['epsilon'] = [0.0, 1.0]
            args['eta'] = [0.0, 1.0]
            args['max_eval'] = 3
            # Similarity btw the resources profile execution (Song e.t. all)
            args['rp_similarity'] = [0.5, 0.9]
            args['gate_management'] = ['discovery', 'random', 'equiprobable']
            settings['temp_file'] = sup.file_id(prefix='OP_')
            settings['pdef_method'] = 'automatic'
            # Execute optimizer
            if not os.path.exists(
                    os.path.join('outputs', settings['temp_file'])):
                open(os.path.join('outputs', settings['temp_file']),
                     'w').close()
                # sim.hyper_execution(settings, args)
                optimizer = sim.DiscoveryOptimizer(settings, args)
                optimizer.execute_trials()
    else:
        # Catch parameters by console
        try:
            opts, _ = getopt.getopt(argv, "hf:e:n:m:r:", [
                'eventlog=', "epsilon=", "eta=", "alg_manag=", "repetitions="
            ])
            for opt, arg in opts:
                key = catch_parameter(opt)
                if key in ['epsilon', 'eta']:
                    settings[key] = float(arg)
                elif key == 'repetitions':
                    settings[key] = int(arg)
                else:
                    settings[key] = arg
        except getopt.GetoptError:
            print('Invalid option')
            sys.exit(2)
        settings['simulation'] = True
        sim.single_exec(settings)