Пример #1
0
    def compute_probability(self, number_of_executions, sum_execution_time_sq, sum_execution_times):

        n = TypeConversion.get_float(number_of_executions)
        sum_xi = TypeConversion.get_float(sum_execution_times)
        sum_xi_2 = TypeConversion.get_float(sum_execution_time_sq)
        self.number_of_executions = n

        if n is None:
            Logger.error("Cannot compute std deviation! Malformed input data!")
            self.mean = None
            self.deviation = None
            return

        if n == 0:
            self.mean = None
            self.deviation = None
            return

        if n == 1 and sum_xi is not None:
            self.mean = sum_xi
            self.deviation = 0
            return

        if n > 0 and sum_xi is None or sum_xi_2 is None:
            Logger.error("Cannot compute standard deviation! Malformed input data!")
            return

        #calculation of standard deviation
        tmp = sum_xi_2 - (1/n) * sum_xi ** 2
        s = math.sqrt((1/(n - 1)) * tmp)

        self.deviation = s
        #calculation of mean
        mean = (1/n) * sum_xi
        self.mean = mean
Пример #2
0
def run_optimization_process(args, parameters):
    ts = time.time()
    st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d-%H:%M:%S')
    try:
        job = deserialize(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)

    results, extremes = process_job_parallel("PPPolicies", job, TypeConversion.get_int(args.cores), TypeConversion.get_int(args.iter), parameters=parameters)
    parameters["results"] = results
    pickle.dump(parameters, open(args.out_folder + st + ".pickle", "wb"))
Пример #3
0
def schedulerForName(name):
    schedulers = {ReferenceScheduler.__name__ : ReferenceScheduler, OptimizedDependencyScheduler.__name__ : OptimizedDependencyScheduler,
                  PPPolicies.__name__ : PPPolicies,
                  JFPol.__name__ : JFPol}
    if name is None:
        scheduler = ReferenceScheduler
    else:
        try:
            scheduler =  schedulers[name]
        except KeyError:
            Logger.error("The scheduler specified does not exist.")
            sys.exit(127)
    return scheduler
Пример #4
0
def main():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument("file", help="The pickle file containing the simulation result")
    arg_parser.add_argument("--pdf", help="specifies that the visualization should be written to a pdf file. Followed \
                            by a path")
    args = arg_parser.parse_args()
    try:
        simulation_result = load_simulation_result(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)
    visualize(simulation_result)

    if args.pdf is not None:
        plt.savefig(args.pdf)
    else:
        plt.show()
Пример #5
0
def run_optimization_process(args, parameters):
    ts = time.time()
    st = datetime.datetime.fromtimestamp(ts).strftime('%Y-%m-%d-%H:%M:%S')
    try:
        job = deserialize(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)

    results, extremes = process_job_parallel("PPPolicies",
                                             job,
                                             TypeConversion.get_int(
                                                 args.cores),
                                             TypeConversion.get_int(args.iter),
                                             parameters=parameters)
    parameters["results"] = results
    pickle.dump(parameters, open(args.out_folder + st + ".pickle", "wb"))
Пример #6
0
def main():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "file", help="The pickle file containing the simulation result")
    arg_parser.add_argument(
        "--pdf",
        help=
        "specifies that the visualization should be written to a pdf file. Followed \
                            by a path")
    args = arg_parser.parse_args()
    try:
        simulation_result = load_simulation_result(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)
    visualize(simulation_result)

    if args.pdf is not None:
        plt.savefig(args.pdf)
    else:
        plt.show()
Пример #7
0
def main():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument("file", help="The pickle file containing the simulation data")
    arg_parser.add_argument("--cores", help="The number of cores to be used.")
    arg_parser.add_argument("--iter", help="The number of iterations per core.")
    arg_parser.add_argument("--out_extremes", help="The file the extreme values should be written to.")
    arg_parser.add_argument("--out_results", help="The file all the lambdas should be written to.")
    arg_parser.add_argument("--scheduler", help="specifies the scheduler to be used. Default is referenceScheduler. \
                                                Other possible values: optimizedDependencyScheduler")
    args = arg_parser.parse_args()
    try:
        job = deserialize(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)
    results, extremes = process_job_parallel(args.scheduler, job, TypeConversion.get_int(args.cores), TypeConversion.get_int(args.iter))

    if args.out_extremes is not None:
        pickle.dump(extremes, open(args.out_extremes, "wb"))

    if args.out_results is not None:
        pickle.dump(results, open(args.out_results, "wb"))
Пример #8
0
    def compute_probability(self, number_of_executions, sum_execution_time_sq,
                            sum_execution_times):

        n = TypeConversion.get_float(number_of_executions)
        sum_xi = TypeConversion.get_float(sum_execution_times)
        sum_xi_2 = TypeConversion.get_float(sum_execution_time_sq)
        self.number_of_executions = n

        if n is None:
            Logger.error("Cannot compute std deviation! Malformed input data!")
            self.mean = None
            self.deviation = None
            return

        if n == 0:
            self.mean = None
            self.deviation = None
            return

        if n == 1 and sum_xi is not None:
            self.mean = sum_xi
            self.deviation = 0
            return

        if n > 0 and sum_xi is None or sum_xi_2 is None:
            Logger.error(
                "Cannot compute standard deviation! Malformed input data!")
            return

        #calculation of standard deviation
        tmp = sum_xi_2 - (1 / n) * sum_xi**2
        s = math.sqrt((1 / (n - 1)) * tmp)

        self.deviation = s
        #calculation of mean
        mean = (1 / n) * sum_xi
        self.mean = mean
Пример #9
0
def main():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument(
        "file", help="The pickle file containing the simulation data")
    arg_parser.add_argument("--cores", help="The number of cores to be used.")
    arg_parser.add_argument("--iter",
                            help="The number of iterations per core.")
    arg_parser.add_argument(
        "--out_folder", help="The folder to which result files are written")

    args = arg_parser.parse_args()
    try:
        job = deserialize(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)

    params = [
        {
            "listGAGen": 250,
            "listGACXp": 1.0,
            "listGAMUTp": 0.5,
            "listNoList": 10,
            "arcGAGen": 100,
            "arcGACXp": 0.5,
            "arcGAMUTp": 0.01,
            "arcGAn_pairs": 7,
            "arcGAno_p": 10,
            "name": "ArcGA mutp"
        },
        {
            "listGAGen": 250,
            "listGACXp": 1.0,
            "listGAMUTp": 0.5,
            "listNoList": 10,
            "arcGAGen": 100,
            "arcGACXp": 0.5,
            "arcGAMUTp": 0.1,
            "arcGAn_pairs": 7,
            "arcGAno_p": 10,
            "name": "ArcGA mutp"
        },
        {
            "listGAGen": 250,
            "listGACXp": 1.0,
            "listGAMUTp": 0.5,
            "listNoList": 10,
            "arcGAGen": 100,
            "arcGACXp": 0.5,
            "arcGAMUTp": 0.3,
            "arcGAn_pairs": 7,
            "arcGAno_p": 10,
            "name": "ArcGA mutp"
        },
        {
            "listGAGen": 250,
            "listGACXp": 1.0,
            "listGAMUTp": 0.5,
            "listNoList": 10,
            "arcGAGen": 100,
            "arcGACXp": 0.5,
            "arcGAMUTp": 0.5,
            "arcGAn_pairs": 7,
            "arcGAno_p": 10,
            "name": "ArcGA mutp"
        },
    ]
    run_multiple_opt(args, params)
Пример #10
0
def main():
    arg_parser = argparse.ArgumentParser()
    arg_parser.add_argument("file", help="The pickle file containing the simulation data")
    arg_parser.add_argument("--cores", help="The number of cores to be used.")
    arg_parser.add_argument("--iter", help="The number of iterations per core.")
    arg_parser.add_argument("--out_folder", help="The folder to which result files are written")

    args = arg_parser.parse_args()
    try:
        job = deserialize(args.file)
    except IOError:
        Logger.error("The file specified was not found.")
        sys.exit(127)

    params = [

            {"listGAGen": 250,
              "listGACXp" : 1.0,
              "listGAMUTp": 0.5,
              "listNoList" : 10,
              "arcGAGen" : 100,
              "arcGACXp" : 0.5,
              "arcGAMUTp" : 0.01,
              "arcGAn_pairs" : 7,
              "arcGAno_p" : 10,
              "name" : "ArcGA mutp"
            },

            {"listGAGen": 250,
              "listGACXp" : 1.0,
              "listGAMUTp": 0.5,
              "listNoList" : 10,
              "arcGAGen" : 100,
              "arcGACXp" : 0.5,
              "arcGAMUTp" : 0.1,
              "arcGAn_pairs" : 7,
              "arcGAno_p" : 10,
              "name" : "ArcGA mutp"
            },

            {"listGAGen": 250,
              "listGACXp" : 1.0,
              "listGAMUTp": 0.5,
              "listNoList" : 10,
              "arcGAGen" : 100,
              "arcGACXp" : 0.5,
              "arcGAMUTp" : 0.3,
              "arcGAn_pairs" : 7,
              "arcGAno_p" : 10,
              "name" : "ArcGA mutp"
            },

            {"listGAGen": 250,
              "listGACXp" : 1.0,
              "listGAMUTp": 0.5,
              "listNoList" : 10,
              "arcGAGen" : 100,
              "arcGACXp" : 0.5,
              "arcGAMUTp" : 0.5,
              "arcGAn_pairs" : 7,
              "arcGAno_p" : 10,
              "name" : "ArcGA mutp"
            },



    ]
    run_multiple_opt(args, params)