Gitlab Community Edition Instance

Skip to content
Snippets Groups Projects
Commit cb6ddbf8 authored by Winnus's avatar Winnus
Browse files

More reasonable text output

parent 7d99bf76
No related branches found
No related tags found
No related merge requests found
......@@ -27,7 +27,13 @@ def controller():
# evolution for all phases
GAController.evolve()
# ----------------------
# Evolution has finished
# ----------------------
print()
print("Evolve finished (fitness or epoch criterion met)")
print('-------------------------------------------------')
# todo find the population with the best gene
......@@ -35,10 +41,12 @@ def controller():
# this is started inside the controller in get_fittest_individuals()
# use the below code there to implement the function...
fit_per_pop = GAController.get_population_fitness(mean=False)
m = max(fit_per_pop)
i = np.where(fit_per_pop == m)
# m = max(fit_per_pop)
# i = np.where(fit_per_pop == m)
print(f'Population fitness:{fit_per_pop}')
print()
print()
# print(GAController.populations[0].individuals[0].fitness)
......
......@@ -179,7 +179,7 @@ CONFIG_CIRCUIT_EVOLVE = {
# --------------
# defining the phases that will be sequantially evolved
'evolutionary_phases': [
PHASE0, PHASE0
PHASE0
]
}
......
......@@ -62,7 +62,7 @@ class Simple_evolutionary_phase(Evolutionary_phase):
if max_fitness > 90.9:
return True
if epochs > 30000:
if epochs > 3:
return True
return False
......@@ -322,6 +322,9 @@ class Controller:
# ----------
# phase epochs
# ----------
# save timings
ts_op_stack = []
ts_evaluate = []
while not evolutionary_phase.completed(self.get_population_fitness(), self.epochs):
# conduct a new epoch
# -------------------
......@@ -332,6 +335,7 @@ class Controller:
t_op_stack = time.time()
self.__apply_operator_stack()
t_op_stack = time.time() - t_op_stack
ts_op_stack.append(t_op_stack)
# instantiate individuals (get them a fitness value)
# tell them the phase index becaus the worker processes
......@@ -340,11 +344,15 @@ class Controller:
t_evaluate = time.time()
self.__instantiate_individuals(phase_index=p_index)
t_evaluate = time.time() - t_evaluate
ts_evaluate.append(t_evaluate)
# check if algorithm stagnates
# IMP
# To be Implemented IMP
# fusion islands but what is the condition?
# fusion islands
# meaning that you take two or more islands and combine them
# into a new island
# but what is the condition?
# whenever a new phase happens the phase can do
# this on their own.
......@@ -366,6 +374,15 @@ class Controller:
# ----------
print(f'Finished phase {evolutionary_phase}')
print('--------------------------------')
print(f'phase epochs: {self.epochs}')
print(f'min Operator Stack time: {min(ts_op_stack)}')
print(f'max Operator Stack time: {max(ts_op_stack)}')
print(f'mean Operator Stack time: {np.mean(ts_op_stack)}')
print(f'min Fitness Evaluation time: {min(ts_evaluate)}')
print(f'max Fitness Evaluation time: {max(ts_evaluate)}')
print(f'mean Fitness Evaluation time: {np.mean(ts_evaluate)}')
print(f'Pop max fitness {self.get_population_fitness()}')
print()
# print('--------------------------------')
# Evoluting finised
......@@ -377,7 +394,8 @@ class Controller:
from core.mpi_tags import mpi_tags
comm = MPI.COMM_WORLD
world_size = comm.Get_size()
print('stopping mpi workers')
print()
print('MPI was used, stopping mpi workers...')
for w_index in range(1, world_size):
comm.send(False, dest=w_index,
tag=mpi_tags.CONTINUE_PROCESSING)
......@@ -15,7 +15,7 @@ class MPI_worker():
# worker
# loop until stop is signalled
while True:
print(f'worker {self.rank} loop')
# print(f'worker {self.rank} loop')
# signaling that we are waiting for new work
self.comm.isend(None, dest=0, tag=mpi_tags.IDLE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment