'CON-10+': (2,
                    PandemicSimOpts(use_contact_tracer=True,
                                    contact_tracer_history_size=10,
                                    spontaneous_testing_rate=0.3)),
        'SICK++': (1, PandemicSimOpts(spontaneous_testing_rate=1.)),
    }

    param_labels, strategies, sim_opts = zip(
        *[(k, v[0], v[1]) for k, v in name_to_strategy_sim_opt.items()])

    opts = EvaluationOpts(num_seeds=1,
                          strategies=strategies,
                          pandemic_regulations=regulations,
                          sim_opts=sim_opts,
                          max_episode_length=10,
                          enable_warm_up=False)

    experiment_name = 'contact_tracing'
    try:
        evaluate_strategies(experiment_name, opts)
    except ValueError:
        # Expect a value error because we are reusing the same directory.
        pass
    make_evaluation_plots(exp_name=experiment_name,
                          data_saver_path=opts.data_saver_path,
                          param_labels=param_labels,
                          bar_plot_xlabel='Contact Tracing',
                          show_cumulative_reward=False,
                          annotate_stages=False)
    plt.show()
Exemple #2
0
            experiment_name = name + '_sensitivity'
            eval_fn(exp_name=experiment_name, eval_opts=opts)
        except ValueError:
            # Expect a value error because we are reusing the same directory.
            pass

    for name, (eval_fn, param_labels,
               xlabel) in name_to_eval_fn_labels.items():
        experiment_name = name + '_sensitivity'
        if name == 'social_gatherings':
            loader = H5DataLoader(experiment_name, path=opts.data_saver_path)
            data = list(loader.get_data())
            data = data[0:1] + data[-2:]
            param_labels = param_labels[0:1] + param_labels[-2:]
            make_evaluation_plots_from_data(data=data[:5],
                                            exp_name=experiment_name,
                                            param_labels=param_labels,
                                            bar_plot_xlabel=xlabel,
                                            show_summary_plots=False,
                                            show_cumulative_reward=False,
                                            show_pandemic_duration=False)
        else:
            make_evaluation_plots(exp_name=experiment_name,
                                  data_saver_path=opts.data_saver_path,
                                  param_labels=param_labels,
                                  bar_plot_xlabel=xlabel,
                                  show_summary_plots=False,
                                  show_cumulative_reward=False)

    plt.show()
if __name__ == '__main__':
    swedish_strategy = [StageSchedule(stage=0, end_day=3),
                        StageSchedule(stage=1, end_day=None)]
    italian_strategy = [StageSchedule(stage=0, end_day=3),
                        StageSchedule(stage=1, end_day=8),
                        StageSchedule(stage=2, end_day=13),
                        StageSchedule(stage=3, end_day=25),
                        StageSchedule(stage=4, end_day=59),
                        StageSchedule(stage=3, end_day=79),
                        StageSchedule(stage=2, end_day=None)]

    opts = EvaluationOpts(
        num_seeds=30,
        max_episode_length=180,
        enable_warm_up=False
    )

    exp_name = 'swedish_italian_strategies'
    try:
        eval_government_strategies(exp_name, opts)
    except ValueError:
        # Expect a value error because we are reusing the same directory.
        pass
    make_evaluation_plots(exp_name=exp_name, data_saver_path=opts.data_saver_path, param_labels=['SWE', 'ITA'],
                          bar_plot_xlabel='Real Government Strategies',
                          annotate_stages=True,
                          show_cumulative_reward=False,
                          show_time_to_peak=False, show_pandemic_duration=True,
                          )
    plt.show()
Exemple #4
0
                    exp_id=1)


if __name__ == '__main__':
    austin_strategy = [StageSchedule(stage=0, end_day=3),
                       StageSchedule(stage=1, end_day=8),
                       StageSchedule(stage=2, end_day=13),
                       StageSchedule(stage=3, end_day=25),
                       StageSchedule(stage=4, end_day=59),
                       StageSchedule(stage=3, end_day=79),
                       StageSchedule(stage=2, end_day=None)]

    opts = EvaluationOpts(
        num_seeds=30,
        max_episode_length=180,
        enable_warm_up=False
    )

    exp_name = 'bar impact'
    try:
        eval_government_strategies(exp_name, opts)
    except ValueError:
        pass
    make_evaluation_plots(exp_name=exp_name, data_saver_path=opts.data_saver_path, param_labels=[' '],
                          bar_plot_xlabel='Bar Impact Strategy',
                          annotate_stages=True,
                          show_cumulative_reward=False,
                          show_time_to_peak=True, show_pandemic_duration=True,
                          )
    plt.show()