Commit bd45c6ec authored by upedk's avatar upedk
Browse files

Multiprocessing update.

parent 1962ad72
This diff is collapsed.
......@@ -21,7 +21,6 @@ def init_random_seed(job_dict):
individual = []
start = time.perf_counter()
for job_id, job_details in job_dict.items():
# Set this job's start time in individual
......@@ -29,7 +28,6 @@ def init_random_seed(job_dict):
# Add this job to individual
individual.append(start_time)
print('end init, time: ' + str(time.perf_counter() - start))
return individual
......@@ -250,7 +248,7 @@ def main_ga(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, job_dict)
# ----- EVALUATION -----
# Evaluate the individuals with an invalid fitness
print('start eval')
#print('start eval')
eval_start = time.perf_counter()
invalid_ind = [ind for ind in population if not ind.fitness.valid]
......@@ -262,7 +260,7 @@ def main_ga(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, job_dict)
ind.job_fitness = fit[0] # Assign job_fitness -> first value returned by eval
ind.fitness.values = fit[1:] # Assign individual fitness values -> rest returned by eval
print("Eval time: " + str(time.perf_counter() - eval_start))
#print("Eval time: " + str(time.perf_counter() - eval_start))
# Update hall of fame
if halloffame is not None:
......@@ -274,7 +272,7 @@ def main_ga(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, job_dict)
record = stats.compile(population) if stats else {}
logbook.record(gen=0, nevals=len(invalid_ind), **record)
print(logbook.stream)
#print(logbook.stream)
# Begin the generational process
for gen in range(1, ngen + 1):
......@@ -298,7 +296,7 @@ def main_ga(population, toolbox, cxpb, mutpb, ngen, stats, halloffame, job_dict)
ind.job_fitness = fit[0] # Assign job_fitness -> first value returned by eval
ind.fitness.values = fit[1:] # Assign individual fitness values -> rest returned by eval
print("Eval time: " + str(time.perf_counter()-eval_start))
#print("Eval time: " + str(time.perf_counter()-eval_start))
# Update the hall of fame with the generated individuals
if halloffame is not None:
halloffame.update(offspring)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
# Input files
input_data_path = './input/System Design Input v08.xlsx'
consumer_data_path = './input/Consumer Data Input v05 one month.xlsx'
# GA parameter
pop_size = 40
n_gen = 100
tourn_size = 3
crossover_prob = 0.5
mut_prob = 0.5
# Objective weights -> all minimized
power_objective = 3
blocked_hours_objective = 2
possible_hours_objective = 1
parallel_schedule_objective = 100
# timeframe_objective = -1.0 # Not needed since timeframe violations are not possible due to seeding and mutation
# General parameter
optimization_start = 0
optimization_length = 8760
#optimization_start = 2160 # April 1st
#optimization_length = 720 # One Month
# Buffer in kW of that scheduled consumption needs to be below produced power [kW].
power_buffer = 1
This source diff could not be displayed because it is too large. You can view the blob instead.
# Input files
input_data_path = './input/System Design Input v08.xlsx'
consumer_data_path = './input/Consumer Data Input v05 one month.xlsx'
# GA parameter
pop_size = 600
n_gen = 8000
tourn_size = 3
crossover_prob = 0.5
mut_prob = 0.5
# Objective weights -> all minimized
power_objective = 3
blocked_hours_objective = 2
possible_hours_objective = 1
parallel_schedule_objective = 100
# timeframe_objective = -1.0 # Not needed since timeframe violations are not possible due to seeding and mutation
# General parameter
optimization_start = 0
optimization_length = 8760
#optimization_start = 2160 # April 1st
#optimization_length = 720 # One Month
# Buffer in kW of that scheduled consumption needs to be below produced power [kW].
power_buffer = 1
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@ consumer_data_path = './input/Consumer Data Input v05 one month.xlsx'
# GA parameter
pop_size = 600
n_gen = 8000
n_gen = 10
tourn_size = 3
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4,7 +4,7 @@ consumer_data_path = './input/Consumer Data Input v05 one month.xlsx'
# GA parameter
pop_size = 600
n_gen = 8000
n_gen = 10
tourn_size = 3
......@@ -18,12 +18,11 @@ possible_hours_objective = 1
parallel_schedule_objective = 100
# timeframe_objective = -1.0 # Not needed since timeframe violations are not possible due to seeding and mutation
# General parameter
# General parameters
optimization_start = 0
optimization_length = 8760
#optimization_start = 2160 # April 1st
#optimization_length = 720 # One Month
use_multiprocessing = False
# Buffer in kW of that scheduled consumption needs to be below produced power [kW].
power_buffer = 1
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment