Example #1
0
                model.value_iteration(0.1)

        if time % 500 == 1 and time > split_step:
            if split_strategy == "always":
                model.reset_decision_tree()
                model.chain_split()
            elif split_strategy == "start_chain":
                model.chain_split()
            else:
                model.value_iteration(0.1)

        if time > training_steps:
            total_reward += reward

        if PRINT and time > training_steps:
            print scenario.get_incoming_load(), scenario.get_current_capacity(), \
                  100 * meas[PC_READ_LOAD], 100 * meas[IO_PER_SEC]

    total_splits = 0
    good_splits  = 0
    marg_splits  = 0
    splits = model.get_splits_per_parameter()
    for par, s in splits.iteritems():
        total_splits += s
        if par in scenario.get_relevant_params():
            good_splits += s
        if par in scenario.get_marginal_params():
            marg_splits += s

    if not PRINT:
        print "Reward:", total_reward, "Total splits:", total_splits, "Good splits:", good_splits, "Marginal splits:", marg_splits
Example #2
0
        if time % 500 == 1 and time > split_step:
            if split_strategy == "always":
                model.reset_decision_tree()
                model.chain_split()
            elif split_strategy == "start_chain":
                model.chain_split()
            else:
                model.value_iteration(0.1)

        if time > training_steps:
            total_reward += reward

        if PRINT and time > training_steps:
            print(scenario.get_incoming_load(),
                  scenario.get_current_capacity(), 100 * meas[PC_READ_LOAD],
                  100 * meas[IO_PER_SEC])

    total_splits = 0
    good_splits = 0
    marg_splits = 0
    splits = model.get_splits_per_parameter()
    for par, s in splits.items():
        total_splits += s
        if par in scenario.get_relevant_params():
            good_splits += s
        if par in scenario.get_marginal_params():
            marg_splits += s

    if not PRINT:
        print("Reward:", total_reward, "Total splits:", total_splits,