Example #1
0
def main(games_in_a_set=100000):
    for shuffle in [True, False]:
        game0 = monopoly.Game(cutoff=1000, trading_enabled=False, image_exporting=0, shuffle=shuffle, trip_to_start=True)

        trade_count = []
        winners = [0, 0, 0]
        wins1 = []
        wins2 = []
        for i in range(games_in_a_set):
            # Play game.
            player1 = monopoly.Player(1,
                                      buying_threshold=500,
                                      group_ordering=random_ordering(),

            )
            player2 = monopoly.Player(2,
                                      buying_threshold=500,
                                      group_ordering=random_ordering(),
            )

            game0.new_players([player1, player2])
            results = game0.play()

            # Store length.
            winners[results['winner']] += 1
            if results['winner'] == 1:
                wins1.append(1)
                wins2.append(0)
            elif results['winner'] == 2:
                wins1.append(0)
                wins2.append(1)
            else:
                wins1.append(0)
                wins2.append(0)

            trade_count.append(results['trade count'])

        print(mean_confidence_interval(wins1))
        print(mean_confidence_interval(wins2))
        print(winners, shuffle, sum(trade_count) / games_in_a_set)
                else:
                    past_number_of_fami[numFlow] += 1

                break
            time_unit += 30
            count += NoFlow

        retry = retry + 1
    print "Actual number of reties:", retry
    # time.sleep(3)

opt_total_cost_result = list()
opt_total_cost_err = list()

for num in opt_total_cost_dict:
    result, err = mean_confidence_interval(opt_total_cost_dict[num],
                                           confidence=0.95)
    opt_total_cost_result.append(result)
    opt_total_cost_err.append(err)

opt_comm_cost_result = list()
opt_comm_cost_err = list()

for num in opt_total_comm_cost_dict:
    result, err = mean_confidence_interval(opt_total_comm_cost_dict[num],
                                           confidence=0.95)
    opt_comm_cost_result.append(result)
    opt_comm_cost_err.append(err)

opt_buff_cost_result = list()
opt_buff_cost_err = list()
Example #3
0
def main():
    _, lower, upper = mean_confidence_interval(get_data())
    print "(%.14f, %.14f)" % (lower, upper)
Example #4
0
model = range(5)    # [1.0, 2.0, 2.1, 3.0, 3.1]
run_size = 360

average = np.zeros(shape=[5, 3, 5, 17])   # here we store the average of the output with indices indicating [Rho, Capacity, Model Version]
low_bound = np.zeros(shape=[5, 3, 5, 17])   # here we store the lower bound of the output with indices indicating [Rho, Capacity, Model Version]
up_bound = np.zeros(shape=[5, 3, 5, 17])   # here we store the upper bound of the output with indices indicating [Rho, Capacity, Model Version]

for i in rho:
    for j in cap:
        for k in model:
            temp = results[:run_size]
            temp = np.asarray(temp)
            results = results[run_size:]

            # stats of reserved instances:
            [demand_r_mean, demand_r_low, demand_r_up] = cn.mean_confidence_interval(temp[:, 0])

            [decision_r_mean, decision_r_low, decision_r_up] = cn.mean_confidence_interval(temp[:, 3])

            [state_r_mean, state_r_low, state_r_up] = cn.mean_confidence_interval(temp[:, 6])

            [state_lr_mean, state_lr_low, state_lr_up] = cn.mean_confidence_interval(temp[:, 7])

            # stats of on-demand instances:
            [demand_o_mean, demand_o_low, demand_o_up] = cn.mean_confidence_interval(temp[:, 1])

            [decision_o_mean, decision_o_low, decision_o_up] = cn.mean_confidence_interval(temp[:, 4])

            [state_o_mean, state_o_low, state_o_up] = cn.mean_confidence_interval(temp[:, 8])

            # stats of spot instances:
Example #5
0
# pickle.dump(bast_buff_cost_err, open("bast_buff_cost_err.pickle", "wb"))
#
# pickle.dump(bast_mig_time_result, open("bast_mig_time_result.pickle", "wb"))
# pickle.dump(bast_mig_time_err, open("bast_mig_time_err.pickle", "wb"))
#
# pickle.dump(bast_exec_time_result, open("bast_exec_time_result.pickle", "wb"))
# pickle.dump(bast_exec_time_err, open("bast_exec_time_err.pickle", "wb"))
#
# pickle.dump(bast_comp_cost_result, open("bast_comp_cost_result.pickle", "wb"))
# pickle.dump(bast_comp_cost_err, open("bast_comp_cost_err.pickle", "wb"))

base_total_cost_result = list()
base_total_cost_err = list()

for num in base_total_cost_dict:
    result, err = mean_confidence_interval(base_total_cost_dict[num],
                                           confidence=0.95)
    base_total_cost_result.append(result)
    base_total_cost_err.append(err)

base_comm_cost_result = list()
base_comm_cost_err = list()

for num in base_total_comm_cost_dict:
    result, err = mean_confidence_interval(base_total_comm_cost_dict[num],
                                           confidence=0.95)
    base_comm_cost_result.append(result)
    base_comm_cost_err.append(err)

base_buff_cost_result = list()
base_buff_cost_err = list()