new JobShop GUI instance example with ACO

parent ccb76af0
...@@ -19,7 +19,7 @@ class ACO(plugin.ExecutionPlugin): ...@@ -19,7 +19,7 @@ class ACO(plugin.ExecutionPlugin):
result, = ant['result']['result_list'] #read the result as JSON result, = ant['result']['result_list'] #read the result as JSON
#loop through the elements #loop through the elements
for element in result['elementList']: for element in result['elementList']:
element_family = element['family'] element_family = element.get('family', None)
#id the class is Job #id the class is Job
if element_family == 'Job': if element_family == 'Job':
results=element['results'] results=element['results']
...@@ -51,17 +51,17 @@ class ACO(plugin.ExecutionPlugin): ...@@ -51,17 +51,17 @@ class ACO(plugin.ExecutionPlugin):
collated[node_id] = list(node_class.getSupportedSchedulingRules()) collated[node_id] = list(node_class.getSupportedSchedulingRules())
assert collated assert collated
max_results = data['general']['numberOfSolutions'] max_results = int(data['general'].get('numberOfSolutions',0))
assert max_results >= 1 assert max_results >= 1
ants = [] #list of ants for keeping track of their performance ants = [] #list of ants for keeping track of their performance
# Number of times new ants are to be created, i.e. number of generations (a # Number of times new ants are to be created, i.e. number of generations (a
# generation can have more than 1 ant) # generation can have more than 1 ant)
for i in range(data["general"]["numberOfGenerations"]): for i in range(int(data["general"]["numberOfGenerations"])):
scenario_list = [] # for the distributor scenario_list = [] # for the distributor
# number of ants created per generation # number of ants created per generation
for j in range(data["general"]["numberOfAntsPerGenerations"]): for j in range(int(data["general"]["numberOfAntsPerGenerations"])):
# an ant dictionary to contain rule to queue assignment information # an ant dictionary to contain rule to queue assignment information
ant = {} ant = {}
# for each of the machines, rules are randomly picked from the # for each of the machines, rules are randomly picked from the
......
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