Пример #1
0
 def __init__(self):
     Constant.load_constant()
     self.mode_choice = self.playing_mode()
     if self.mode_choice == 1:
         GraphicMode().play()
     elif self.mode_choice == 2:
         ConsoleMode().play()
Пример #2
0
fog_cost            = []
total_cost_fixed    = []
edge_cost_fixed     = []
fog_cost_fixed      = []
CP_cost             = []
cost_cost           = []
traffic_cost        = []

total_cost_list     = []
edge_cost_list      = []
fog_cost_list       = []

# Initial

# Constant: traffic, ratio, max_latency, least_error
constant = Constant(100, 0.01, 1, 1)

# Edge: capacity, max_servers, cost
edge = Edge(200, 5, 200)

for i in range(10):
    total_cost          = []
    edge_cost           = []
    fog_cost            = []

    # Fog_Set: ratio, edge_transmission_rate, fog_transmission_rate, capacity, total_fogs, testcase file
    # fogs_num = args.filename.split("_")
    # file_name = "testcase/"+args.filename
    # fog_set = Fog_Set(constant.ratio, 1250, 1250, 125, 5, int(fogs_num[1]), file_name)
    fog_set = Fog_Set(constant.ratio, 1250, 1250, 125, 5, 10, "testcase/Sfog_10_v" + str(i+1))
Пример #3
0
import os

from job import Job
from constant.constant import Constant
from util import util

loggerCLRunnerRuntime = Constant.getRuntimeLogger()


class DeleteFileJob(Job):
    """
    A job to delete a file
    """

    def __init__(self, filename=None):
        """
        Constructor
        @param: filename File to delete
        """
        super(DeleteFileJob, self).__init__()
        self._filename = filename

    def execute(self):
        self.willExecute()
        # Run command line
        os.remove(self._filename)
        self._status = Job.JobStatus.COMPLETED
        self.didExecute()

    def willExecute(self):
        loggerCLRunnerRuntime.info("Deleting: " + str(self._filename))
Пример #4
0
 def __init__(self):
     Constant.__init__(self)
     self.level = Level(Constant.constant['level'])
     self.player = Character(Constant.constant['player'], self.level)
Пример #5
0
from bokeh.plotting import figure, output_file, show, ColumnDataSource
from bokeh.core.properties import value
from bokeh.io import export_svgs
import random
import csv
from argparse import ArgumentParser

parser = ArgumentParser(description= "Matching Method")
parser.add_argument("edge_file", help="testcase file path")
parser.add_argument("fog_file", help="testcase file path")
args = parser.parse_args()

# Initial

# Constant: edge_transmission_rate, fog_transmission_rate, least_error
constant = Constant(1250, 1250, 1)

xaxis_list              = []
total_CP_list         = []
total_edge_CP_list    = []
total_fog_CP_list     = []
total_1_list            = []
total_3_list            = []
total_5_list            = []
cost_capacity_parm      = 1
loop                    = 50
# for server_num in range(1, 7, 2):
for server_num in range(1, 2):
    for traffic in range(0, 1050, 50):
        # Variable: traffic
        if server_num == 1:
Пример #6
0
fog_cost_fixed = []
CP_cost = []
cost_cost = []
traffic_cost = []

total_cost_list = []
edge_cost_list = []
fog_cost_list = []
total_cost_list_2 = []
edge_cost_list_2 = []
fog_cost_list_2 = []
fixed_cost = 10
# Initial

# Constant: traffic, ratio, max_latency, least_error
constant = Constant(500, 0.01, 1, 1)

# Edge: capacity, max_servers, cost
# edge = Edge(200, 5, 200)
edge = Edge(200, 5, 200)

for i in range(10):
    total_cost = []
    edge_cost = []
    fog_cost = []
    total_cost_2 = []
    edge_cost_2 = []
    fog_cost_2 = []
    # Fog_Set: ratio, edge_transmission_rate, fog_transmission_rate, vehicle_transmission_rate, capacity, total_fogs, testcase file
    # fogs_num = args.filename.split("_")
    # file_name = "testcase/"+args.filename
import os
import os.path
import logging
import sys
import traceback
import copy

from constant.constant import Constant

loggerJobCreationRuntime = Constant.getRuntimeLogger()

loggerJobCreationSuccess = logging.getLogger(__name__ + "creation-success")
loggerJobCreationSuccess.setLevel(logging.DEBUG)
ljcsFormatter = logging.Formatter('%(message)s')
ljcsfh = __name__ + "-creat-success-" + str(Constant.getLoggerTime()) + ".log"
loggerJobCreationSuccessFileHandler = logging.FileHandler(ljcsfh,
                                                          mode='w',
                                                          encoding="UTF-8")
loggerJobCreationSuccessFileHandler.setFormatter(ljcsFormatter)
loggerJobCreationSuccess.addHandler(loggerJobCreationSuccessFileHandler)
loggerJobCreationSuccess.addHandler(Constant.getRuntimeFileHandler())

loggerJobCreationSkipped = logging.getLogger(__name__ + "creation-skipped")
loggerJobCreationSkipped.setLevel(logging.DEBUG)
loggerJobCreationSkippedFormatter = logging.Formatter('%(message)s')
ljcsfh = __name__ + "-creat-skipped-" + str(Constant.getLoggerTime()) + ".log"
loggerJobCreationSkippedFileHandler = logging.FileHandler(ljcsfh,
                                                          mode='w',
                                                          encoding="UTF-8")
loggerJobCreationSkippedFileHandler.setFormatter(ljcsFormatter)
loggerJobCreationSkipped.addHandler(loggerJobCreationSkippedFileHandler)