Example #1
0
def main_simulate():
    """Function called to perform the simulation.
    """
    tic = time()

    base_name = ("IA_stream_sel_results_{SNR}_{M}-{modulator}_{Nr}x{Nt}_({Ns})"
                 "_MaxIter_{max_iterations}_({initialize_with})")

    runner = IASimulationRunner('greedy_config_file.txt')
    runner.set_results_filename("greedy_{0}".format(base_name))

    simulate_do_what_i_mean(runner, parent_dir)

    toc = time()
    print("Total Elapsed Time: {0}".format(misc.pretty_time(toc - tic)))
Example #2
0
def main_simulate():
    """Function called to perform the simulation.
    """
    tic = time()

    base_name = (
        "IA_stream_sel_results_{SNR}_{M}-{modulator}_{Nr}x{Nt}_({Ns})" "_MaxIter_{max_iterations}_({initialize_with})"
    )

    runner = IASimulationRunner("greedy_config_file.txt")
    runner.set_results_filename("greedy_{0}".format(base_name))

    simulate_do_what_i_mean(runner, parent_dir)

    toc = time()
    print("Total Elapsed Time: {0}".format(misc.pretty_time(toc - tic)))
Example #3
0
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# xxxxxxxxxxxxxxx Main xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if __name__ == '__main__':
    # noinspection PyUnresolvedReferences
    from apps.comp_BD.simulate_comp import BDSimulationRunner

    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # File name (without extension) for the figure and result files.
    results_filename = 'bd_results_{Nr}x{Nt}_ext_int_rank_{ext_int_rank}'
    runner = BDSimulationRunner()
    runner.set_results_filename(results_filename)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    simulate_do_what_i_mean(runner, pyphysim_dir)

    if runner.command_line_args.index is None:
        print("Runned iterations: {0}".format(runner.runned_reps))
        print("Elapsed Time: {0}".format(runner.elapsed_time))

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if __name__ == '__main__1':
    try:
        # noinspection PyUnresolvedReferences
        from matplotlib import pyplot as plt
        _MATPLOTLIB_AVAILABLE = True
    except ImportError:
        _MATPLOTLIB_AVAILABLE = False

    # xxxxxxxxxx Parameters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Example #4
0
def main_simulate(algorithms_to_simulate):
    """
    Function called to perform the simulation.

    Parameters
    ----------
    algorithms_to_simulate : list[str]
        List with the names of the algorithms to simulate.
    """
    tic = time()
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    all_simulation_runner_objs = []

    # xxxxxxxxxx Closed Form Runner xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    if "Closed Form" in algorithms_to_simulate:
        print("Simulating Closed Form algorithm")
        closed_form_runner = ClosedFormSimulationRunner('ia_config_file.txt')

        try:
            closed_form_runner.params.remove('max_iterations')
        except KeyError:
            pass

        try:
            closed_form_runner.params.remove('initialize_with')
        except KeyError:
            pass

        pprint(closed_form_runner.params.parameters)
        # print("IA Solver: {0}\n".format(
        #     closed_form_runner.ia_solver.__class__))
        closed_form_runner.set_results_filename(
            'ia_closed_form_results_{M}-{modulator}_{Nr}x{Nt}_({Ns})')
        all_simulation_runner_objs.append(closed_form_runner)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    # xxxxxxxxxx Alt. Min. Runner xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    if "Alt Min" in algorithms_to_simulate:
        print("Simulating Alternating Minimizations algorithm")
        alt_min_runner = AlternatingSimulationRunner('ia_config_file.txt')

        try:
            alt_min_runner.params.remove('initialize_with')
        except KeyError:
            pass

        pprint(alt_min_runner.params.parameters)
        # print("IA Solver: {0}\n".format(alt_min_runner.ia_solver.__class__))
        name = ("ia_alt_min_results_{M}-{modulator}_{Nr}x{Nt}_({Ns})"
                "_MaxIter_{max_iterations}")
        alt_min_runner.set_results_filename(name)
        all_simulation_runner_objs.append(alt_min_runner)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    # xxxxxxxxxx Max SINR Runner xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    if "Max SINR" in algorithms_to_simulate:
        print("Simulating Max SINR algorithm")
        max_sinr_runner = MaxSINRSimulationRunner('ia_config_file.txt')
        pprint(max_sinr_runner.params.parameters)
        # print("IA Solver: {0}\n".format(
        #     max_sinr_runner.ia_solver.__class__))
        name = ("ia_max_sinr_results_{M}-{modulator}_{Nr}x{Nt}_({Ns})"
                "_MaxIter_{max_iterations}_{initialize_with}")
        max_sinr_runner.set_results_filename(name)
        all_simulation_runner_objs.append(max_sinr_runner)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    # xxxxxxxxxx MMSE Runner xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    if "MMSE" in algorithms_to_simulate:
        print("Simulating MMSE algorithm")
        mmse_runner = MMSESimulationRunner('ia_config_file.txt')
        pprint(mmse_runner.params.parameters)
        # print("IA Solver: {0}\n".format(mmse_runner.ia_solver.__class__))
        name = ("ia_mmse_results_{M}-{modulator}_{Nr}x{Nt}_({Ns})"
                "_MaxIter_{max_iterations}_{initialize_with}")
        mmse_runner.set_results_filename(name)
        all_simulation_runner_objs.append(mmse_runner)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    simulate_do_what_i_mean(all_simulation_runner_objs, parent_dir)

    # xxxxxxxxxx Some finalization message xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    toc = time()
    print("Total Elapsed Time: {0}".format(misc.pretty_time(toc - tic)))
Example #5
0

# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# xxxxxxxxxxxxxxx Main xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if __name__ == '__main__':
    from simulate_comp import BDSimulationRunner

    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
    # File name (without extension) for the figure and result files.
    results_filename = 'bd_results_{Nr}x{Nt}_ext_int_rank_{ext_int_rank}'
    runner = BDSimulationRunner()
    runner.set_results_filename(results_filename)
    # xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

    simulate_do_what_i_mean(runner, pyphysim_dir)

    if runner.command_line_args.index is None:
        print ("Runned iterations: {0}".format(runner.runned_reps))
        print ("Elapsed Time: {0}".format(runner.elapsed_time))


# xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
if __name__ == '__main__1':
    try:
        from matplotlib import pyplot as plt
        _MATPLOTLIB_AVAILABLE = True
    except ImportError:
        _MATPLOTLIB_AVAILABLE = False

    # xxxxxxxxxx Parameters xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx