def test_validation_script_run_validation_bs_hedgehog_mip_mpc():
    """Test run validation, including saving files, for Big Step Hedgehog agent."""
    hedgehog_param_overrides \
        = "{'HedgehogHyperParams': {'mpc_policy_class_name': 'FeedbackMipFeasibleMpcPolicy'}}"
    args = get_args('bs_hedgehog', hedgehog_param_overrides)
    args = validation_script.process_parsed_args(args)
    validation_script.run_validation(args)
def test_validation_script_run_validation_pf_stationary_hedgehog_empty_params_overrides():
    """Test run validation, including saving files, for Pure Feedback with MIP Hedgehog agent."""
    hedgehog_param_overrides \
        = "{'AsymptoticCovarianceParams': {'num_batch': 10, 'num_presimulation_steps': 100}," \
          "'StrategicIdlingParams': {'strategic_idling_class': 'StrategicIdlingHedging'}," \
          "'HedgehogHyperParams': {'activity_rates_policy_class_name': 'BigStepPolicy'," \
          "'horizon_mpc_ratio': 0,'minimum_horizon': 1}}"
    args = get_args("pf_stationary_hedgehog", hedgehog_param_overrides)
    args = validation_script.process_parsed_args(args)
    validation_script.run_validation(args)
def test_validation_script_run_validation_pf_hedgehog():
    """Test run validation, including saving files, for Pure Feedback with MIP Hedgehog agent."""
    hedgehog_param_overrides \
        = "{'BigStepPenaltyPolicyParams': {'boolean_action_flag': True}," \
          "'HedgehogHyperParams': {'activity_rates_policy_class_name': 'BigStepPolicy'," \
          "'horizon_drain_time_ratio': 0, 'horizon_mpc_ratio': 0, 'minimum_horizon': 1}," \
          "'AsymptoticCovarianceParams': {'num_batch': 10, 'num_presimulation_steps': 100}," \
          "'StrategicIdlingParams': {'strategic_idling_class': 'StrategicIdlingHedging'}}"
    args = get_args('pf_mip_hedgehog', hedgehog_param_overrides)
    args = validation_script.process_parsed_args(args)
    validation_script.run_validation(args)
Ejemplo n.º 4
0
    fig, axes = plt.subplots(1, 1, figsize=(8, 5))

    # plot cross-correlations
    ax = axes
    for buffer in range(n_buffer):
        ax.xcorr(arrivals_buffer1,
                 state[:, buffer],
                 normed=False,
                 maxlags=None,
                 usevlines=False,
                 linestyle='-',
                 marker='',
                 label=f'Buffer {buffer+1}')
    ax.set_title(
        'Cross-correlations between buffer 1 arrivals and buffer queue lengths'
    )
    ax.set_xlabel(r'Time interval $h$')
    ax.set_ylabel(r'$Q(t+h)\cdot \alpha_1(t)$')
    ax.legend()
    ax.set_xlim([0, n_step])
    ax.set_ylim([0, None])
    plt.tight_layout()
    plt.savefig('correlational_analysis.png')
    plt.show()


if __name__ == "__main__":
    save_locations = run_validation(args)
    data_fname = os.path.join(save_locations['bs_hedgehog'], 'datadict.json')
    run_correlational_analysis(data_fname)
def test_validation_script_run_validation_bs_hedgehog():
    """Test run validation, including saving files, for Big Step Hedgehog agent."""
    args = get_args('bs_hedgehog')
    args = validation_script.process_parsed_args(args)
    validation_script.run_validation(args)
def test_validation_script_run_validation_maxweight():
    """Test run validation, including saving files, for MaxWeight agent."""
    args = get_args('maxweight')
    args = validation_script.process_parsed_args(args)
    validation_script.run_validation(args)
def test_validation_script_run_validation_pf_hedgehog_wrong_params(hh_wrong_overrides_fixture,
                                                                   pf_agent_fixture):
    args = get_args(pf_agent_fixture, hh_wrong_overrides_fixture)
    args = validation_script.process_parsed_args(args)
    with pytest.raises(AssertionError):
        validation_script.run_validation(args)