-
Notifications
You must be signed in to change notification settings - Fork 1
/
pt2_ACO_SEQ.py
67 lines (43 loc) · 2.31 KB
/
pt2_ACO_SEQ.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#########################################
# Created by: Joao Pedro Peters Barbosa #
# & Pedro Henrique Peters Barbosa #
# #
# email: joao.peters@engenharia.ufjf.br #
# or pedro.henrique@engenharia.ufjf.br #
#########################################
"""
Disciplina [210115] - Topicos Especiais em Otimizacao: Tecnicas Inteligentes
Desenvolvimento do programa referente ao primeiro trabalho da disciplina
Despacho Termoeletrico de Usinas com ZOP - Aplicacao de ACO
Prof.: Ivo Chaves da Silva Júnior
"""
########################################################################################################################
### ... ::: BIBLIOTECAS UTILIZADAS ::: ... ###
import numpy as np
import os
import random
### ... ::: FIM BIBLIOTECAS UTILIZADAS ::: ... ###
########################################################################################################################
########################################################################################################################
### ... ::: FUNCAO ARMAZENAMENTO DE DADOS DAS USINAS ::: ... ###
'''
Essa funcao armazena os dados de cada usina respeitando a zona operativa selecionada pela formiga.
A funcao acessa os dados lidos nos arquivos '.m' (armazenado na variavel Dados_Usinas)
e retorna uma variavel (Ants_dados) que armazena os valores de: a; b; c; Pmn; Pmax, respectivos da UTE/ZOP escolhida.
'''
def ArmazenaDadosUsina(nAnts, Ants, total_ger, nzop_ger, Dados_Usinas):
# Dados das Usinas selecionadas: caso de multiplas ZOPs
Ants_dados = np.zeros((nAnts, total_ger, Dados_Usinas.shape[1]))
for frmg in range(0, nAnts):
# Variavel auxiliar para selecionar dados corretos da usina
row = 0
for usina in range(0, total_ger):
if (nzop_ger[usina] > 1):
row = row + Ants[frmg, usina] - 1
for dados in range(0, Dados_Usinas.shape[1]):
Ants_dados[frmg, usina, dados] = Dados_Usinas[row, dados]
row = row + nzop_ger[usina] - Ants[frmg, usina] + 1
# Retorna variavel que armazenou todas os dados da usina-zop
return Ants_dados
### ... ::: FUNCAO ARMAZENAMENTO DE DADOS DAS USINAS ::: ... ###
########################################################################################################################