Beispiel #1
0
def test_delay_prob():
    assert delay_prob(arr=DM1(lamb=1.2),
                      ser=ConstantRateServer(2.0),
                      theta=1.0,
                      delay_value=3,
                      indep=True) == pytest.approx(0.01318567256)

    assert delay_prob(arr=DM1(lamb=1.2),
                      ser=ConstantRateServer(3.0),
                      theta=1.0,
                      delay_value=3,
                      indep=True) == pytest.approx(0.0001759785367)

    assert delay_prob(arr=DM1(lamb=1.2),
                      ser=ConstantRateServer(3.0),
                      theta=0.5,
                      delay_value=3,
                      indep=False,
                      p=2.0) == pytest.approx(0.0244991068)

    assert delay_prob(arr=DM1(lamb=1.0),
                      ser=ConstantRateServer(1.6),
                      theta=0.6,
                      delay_value=10,
                      indep=True) == pytest.approx(0.001583639096)

    assert delay_prob(arr=DM1(lamb=1.2),
                      ser=ConstantRateServer(1.2),
                      theta=0.5,
                      delay_value=10,
                      indep=True) == pytest.approx(0.04188492703)
Beispiel #2
0
def test_backlog_prob():
    assert backlog_prob(arr=DM1(lamb=1.2),
                        ser=ConstantRateServer(2.0),
                        theta=1.0,
                        backlog_value=3.0,
                        indep=True) == pytest.approx(0.2648413131)

    assert backlog_prob(arr=DM1(lamb=1.2),
                        ser=ConstantRateServer(3.0),
                        theta=1.0,
                        backlog_value=3.0,
                        indep=True) == pytest.approx(0.07099480875)

    assert backlog_prob(arr=DM1(lamb=1.2),
                        ser=ConstantRateServer(3.0),
                        theta=0.5,
                        backlog_value=3.0,
                        indep=False,
                        p=2.0) == pytest.approx(0.4920777142)

    assert backlog_prob(arr=DM1(lamb=1.0),
                        ser=ConstantRateServer(1.6),
                        theta=0.6,
                        backlog_value=10.0,
                        indep=True) == pytest.approx(0.05795839492)

    assert backlog_prob(arr=DM1(lamb=1.2),
                        ser=ConstantRateServer(1.2),
                        theta=0.5,
                        backlog_value=10.0,
                        indep=True) == pytest.approx(0.113855036)
Beispiel #3
0
def test_leftover_rho():
    assert LeftoverARB(ser=ConstantRateServer(2.0),
                       cross_arr=DM1(lamb=1.2),
                       indep=True,
                       p=1.0).rho(theta=0.5) == pytest.approx(0.9220069985)

    assert LeftoverARB(ser=ConstantRateServer(2.0),
                       cross_arr=DM1(lamb=1.2),
                       indep=False,
                       p=2.0).rho(theta=0.5) == pytest.approx(0.2082405308)

    assert LeftoverARB(ser=ConstantRateServer(2.0),
                       cross_arr=DM1(lamb=1.2),
                       indep=False,
                       p=1.1).rho(theta=0.5) == pytest.approx(0.8852645948)
Beispiel #4
0
def test_output():
    assert output(arr=DM1(lamb=1.2),
                  ser=ConstantRateServer(2.0),
                  theta=1.0,
                  delta_time=3,
                  indep=True) == pytest.approx(1149.007674)

    assert output(arr=DM1(lamb=1.2),
                  ser=ConstantRateServer(3.0),
                  theta=1.0,
                  delta_time=3,
                  indep=True) == pytest.approx(308.0092721)

    assert output(arr=DM1(lamb=1.2),
                  ser=ConstantRateServer(3.0),
                  theta=0.5,
                  delta_time=3,
                  indep=False,
                  p=2.0) == pytest.approx(32.41173617)
Beispiel #5
0
    def helper_function(rate: float):
        if opt_method == OptMethod.GRID_SEARCH:
            if indep:
                single_server = SingleServerBandwidth(
                    arr_list=arr_list,
                    s_e2e=ConstantRateServer(rate=rate),
                    perform_param=PerformParameter(
                        perform_metric=PerformEnum.DELAY_PROB,
                        value=target_delay),
                    indep=True,
                    geom_series=geom_series)

                current_delay_prob = Optimize(setting=single_server,
                                              number_param=1).grid_search(
                                                  grid_bounds=[(0.1, 5.0)],
                                                  delta=0.1)
            else:
                single_server = SingleServerBandwidth(
                    arr_list=arr_list,
                    s_e2e=ConstantRateServer(rate=rate),
                    perform_param=PerformParameter(
                        perform_metric=PerformEnum.DELAY_PROB,
                        value=target_delay),
                    indep=False,
                    geom_series=geom_series)

                current_delay_prob = Optimize(setting=single_server,
                                              number_param=2).grid_search(
                                                  grid_bounds=[(0.1, 5.0),
                                                               (1.1, 5.0)],
                                                  delta=0.1)

        else:
            raise NotImplementedError("This optimization method is not "
                                      "implemented")

        return current_delay_prob - target_delay_prob
            "h_mit_bound": new_bound
        },
        index=perform_param_list.values_list)

    return delay_bounds_df


if __name__ == '__main__':
    OUTPUT_LIST = PerformParamList(perform_metric=PerformEnum.OUTPUT,
                                   values_list=list(range(4, 15)))

    print(
        perform_param_list_to_csv(prefix="single_",
                                  data_frame_creator=single_server_df,
                                  arr_list=[DM1(lamb=3.8, m=1)],
                                  ser_list=[ConstantRateServer(rate=3.0)],
                                  perform_param_list=OUTPUT_LIST,
                                  opt_method=OptMethod.GRID_SEARCH))

    print(
        perform_param_list_to_csv(
            prefix="single_",
            data_frame_creator=single_server_df,
            arr_list=[MMOOCont(mu=8.0, lamb=12.0, peak_rate=3.0, m=1)],
            ser_list=[ConstantRateServer(rate=1.5)],
            perform_param_list=OUTPUT_LIST,
            opt_method=OptMethod.GRID_SEARCH))

    RATE_1 = ConstantRateServer(rate=1.0)

    print(
Beispiel #7
0
def csv_msob_fp_param(name: str,
                      number_flows: int,
                      number_servers: int,
                      arrival_enum: ArrivalEnum,
                      perform_param: PerformParameter,
                      opt_method: OptMethod,
                      mc_dist: MonteCarloDist,
                      comparator: callable,
                      compare_metric: ChangeEnum,
                      total_iterations: int,
                      target_util: float,
                      filter_standard_inf=False) -> dict:
    """Chooses parameters by Monte Carlo type random choice."""
    param_array = mc_enum_to_dist(arrival_enum=arrival_enum,
                                  mc_dist=mc_dist,
                                  number_flows=number_flows,
                                  number_servers=number_servers,
                                  total_iterations=total_iterations)

    res_array = np.empty([total_iterations, 3])
    # 3 approaches to compare

    for i in tqdm(range(total_iterations), total=total_iterations):
        if arrival_enum == ArrivalEnum.DM1:
            arr_list = [
                DM1(lamb=param_array[i, j]) for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.DGamma1:
            arr_list = [
                DGamma1(alpha_shape=param_array[i, j],
                        beta_rate=param_array[i, number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.DWeibull1:
            arr_list = [
                DWeibull1(lamb=param_array[i, j]) for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MD1:
            arr_list = [
                MD1(lamb=param_array[i, j], mu=1.0)
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOODisc:
            arr_list = [
                MMOODisc(stay_on=param_array[i, j],
                         stay_off=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOOFluid:
            arr_list = [
                MMOOCont(mu=param_array[i, j],
                         lamb=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        else:
            raise NotImplementedError(f"Arrival parameter {arrival_enum.name} "
                                      f"is infeasible")

        ser_list = [
            ConstantRateServer(
                rate=param_array[i,
                                 arrival_enum.number_parameters() *
                                 number_flows + j])
            for j in range(number_servers)
        ]

        if name == "overlapping_tandem":
            setting = OverlappingTandemPerform(arr_list=arr_list,
                                               ser_list=ser_list,
                                               perform_param=perform_param)

        elif name == "square":
            setting = SquarePerform(arr_list=arr_list,
                                    ser_list=ser_list,
                                    perform_param=perform_param)
        else:
            raise NotImplementedError("this topology is not implemented")

        computation_necessary = True

        if target_util > 0.0:
            util = setting.approximate_utilization()
            if util < target_util or util > 1:
                res_array[i, ] = np.nan
                computation_necessary = False

        if computation_necessary:
            # standard_bound, server_bound, fp_bound = compare_avoid_dep()
            res_array[i, 0], res_array[i, 1], res_array[i, 2] = comparator(
                setting=setting)

            if (perform_param.perform_metric == PerformEnum.DELAY_PROB
                    and np.nanmin(res_array[i, ]) > 1.0):
                # np.nanmin(res_array[i, ]) is the smallest value
                res_array[i, ] = np.nan
            elif np.nanmin(res_array[i, ]) == inf:
                res_array[i, ] = np.nan

            if filter_standard_inf and res_array[i, 0] == inf:
                res_array[i, ] = np.nan

    res_array_no_full_nan = remove_full_nan_rows(full_array=res_array)
    valid_iterations = res_array_no_full_nan.shape[0]

    if valid_iterations < total_iterations * 0.2:
        warn(f"Many nan's: {total_iterations - valid_iterations} nans "
             f"out of {total_iterations}!")

        if valid_iterations < 100:
            raise NotEnoughResults("result is useless")

    res_name = name
    res_name += f"_res_array_{perform_param.to_name()}_" \
        f"{arrival_enum.name}_validiter_{valid_iterations}"

    if filter_standard_inf:
        res_name += "_filter_standard_inf"

    np.savetxt(fname=res_name + ".csv", X=res_array_no_full_nan, delimiter=",")

    res_dict = msob_fp_array_to_results(title=name,
                                        arrival_enum=arrival_enum,
                                        perform_param=perform_param,
                                        opt_method=opt_method,
                                        mc_dist=mc_dist,
                                        param_array=param_array,
                                        res_array=res_array,
                                        number_flows=number_flows,
                                        number_servers=number_servers,
                                        compare_metric=compare_metric)

    res_dict.update({
        "iterations": total_iterations,
        "target_util": target_util,
        "T": perform_param.value,
        "optimization": opt_method.name,
        "compare_metric": compare_metric.name,
        "MCDistribution": mc_dist.to_name(),
        "MCParam": mc_dist.param_to_string()
    })

    filename = name
    filename += f"_results_{perform_param.to_name()}_{arrival_enum.name}_" \
        f"MC{mc_dist.to_name()}_{opt_method.name}_" \
                f"{compare_metric.name}_util_{target_util}"

    if filter_standard_inf:
        filename += "_filter_standard_inf"

    with open(filename + ".csv", 'w') as csv_file:
        writer = csv.writer(csv_file)
        for key, value in res_dict.items():
            writer.writerow([key, value])

    return res_dict
    def approximate_utilization(self) -> float:
        sum_average_rates = 0.0
        for arrival in self.arr_list:
            sum_average_rates += arrival.average_rate()

        return sum_average_rates / self.server.rate

    def to_string(self) -> str:
        return self.to_name() + "_" + self.arr_list[0].to_value(
        ) + "_" + self.server.to_value() + self.perform_param.__str__()


if __name__ == '__main__':
    EXP_ARRIVAL1 = [DM1(lamb=1.0)]
    CONST_RATE16 = ConstantRateServer(rate=1.6)
    OUTPUT_4 = PerformParameter(perform_metric=PerformEnum.OUTPUT, value=4)
    EX_OUTPUT = SingleServerMitPerform(arr_list=EXP_ARRIVAL1,
                                       server=CONST_RATE16,
                                       perform_param=OUTPUT_4)
    print(EX_OUTPUT.standard_bound(param_list=[0.5]))
    print(EX_OUTPUT.h_mit_bound(param_l_list=[0.5, 1.2]))

    DELAY_PROB_4 = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
                                    value=4)
    EX_DELAY_PROB = SingleServerMitPerform(arr_list=EXP_ARRIVAL1,
                                           server=CONST_RATE16,
                                           perform_param=DELAY_PROB_4)
    print(EX_DELAY_PROB.standard_bound(param_list=[0.5]))
    print(EX_DELAY_PROB.h_mit_bound(param_l_list=[0.5, 1.2]))
Beispiel #9
0
def csv_fat_cross_param_power(name: str, arrival_enum: ArrivalEnum,
                              number_flows: int, number_servers: int,
                              perform_param: PerformParameter,
                              opt_method: OptMethod, mc_dist: MonteCarloDist,
                              compare_metric: ChangeEnum,
                              total_iterations: int,
                              target_util: float) -> dict:
    """Chooses parameters by Monte Carlo type random choice."""
    param_array = mc_enum_to_dist(arrival_enum=arrival_enum,
                                  mc_dist=mc_dist,
                                  number_flows=number_flows,
                                  number_servers=number_servers,
                                  total_iterations=total_iterations)

    res_array = np.empty([total_iterations, 2])

    # print(res_array)

    for i in tqdm(range(total_iterations), total=total_iterations):
        if arrival_enum == ArrivalEnum.DM1:
            arr_list = [
                DM1(lamb=param_array[i, j]) for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.DGamma1:
            arr_list = [
                DGamma1(alpha_shape=param_array[i, j],
                        beta_rate=param_array[i, number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.DWeibull1:
            arr_list = [
                DWeibull1(lamb=param_array[i, j]) for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MD1:
            arr_list = [
                MD1(lamb=param_array[i, j], mu=1.0)
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOODisc:
            arr_list = [
                MMOODisc(stay_on=param_array[i, j],
                         stay_off=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOOFluid:
            arr_list = [
                MMOOCont(mu=param_array[i, j],
                         lamb=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.Massoulie:
            arr_list = [
                LeakyBucketMassoulie(sigma_single=param_array[i, j],
                                     rho_single=param_array[i,
                                                            number_flows + j],
                                     m=20) for j in range(number_flows)
            ]
            # NOTE: n is fixed

        elif arrival_enum == ArrivalEnum.TBConst:
            arr_list = [
                DetermTokenBucket(sigma_single=param_array[i, j],
                                  rho_single=param_array[i, number_flows + j],
                                  m=1) for j in range(number_flows)
            ]

        else:
            raise NotImplementedError(f"Arrival parameter {arrival_enum.name} "
                                      f"is infeasible")

        ser_list = [
            ConstantRateServer(
                rate=param_array[i,
                                 arrival_enum.number_parameters() *
                                 number_flows + j])
            for j in range(number_servers)
        ]

        fat_cross_setting = FatCrossPerform(arr_list=arr_list,
                                            ser_list=ser_list,
                                            perform_param=perform_param)

        computation_necessary = True

        if target_util > 0.0:
            util = fat_cross_setting.approximate_utilization()
            if util < target_util or util > 1:
                res_array[i, ] = np.nan
                computation_necessary = False

        if computation_necessary:
            # standard_bound, h_mit_bound = compare_mitigator()
            res_array[i, 0], res_array[i, 1] = compare_mitigator(
                setting=fat_cross_setting,
                opt_method=opt_method,
                number_l=number_servers - 1)

            if (perform_param.perform_metric == PerformEnum.DELAY_PROB
                    and res_array[i, 1] > 1.0):
                # write as nan if second (in particular both) value(s) are > 1.0
                res_array[i, ] = np.nan

        if np.isnan(res_array[i, 0]) or np.isnan(res_array[i, 1]):
            res_array[i, ] = np.nan

    res_array_no_full_nan = remove_full_nan_rows(full_array=res_array)
    valid_iterations = res_array_no_full_nan.shape[0]

    if valid_iterations < total_iterations * 0.2:
        warn(f"Many nan's: {total_iterations - valid_iterations} nans "
             f"out of {total_iterations}!")

        if valid_iterations < 100:
            raise NotEnoughResults("result is useless")

    res_dict = two_col_array_to_results(arrival_enum=arrival_enum,
                                        param_array=param_array,
                                        res_array=res_array,
                                        number_servers=number_servers,
                                        compare_metric=compare_metric)

    res_dict.update({
        "iterations": total_iterations,
        "PerformParamValue": perform_param.value,
        "optimization": opt_method.name,
        "compare_metric": compare_metric.name,
        "MCDistribution": mc_dist.to_name(),
        "MCParam": mc_dist.param_to_string(),
        "number_servers": number_servers
    })

    filename = name
    filename += f"_results_{perform_param.to_name()}_{arrival_enum.name}_" \
                f"MC{mc_dist.to_name()}_{opt_method.name}_" \
                f"{compare_metric.name}_util_{target_util}"

    with open(filename + ".csv", 'w') as csv_file:
        writer = csv.writer(csv_file)
        for key, value in res_dict.items():
            writer.writerow([key, value])

    return res_dict
def csv_msob_fp_time(name: str, number_flows: int, number_servers: int,
                     arrival_enum: ArrivalEnum,
                     perform_param: PerformParameter, opt_method: OptMethod,
                     mc_dist: MonteCarloDist, comparator: callable,
                     total_iterations: int, target_util: float) -> dict:
    """Chooses parameters by Monte Carlo type random choice."""

    param_array = mc_enum_to_dist(arrival_enum=arrival_enum,
                                  mc_dist=mc_dist,
                                  number_flows=number_flows,
                                  number_servers=number_servers,
                                  total_iterations=total_iterations)

    time_array = np.empty([total_iterations, 3])
    # 3 approaches to compare

    for i in tqdm(range(total_iterations), total=total_iterations):
        if arrival_enum == ArrivalEnum.DM1:
            arr_list = [
                DM1(lamb=param_array[i, j]) for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MD1:
            arr_list = [
                MD1(lamb=param_array[i, j], mu=1.0)
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOODisc:
            arr_list = [
                MMOODisc(stay_on=param_array[i, j],
                         stay_off=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        elif arrival_enum == ArrivalEnum.MMOOFluid:
            arr_list = [
                MMOOCont(mu=param_array[i, j],
                         lamb=param_array[i, number_flows + j],
                         peak_rate=param_array[i, 2 * number_flows + j])
                for j in range(number_flows)
            ]

        else:
            raise NotImplementedError(f"Arrival parameter {arrival_enum.name} "
                                      f"is infeasible")

        ser_list = [
            ConstantRateServer(
                rate=param_array[i,
                                 arrival_enum.number_parameters() *
                                 number_flows + j])
            for j in range(number_servers)
        ]

        if name == "overlapping_tandem":
            setting = OverlappingTandemPerform(arr_list=arr_list,
                                               ser_list=ser_list,
                                               perform_param=perform_param)
        elif name == "square":
            setting = SquarePerform(arr_list=arr_list,
                                    ser_list=ser_list,
                                    perform_param=perform_param)
        else:
            raise NotImplementedError("this topology is not implemented")

        computation_necessary = True

        if target_util > 0.0:
            util = setting.approximate_utilization()
            if util < target_util or util > 1:
                time_array[i, ] = np.nan
                computation_necessary = False

        if computation_necessary:
            # standard_bound, server_bound, fp_bound = compare_avoid_dep()
            time_array[i, 0], time_array[i, 1], time_array[i, 2] = comparator(
                setting=setting)

            if (perform_param.perform_metric == PerformEnum.DELAY_PROB
                    and np.nanmin(time_array[i, ]) > 1.0):
                # np.nanmin(time_array[i, ]) is the smallest value
                time_array[i, ] = np.nan

    time_dict = time_array_to_results(title=name, time_array=time_array)

    time_dict.update({
        "iterations": total_iterations,
        "T": perform_param.value,
        "optimization": opt_method.name,
        "MCDistribution": mc_dist.to_name(),
        "MCParam": mc_dist.param_to_string()
    })

    filename = name
    filename += f"_time_{perform_param.to_name()}_{arrival_enum.name}" \
        f"_MC{mc_dist.to_name()}_{opt_method.name}_util_{target_util}"

    with open(filename + ".csv", 'w') as csv_file:
        writer = csv.writer(csv_file)
        for key, value in time_dict.items():
            writer.writerow([key, value])

    return time_dict
Beispiel #11
0
def test_deconvolve_sigma():
    assert Deconvolve(
        arr=DM1(lamb=1.2), ser=ConstantRateServer(2.0),
        indep=True).sigma(theta=1.0) == pytest.approx(1.671375549)
                                    delta_min=0.01)
        else:
            raise NameError(
                f"Optimization parameter {opt_method} is infeasible")

    delay_bounds_df = pd.DataFrame({"standard_bound": bound},
                                   index=perform_param_list.values_list)
    delay_bounds_df = delay_bounds_df[["standard_bound"]]

    return delay_bounds_df


if __name__ == '__main__':
    DELAY_LIST = PerformParamList(perform_metric=PerformEnum.DELAY_PROB,
                                  values_list=list(range(15, 41)))
    CONST1 = ConstantRateServer(rate=1.0)

    print(
        perform_param_list_to_csv(prefix="single_",
                                  data_frame_creator=single_server_df,
                                  arr_list=[MD1(lamb=0.8, mu=1.0)],
                                  ser_list=[CONST1],
                                  perform_param_list=DELAY_LIST,
                                  opt_method=OptMethod.GRID_SEARCH))

    print(
        perform_param_list_to_csv(prefix="single_",
                                  data_frame_creator=single_server_df,
                                  arr_list=[MM1(lamb=0.8, mu=1.0)],
                                  ser_list=[CONST1],
                                  perform_param_list=DELAY_LIST,
    from msob_and_fp.optimize_fp_bound import OptimizeFPBound
    from msob_and_fp.optimize_server_bound import OptimizeServerBound

    # from optimization.function_optimizer import optimizer_perform
    # DELAY_PROB_TIME = PerformParameter(
    #     perform_metric=PerformEnum.DELAY_PROB, value=6)
    # DELAY_PROB_TIME = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
    #                                    value=8)
    DELAY_PROB_TIME = PerformParameter(perform_metric=PerformEnum.DELAY,
                                       value=1E-3)

    ARR_LIST = [DM1(lamb=2.3), DM1(lamb=4.5), DM1(lamb=1.7), DM1(lamb=4.5)]

    SER_LIST = [
        ConstantRateServer(rate=1.2),
        ConstantRateServer(rate=6.2),
        ConstantRateServer(rate=7.3),
        ConstantRateServer(rate=6.2)
    ]

    if ARR_LIST[0].is_discrete() is False:
        raise ValueError("Distribution must be discrete")

    RANGES = [slice(0.1, 10.0, 0.1)]
    RANGES_2 = [slice(0.1, 10.0, 0.1), slice(1.1, 10.0, 0.1)]

    PRINT_X = True

    print("Utilization:")
    print(
    #                                             lamb=1.3,
    #                                             peak_rate=0.7)
    #                               ],
    #                               ser_list=[
    #                                   ConstantRateServer(rate=5.0),
    #                                   ConstantRateServer(rate=6.5),
    #                                   ConstantRateServer(rate=9.1),
    #                                   ConstantRateServer(rate=9.9)
    #                               ],
    #                               perform_param_list=DELAY_LIST))

    print(
        perform_param_list_to_csv(prefix="square_",
                                  data_frame_creator=square_df,
                                  arr_list=[
                                      MMOOCont(mu=7.2, lamb=4.8,
                                               peak_rate=4.9),
                                      MMOOCont(mu=2.5, lamb=2.1,
                                               peak_rate=3.7),
                                      MMOOCont(mu=4.1, lamb=3.1,
                                               peak_rate=1.3),
                                      MMOOCont(mu=3.3, lamb=3.3, peak_rate=1.7)
                                  ],
                                  ser_list=[
                                      ConstantRateServer(rate=5.2),
                                      ConstantRateServer(rate=6.5),
                                      ConstantRateServer(rate=9.9),
                                      ConstantRateServer(rate=3.0)
                                  ],
                                  perform_param_list=DELAY_LIST))
Beispiel #15
0
    return delay_bounds_df


if __name__ == '__main__':
    DELAY_PROB4 = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
                                   value=8)
    print(
        csv_bar_chart(ar_list=[
            DM1(lamb=0.5),
            DM1(lamb=8.0),
            DM1(lamb=8.0),
            DM1(lamb=8.0),
            DM1(lamb=8.0),
            DM1(lamb=8.0),
            DM1(lamb=8.0),
            DM1(lamb=8.0)
        ],
                      ser_list=[
                          ConstantRateServer(rate=4.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0),
                          ConstantRateServer(rate=2.0)
                      ],
                      perform_param=DELAY_PROB4,
                      opt_method=OptMethod.PATTERN_SEARCH,
                      change_metric=ChangeEnum.RATIO_REF_NEW))
Beispiel #16
0
def test_deconvolve_rho():
    assert Deconvolve(arr=DM1(lamb=1.2),
                      ser=ConstantRateServer(2.0),
                      indep=True).rho(theta=1.0) == pytest.approx(1.791759469)
Beispiel #17
0
def test_leftover_sigma():
    assert LeftoverARB(ser=ConstantRateServer(2.0),
                       cross_arr=DM1(lamb=1.2),
                       indep=False,
                       p=2.0).sigma(theta=0.5) == pytest.approx(0.0)
Beispiel #18
0
    print("list_of_bounds: ")
    return list_of_bounds


if __name__ == '__main__':
    from nc_operations.perform_enum import PerformEnum
    from nc_server.constant_rate_server import ConstantRateServer
    from nc_arrivals.iid import DM1
    from h_mitigator.fat_cross_perform import FatCrossPerform
    from h_mitigator.single_server_mit_perform import SingleServerMitPerform
    from utils.perform_parameter import PerformParameter

    OUTPUT_TIME = PerformParameter(perform_metric=PerformEnum.OUTPUT, value=4)

    EXP_ARRIVAL = [DM1(lamb=4.4)]
    CONST_RATE = ConstantRateServer(rate=0.24)

    SETTING1 = SingleServerMitPerform(arr_list=EXP_ARRIVAL,
                                      server=CONST_RATE,
                                      perform_param=OUTPUT_TIME)
    OPT_METHODS = [
        OptMethod.GRID_SEARCH, OptMethod.GS_OLD, OptMethod.PATTERN_SEARCH,
        OptMethod.BASIN_HOPPING, OptMethod.DUAL_ANNEALING,
        OptMethod.DIFFERENTIAL_EVOLUTION
    ]

    # print(
    #     compare_optimization(
    #         setting=SETTING1,
    #         opt_methods=OPT_METHODS,
    #         number_l=1))
Beispiel #19
0
def test_convolve_leftover_rho():
    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(
                        ser=ConstantRateServer(rate=3.0),
                        cross_arr=DM1(lamb=1.2))).rho(
                            theta=1.0) == pytest.approx(0.2082405308)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=2.0).rho(theta=0.5) == pytest.approx(-0.7917594692)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=1.8).rho(theta=0.5) == pytest.approx(0.5354766913)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(
                        ser=ConstantRateServer(rate=4.0),
                        cross_arr=DM1(lamb=1.2))).rho(
                            theta=1.0) == pytest.approx(1.208240531)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=4.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=2.0).rho(theta=0.5) == pytest.approx(1.208240531)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=4.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=1.8).rho(theta=0.5) == pytest.approx(1.459672932)
Beispiel #20
0
def test_convolve_leftover_sigma():
    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2))).sigma(
                                         theta=1.0) == pytest.approx(0.0)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=2.0).sigma(theta=0.5) == pytest.approx(0.0)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=1.8).sigma(theta=0.5) == pytest.approx(1.988291179)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(
                        ser=ConstantRateServer(rate=4.0),
                        cross_arr=DM1(lamb=1.2))).sigma(
                            theta=1.0) == pytest.approx(0.4586751454)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=4.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=2.0).sigma(theta=0.5) == pytest.approx(1.865504259)

    assert Convolve(ser1=LeftoverARB(ser=ConstantRateServer(rate=3.0),
                                     cross_arr=DM1(lamb=1.2)),
                    ser2=LeftoverARB(ser=ConstantRateServer(rate=4.0),
                                     cross_arr=DM1(lamb=1.2)),
                    indep=False,
                    p=1.8).sigma(theta=0.5) == pytest.approx(6.583291316)
Beispiel #21
0
    return time_standard, time_lyapunov


if __name__ == '__main__':
    from nc_arrivals.iid import DM1
    from nc_server.constant_rate_server import ConstantRateServer
    from utils.perform_parameter import PerformParameter

    from h_mitigator.fat_cross_perform import FatCrossPerform
    from h_mitigator.single_server_mit_perform import SingleServerMitPerform

    OUTPUT_TIME = PerformParameter(perform_metric=PerformEnum.OUTPUT, value=4)

    SETTING1 = SingleServerMitPerform(arr_list=[DM1(lamb=4.4)],
                                      server=ConstantRateServer(rate=0.24),
                                      perform_param=OUTPUT_TIME)

    # print(
    #     compare_mitigator(
    #         setting=SETTING1, opt_method=OptMethod.GRID_SEARCH,
    #         print_x=True))

    DELAY_PROB = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
                                  value=4)

    ARR_LIST = [DM1(lamb=11.0), DM1(lamb=9.0)]
    SER_LIST = [ConstantRateServer(rate=5.0), ConstantRateServer(rate=4.0)]

    SETTING2 = FatCrossPerform(arr_list=ARR_LIST,
                               ser_list=SER_LIST,
Beispiel #22
0
from nc_arrivals.iid import DM1
from nc_operations.single_server_perform import SingleServerPerform
from nc_operations.perform_enum import PerformEnum
from nc_server.constant_rate_server import ConstantRateServer
from optimization.optimize import Optimize
from optimization.sim_anneal_param import SimAnnealParams
from utils.perform_parameter import PerformParameter

if __name__ == '__main__':
    print("Single Server Performance Bounds:\n")

    DELAY_PROB8 = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
                                   value=8)

    SINGLE_SERVER = SingleServerPerform(foi=DM1(lamb=1.0),
                                        server=ConstantRateServer(rate=10.0),
                                        perform_param=DELAY_PROB8)

    print(
        Optimize(SINGLE_SERVER, number_param=1,
                 print_x=True).grid_search(grid_bounds=[(0.1, 5.0)],
                                           delta=0.1))

    SINGLE_SERVER2 = SingleServerPerform(foi=MMOOCont(mu=0.7,
                                                      lamb=0.4,
                                                      peak_rate=1.2),
                                         server=ConstantRateServer(rate=1.0),
                                         perform_param=DELAY_PROB8)

    print(
        Optimize(SINGLE_SERVER2, number_param=1,
                               MMOOCont(mu=4.0, lamb=8.5, peak_rate=5.3),
                               MMOOCont(mu=0.5, lamb=1.2, peak_rate=9.0)
                           ],
                           [
                               MMOOCont(mu=0.8, lamb=7.0, peak_rate=2.0),
                               MMOOCont(mu=4.0, lamb=8.5, peak_rate=5.3),
                               MMOOCont(mu=0.5, lamb=1.1, peak_rate=9.0)
                           ],
                           [
                               MMOOCont(mu=0.8, lamb=7.0, peak_rate=2.0),
                               MMOOCont(mu=4.0, lamb=8.5, peak_rate=5.3),
                               MMOOCont(mu=0.5, lamb=1.0, peak_rate=9.0)
                           ],
                           [
                               MMOOCont(mu=0.8, lamb=7.0, peak_rate=2.0),
                               MMOOCont(mu=4.0, lamb=8.5, peak_rate=5.3),
                               MMOOCont(mu=0.5, lamb=0.95, peak_rate=9.0)
                           ],
                           [
                               MMOOCont(mu=0.8, lamb=7.0, peak_rate=2.0),
                               MMOOCont(mu=4.0, lamb=8.5, peak_rate=5.3),
                               MMOOCont(mu=0.5, lamb=0.9, peak_rate=9.0)
                           ]],
            ser_list=[
                ConstantRateServer(rate=2.2),
                ConstantRateServer(rate=7.0),
                ConstantRateServer(rate=10.0)
            ],
            server_index=1,
            perform_param=DELAY3))
Beispiel #24
0
    res = scipy.optimize.bisect(helper_function,
                                a=lower_interval,
                                b=upper_interval,
                                full_output=True)
    return res[0]


if __name__ == '__main__':
    print("Single Server Performance Bounds:\n")

    DELAY6 = PerformParameter(perform_metric=PerformEnum.DELAY_PROB, value=6)

    ARR_LIST = [MMOOCont(mu=0.2, lamb=0.5, peak_rate=2.6)]

    SINGLE_SERVER = SingleServerBandwidth(arr_list=ARR_LIST,
                                          s_e2e=ConstantRateServer(rate=2.0),
                                          perform_param=DELAY6)
    RESULTING_DELAY_PROB = Optimize(SINGLE_SERVER,
                                    number_param=1,
                                    print_x=True).grid_search(grid_bounds=[
                                        (0.1, 5.0)
                                    ],
                                                              delta=0.1)
    print(f"delay probability = {RESULTING_DELAY_PROB}")

    REQUIRED_BANDWIDTH = get_bandwidth_from_delay(arr_list=ARR_LIST,
                                                  target_delay=6,
                                                  target_delay_prob=0.034,
                                                  lower_interval=0.0,
                                                  upper_interval=200.0)
    print(f"required bandwidth = {REQUIRED_BANDWIDTH}")
Beispiel #25
0
if __name__ == '__main__':
    # DELAY_PROB_LIST = PerformParamList(perform_metric=PerformEnum.DELAY_PROB,
    #                                    values_list=range(4, 11))
    DELAY_LIST = PerformParamList(perform_metric=PerformEnum.DELAY,
                                  values_list=[10**(-x) for x in range(10)])

    print(
        perform_param_list_to_csv(
            prefix="overlapping_tandem_",
            data_frame_creator=overlapping_tandem_df,
            arr_list=[DM1(lamb=2.0),
                      DM1(lamb=1.0),
                      DM1(lamb=2.0)],
            ser_list=[
                ConstantRateServer(rate=3.5),
                ConstantRateServer(rate=5.0),
                ConstantRateServer(rate=6.0)
            ],
            perform_param_list=DELAY_LIST))

    print(
        perform_param_list_to_csv(
            prefix="overlapping_tandem_",
            data_frame_creator=overlapping_tandem_df,
            arr_list=[DM1(lamb=2.3),
                      DM1(lamb=4.5),
                      DM1(lamb=1.7)],
            ser_list=[
                ConstantRateServer(rate=1.2),
                ConstantRateServer(rate=6.2),
        except (ParameterOutOfBounds, OverflowError):
            return inf


if __name__ == '__main__':
    from h_mitigator.fat_cross_perform import FatCrossPerform
    from utils.perform_parameter import PerformParameter
    from nc_operations.perform_enum import PerformEnum
    from nc_server.constant_rate_server import ConstantRateServer
    from nc_arrivals.markov_modulated import MMOOCont

    DELAY_4 = PerformParameter(perform_metric=PerformEnum.DELAY, value=0.0001)

    MMOO_1 = MMOOCont(mu=1.0, lamb=2.2, peak_rate=3.4)
    MMOO_2 = MMOOCont(mu=3.6, lamb=1.6, peak_rate=0.4)
    CONST_RATE_1 = ConstantRateServer(rate=2.0)
    CONST_RATE_2 = ConstantRateServer(rate=0.3)

    SIMPLEX_START = np.array([[0.1], [0.3]])
    # SIMPLEX_START = np.array([[100], [200]])
    SIMPLEX_START_NEW = np.array([[0.1, 2.0], [0.3, 1.2], [0.4, 1.1]])
    SIMPLEX_RAND = InitialSimplex(parameters_to_optimize=1).uniform_dist(
        max_theta=0.6, max_l=2.0)

    NM_PARAM_SET = NelderMeadParameters()

    SETTING = FatCrossPerform(arr_list=[MMOO_1, MMOO_2],
                              ser_list=[CONST_RATE_1, CONST_RATE_2],
                              perform_param=DELAY_4)

    OPTI_OLD = Optimize(setting=SETTING, number_param=1, print_x=True)
Beispiel #27
0
def csv_fat_cross_time(arrival_enum: ArrivalEnum,
                       list_number_servers: List[int],
                       perform_param: PerformParameter, opt_method: OptMethod,
                       mc_dist: MonteCarloDist, target_util: float) -> dict:
    """Chooses parameters by Monte Carlo type random choice."""
    total_iterations = 10**5

    time_ratio = {"Number_of_servers": "Ratio"}

    for number_servers in list_number_servers:
        print(f"number of servers = {number_servers}")
        # 1 Parameter for service

        param_array = mc_enum_to_dist(arrival_enum=arrival_enum,
                                      mc_dist=mc_dist,
                                      number_flows=number_servers,
                                      number_servers=number_servers,
                                      total_iterations=total_iterations)

        time_array = np.empty([total_iterations, 2])

        for i in tqdm(range(total_iterations)):
            if arrival_enum == ArrivalEnum.DM1:
                arrive_list = [
                    DM1(lamb=param_array[i, j]) for j in range(number_servers)
                ]
            elif arrival_enum == ArrivalEnum.MMOOFluid:
                arrive_list = [
                    MMOOCont(mu=param_array[i, j],
                             lamb=param_array[i, number_servers + j],
                             peak_rate=param_array[i, 2 * number_servers + j])
                    for j in range(number_servers)
                ]

            else:
                raise NotImplementedError(f"Arrival parameter "
                                          f"{arrival_enum.name} is infeasible")

            service_list = [
                ConstantRateServer(
                    rate=param_array[i,
                                     arrival_enum.number_parameters() *
                                     number_servers + j])
                for j in range(number_servers)
            ]

            fat_cross_setting = FatCrossPerform(arr_list=arrive_list,
                                                ser_list=service_list,
                                                perform_param=perform_param)

            computation_necessary = True

            # print(res_array[i, ])
            if target_util > 0.0:
                util = fat_cross_setting.approximate_utilization()
                if util < target_util or util > 1:
                    time_array[i, ] = np.nan
                    computation_necessary = False

            if computation_necessary:
                # time_standard, time_lyapunov = compare_time()
                time_array[i, 0], time_array[i, 1] = compare_time(
                    setting=fat_cross_setting,
                    opt_method=opt_method,
                    number_l=number_servers - 1)

        print(
            time_array_to_results(arrival_enum=arrival_enum,
                                  time_array=time_array,
                                  number_servers=number_servers,
                                  time_ratio=time_ratio))

    filename = (f"time_{perform_param.to_name()}_{arrival_enum.name}"
                f"_{opt_method.name}.csv")

    with open(filename, 'w') as csv_file:
        writer = csv.writer(csv_file)
        for key, value in time_ratio.items():
            writer.writerow([key, value])

    return time_ratio
Beispiel #28
0
    stop = timer()
    time_fp_bound = stop - start

    return time_standard, time_server_bound, time_fp_bound


if __name__ == '__main__':
    from nc_arrivals.iid import DM1
    from nc_server.constant_rate_server import ConstantRateServer
    from utils.perform_parameter import PerformParameter

    from msob_and_fp.overlapping_tandem_perform import OverlappingTandemPerform

    DELAY_PROB = PerformParameter(perform_metric=PerformEnum.DELAY_PROB,
                                  value=10)

    ARR_LIST = [DM1(lamb=7.0), DM1(lamb=7.0), DM1(lamb=6.0)]

    SER_LIST = [
        ConstantRateServer(rate=0.5),
        ConstantRateServer(rate=8.0),
        ConstantRateServer(rate=5.5)
    ]

    SETTING = OverlappingTandemPerform(arr_list=ARR_LIST,
                                       ser_list=SER_LIST,
                                       perform_param=DELAY_PROB)

    # print(compare_avoid_dep_211(setting=SETTING, print_x=False))
    print(compare_time_211(setting=SETTING))
Beispiel #29
0
def csv_single_param_exp(start_time: int,
                         delay: int,
                         mc_dist: MonteCarloDist,
                         target_util: float,
                         total_iterations: int,
                         sample=False) -> dict:
    valid_iterations = total_iterations
    metric = ChangeEnum.RATIO_REF_NEW
    sample_size = 10**2

    delta = 0.05

    size_array = [total_iterations, 2]
    # [rows, columns]

    if mc_dist.mc_enum == MCEnum.UNIFORM:
        param_array = np.random.uniform(low=0,
                                        high=mc_dist.param_list[0],
                                        size=size_array)
    elif mc_dist.mc_enum == MCEnum.EXPONENTIAL:
        param_array = np.random.exponential(scale=mc_dist.param_list[0],
                                            size=size_array)
    else:
        raise NameError(
            f"Distribution parameter {mc_dist.mc_enum} is infeasible")

    res_array = np.empty([total_iterations, 2])
    res_array_sample = np.empty([total_iterations, 2])

    for i in tqdm(range(total_iterations)):
        single_setting = SingleServerMitPerform(
            arr_list=[DM1(lamb=param_array[i, 0])],
            server=ConstantRateServer(rate=param_array[i, 1]),
            perform_param=PerformParameter(
                perform_metric=PerformEnum.DELAY_PROB, value=delay))

        computation_necessary = True

        # print(res_array[i, ])
        if target_util > 0.0:
            util = single_setting.approximate_utilization()
            if util < target_util or util > 1:
                res_array[i, ] = np.nan
                computation_necessary = False

        if computation_necessary:

            theta_bounds = [(0.1, 4.0)]

            res_array[i, 0] = Optimize(setting=single_setting,
                                       number_param=1).grid_search(
                                           grid_bounds=theta_bounds,
                                           delta=delta)

            res_array[i,
                      1] = delay_prob_lower_exp_dm1_opt(t=start_time,
                                                        delay=delay,
                                                        lamb=param_array[i, 0],
                                                        rate=param_array[i, 1])

            if sample:
                res_array_sample[i, 1] = delay_prob_sample_exp_dm1_opt(
                    t=start_time,
                    delay=delay,
                    lamb=param_array[i, 0],
                    rate=param_array[i, 1],
                    sample_size=sample_size)

            if res_array[i, 0] > 1.0:
                res_array[i, ] = np.nan
                if sample:
                    res_array_sample[i, ] = np.nan

        if np.isnan(res_array[i, 0]) or np.isnan(res_array[i, 1]):
            res_array[i, ] = np.nan
            res_array_sample[i, ] = np.nan
            valid_iterations -= 1

    # print("exponential results", res_array[:, 2])

    res_dict = two_col_array_to_results(arrival_enum=ArrivalEnum.DM1,
                                        param_array=param_array,
                                        res_array=res_array,
                                        number_servers=1,
                                        valid_iterations=valid_iterations,
                                        compare_metric=metric)

    res_dict.update({
        "iterations": total_iterations,
        "delta_time": delay,
        "optimization": "grid_search",
        "metric": metric.name,
        "MCDistribution": mc_dist.to_name(),
        "MCParam": mc_dist.param_to_string()
    })

    if sample:
        res_array_sample[:, 0] = res_array[:, 0]

        res_dict_sample = two_col_array_to_results(
            arrival_enum=ArrivalEnum.DM1,
            param_array=param_array,
            res_array=res_array_sample,
            number_servers=1,
            valid_iterations=valid_iterations,
            compare_metric=metric)

        res_dict_sample.update({
            "iterations": total_iterations,
            "delta_time": delay,
            "optimization": "grid_search",
            "metric": metric.name,
            "MCDistribution": mc_dist.to_name(),
            "MCParam": mc_dist.param_to_string()
        })

    suffix = f"single_DELAY_PROB_DM1_results" \
        f"_MC{mc_dist.to_name()}_power_exp.csv"

    with open("lower_" + suffix, 'w') as csv_file:
        writer = csv.writer(csv_file)
        for key, value in res_dict.items():
            writer.writerow([key, value])
    if sample:
        with open("sample_" + suffix, 'w') as csv_file:
            writer = csv.writer(csv_file)
            for key, value in res_dict_sample.items():
                writer.writerow([key, value])

    return res_dict
if __name__ == '__main__':
    from bound_evaluation.data_frame_to_csv import perform_param_list_to_csv
    from nc_arrivals.iid import DM1, MD1
    from nc_arrivals.markov_modulated import MMOOCont

    DELAY_PROB_LIST = PerformParamList(perform_metric=PerformEnum.DELAY_PROB,
                                       values_list=list(range(4, 11)))

    print(
        perform_param_list_to_csv(prefix="simple_setting_",
                                  data_frame_creator=fat_cross_perform_df,
                                  arr_list=[DM1(lamb=0.2),
                                            DM1(lamb=8.0)],
                                  ser_list=[
                                      ConstantRateServer(rate=8.0),
                                      ConstantRateServer(rate=0.2)
                                  ],
                                  perform_param_list=DELAY_PROB_LIST,
                                  opt_method=OptMethod.GRID_SEARCH))

    print(
        perform_param_list_to_csv(prefix="simple_setting_",
                                  data_frame_creator=fat_cross_perform_df,
                                  arr_list=[DM1(lamb=0.4),
                                            DM1(lamb=3.5)],
                                  ser_list=[
                                      ConstantRateServer(rate=4.5),
                                      ConstantRateServer(rate=0.4)
                                  ],
                                  perform_param_list=DELAY_PROB_LIST,