Example #1
0
    def callback(self, env):
        iteration = Iteration(self.run, env.iteration, self.fold)

        metrics = []

        for m in env.metrics:
            metric = {}
            metric.name = m[0]
            metric.type = m[1]
            metric.value = m[2]
            metrics.append(metric)

        iteration.record(env.params, metrics)

        self.run.add_iteration(iteration)
def add_iteration_to_project(title, description, start_date, end_date, projectID):
    if start_date is None: return None
    if end_date is None: return None
    if projectID is None: return None
    
    try:
        project = Project.objects.get(id=projectID)
    except ObjectDoesNotExist:
        return None
    
    iteration = Iteration(title=title, 
                          description=description, 
                          start_date=start_date, 
                          end_date=end_date, 
                          project= project)
    iteration.save()
    return iteration
Example #3
0
def add_iteration_to_project(title, description, start_date, end_date,
                             projectID):
    if start_date is None: return None
    if end_date is None: return None
    if projectID is None: return None

    try:
        project = Project.objects.get(id=projectID)
    except ObjectDoesNotExist:
        return None

    iteration = Iteration(title=title,
                          description=description,
                          start_date=start_date,
                          end_date=end_date,
                          project=project)
    iteration.save()
    return iteration
    def optimize(self,
                 f,
                 X_test,
                 X_initial,
                 f_X_initial,
                 convergence_criteria=5,
                 save_iterations=True):
        """
            

        save_iterations:
            A flag to save and return all iterations of optimization ran by this tool
        """
        self.log(" Optimizing...")

        X = X_initial
        f_X = f_X_initial
        iterations = []
        n_iterations = 0
        # We allow for a general convergence test defined by the user
        # Continue while this test is fales
        while not self.is_converged(convergence_criteria, n_iterations):
            self.log(" Iteration: " + str(n_iterations))
            n_iterations += 1

            # Evaluate the postier distribution - in particular grab
            # the mean and covariance at each point in X_test
            mean, covariance = self.postierier(X_test, X, f_X)

            # Evaluate the width at each point in X_test
            # of the postier.
            width = np.atleast_2d(np.sqrt(np.diag(covariance))).T

            # Using the utility function evaluate the next
            # best point to evaluate
            u, next_x, best_u = self.utility(X_test, X, f_X, mean, width)

            # Store the details so they are accesible for later
            # drawing and minipulation
            if save_iterations:
                iterations.append(
                    Iteration(mean, covariance, X, f_X, u, next_x, best_u,
                              X_test))

            X = np.vstack((X, next_x))

            self.log("Moving to position: " + str(next_x))
            f_X = np.vstack((f_X, f(next_x)))
            self.log("Next position has f: " + str(f_X[-1]))

        self.log(" Complete.")
        return iterations
Example #5
0
def recount(json_map_path, json_change_path):
    # try:
    json_map_file = File(json_map_path)
    json_change_file = File(json_change_path)
    if json_map_file.read() != {} or json_change_file.read() != {}:
        node_data = json_map_file.read().get('nodes')
        link_data = json_map_file.read().get('links')

        json_map = Map(node_data=node_data, link_data=link_data)
        scenario = Scenario(json_map)
        json_change = Iteration(scenario=scenario,
                                data_dict=json_change_file.read())
        # новая карта
        new_map = json_map.recount_iteration(
            json_change.data_dict.get('changes'))
        # перезапись файла
        json_map_file.write(new_map)
        return new_map
    else:
        return 'Необходимо создать исходные файлы'
Example #6
0
def main():
    # путь до excel
    excel_path = os.getcwd() + '/static/json/base_info.xls'

    # создание карты
    map_sber = Map("Карта сбербанка")
    map_sber.set_node_dict(excel_path, 1, 1, 17, 1, 2, 3)
    map_sber.set_link_dict(excel_path, 1, 1, 17, 5, 21)

    # dprint(map_sber.map_dict)
    # dprint(len(map_sber.map_dict.get('links')))
    # dprint(len(map_sber.map_dict.get('nodes')))

    # создание сценария
    sc = Scenario(k_map=map_sber)

    # создание итераций
    it_1 = Iteration(scenario=sc, description='Итерация 1')
    it_2 = Iteration(scenario=sc, description='Итерация 2')
    it_3 = Iteration(scenario=sc, description='Итерация 3')

    dprint('Список итераций в сценарии', sc.data_list)

    # блок реакций (по 2 реакции на 1 итерацию)
    reac_1 = Reaction(it_1)
    reac_2 = Reaction(it_1)
    reac_1.set_node_change(
        name='Число сотрудников банка',
        value=315000,
    )
    reac_2.set_node_change(
        name='Средняя ставка по кредитам',
        value=12,
    )

    reac_3 = Reaction(it_2)
    reac_4 = Reaction(it_2)
    reac_3.set_node_change(
        name='Число отделений банка',
        value=13000,
    )
    reac_4.set_node_change(
        name='Количество клиентов',
        value=130000000,
    )

    reac_5 = Reaction(it_3)
    reac_6 = Reaction(it_3)
    reac_5.set_node_change(
        name='Степень автоматизации процессов',
        value=75,
    )
    reac_6.set_node_change(
        name='Средняя ставка по депозитам',
        value=9,
    )

    # добавление изменений в итерации
    it_1.create_change_pack(excel_path, 2, 3, 9, column=1)
    it_2.create_change_pack(excel_path, 2, 3, 9, column=2)
    it_3.create_change_pack(excel_path, 2, 3, 9, column=3)

    dprint('Содержание итерации 1', it_1.data_dict)
    dprint('Содержание итерации 2', it_2.data_dict)
    dprint('Содержание итерации 3', it_3.data_dict)

    # создание json-файлов и запись в них информации
    # описание путей до json
    file_path_0 = os.getcwd() + '/static/json/json_files/k_map.txt'

    file_path_1 = os.getcwd() + '/static/json/json_files/iteration_1.txt'
    file_path_2 = os.getcwd() + '/static/json/json_files/iteration_2.txt'
    file_path_3 = os.getcwd() + '/static/json/json_files/iteration_3.txt'

    # пути до изменений итерации 1
    file_path_11 = os.getcwd() + '/static/json/json_files/change_11.txt'
    file_path_12 = os.getcwd() + '/static/json/json_files/change_12.txt'

    # пути до изменений итерации 2
    file_path_21 = os.getcwd() + '/static/json/json_files/change_21.txt'
    file_path_22 = os.getcwd() + '/static/json/json_files/change_22.txt'

    # пути до изменений итерации 3
    file_path_31 = os.getcwd() + '/static/json/json_files/change_31.txt'
    file_path_32 = os.getcwd() + '/static/json/json_files/change_32.txt'

    # создание json-карты (1)
    file_0 = File(file_path_0)
    file_0.write(map_sber.map_dict)

    # создание json-итераций (3)
    file_1 = File(file_path_1)
    file_1.write(it_1.data_dict)

    file_2 = File(file_path_2)
    file_2.write(it_2.data_dict)

    file_3 = File(file_path_3)
    file_3.write(it_3.data_dict)

    # создание json-реакций (6)
    file_11 = File(file_path_11)
    file_11.write(reac_to_iter(reac_1.data_dict))

    file_12 = File(file_path_12)
    file_12.write(reac_to_iter(reac_2.data_dict))

    file_21 = File(file_path_21)
    file_21.write(reac_to_iter(reac_3.data_dict))

    file_22 = File(file_path_22)
    file_22.write(reac_to_iter(reac_4.data_dict))

    file_31 = File(file_path_31)
    file_31.write(reac_to_iter(reac_5.data_dict))

    file_32 = File(file_path_32)
    file_32.write(reac_to_iter(reac_6.data_dict))
Example #7
0
			line = line[:com_pos]
		line = line.replace(' ','')
		if len(line) < 2:
			continue
		(key,val)=line.split('=')
		conf[key] = val
	trello_conf.close()
	return (conf['key'],conf['token'],conf['boardId'])


#--------------------------------------------------------------------------------------------------
#  MAIN
#--------------------------------------------------------------------------------------------------
CHART_CARD_NAME='BURN DOWN CHART'

iteration = Iteration()
(key, token, board_id) = get_conf()
connector = TrelloClient(key, token)
board = connector.get_board(board_id)

done_list_id = get_done_list_id(board)
charge = get_remaining_charge(board, done_list_id)
iteration.log_new_charge(charge)

print(str(date.today()) + "\t" + str(charge))

# calcul du graphique mis à jour
chart_file_name = iteration.id + '.png'
make_chart.build_chart_file( chart_file_name, iteration)

# récupération de la carte du chart