Commit 22ba430d authored by Jérome Perrin's avatar Jérome Perrin

ACO: use number for number properties

parent 7fd7508d
...@@ -17,14 +17,14 @@ ...@@ -17,14 +17,14 @@
] ]
}, },
"general": { "general": {
"confidenceLevel": "0.95", "confidenceLevel": 0.95,
"currentDate": "2013/01/01", "currentDate": "2013/01/01",
"maxSimTime": "-1", "maxSimTime": -1,
"numberOfAntsPerGenerations": "20", "numberOfAntsPerGenerations": 20,
"numberOfGenerations": "10", "numberOfGenerations": 10,
"numberOfReplications": "1", "numberOfReplications": 1,
"numberOfSolutions": "4", "numberOfSolutions": 4,
"processTimeout": "2000" "processTimeout": 2000
}, },
"nodes": { "nodes": {
"E1": { "E1": {
......
...@@ -14,19 +14,22 @@ class Simulation(DefaultSimulation): ...@@ -14,19 +14,22 @@ class Simulation(DefaultSimulation):
conf = DefaultSimulation.getConfigurationDict(self) conf = DefaultSimulation.getConfigurationDict(self)
conf["Dream-Configuration"]["property_list"].append( conf["Dream-Configuration"]["property_list"].append(
{ "id": "numberOfGenerations", { "id": "numberOfGenerations",
"type": "integer", "type": "number",
"name": "Number of generations",
"_class": "Dream.Property", "_class": "Dream.Property",
"_default": "10"} ) "_default": 10} )
conf["Dream-Configuration"]["property_list"].append( conf["Dream-Configuration"]["property_list"].append(
{ "id": "numberOfAntsPerGenerations", { "id": "numberOfAntsPerGenerations",
"type": "integer", "type": "number",
"name": "Number of ants per generation",
"_class": "Dream.Property", "_class": "Dream.Property",
"_default": "20"} ) "_default": 20} )
conf["Dream-Configuration"]["property_list"].append( conf["Dream-Configuration"]["property_list"].append(
{ "id": "numberOfSolutions", { "id": "numberOfSolutions",
"type": "integer", "type": "number",
"name": "Number of solutions",
"_class": "Dream.Property", "_class": "Dream.Property",
"_default": "4"} ) "_default": 4} )
return conf return conf
def _preprocess(self, data): def _preprocess(self, data):
...@@ -65,15 +68,15 @@ class Simulation(DefaultSimulation): ...@@ -65,15 +68,15 @@ class Simulation(DefaultSimulation):
if issubclass(node_class, Queue): if issubclass(node_class, Queue):
collated[node_id] = list(node_class.getSupportedSchedulingRules()) collated[node_id] = list(node_class.getSupportedSchedulingRules())
max_results = int(data['general']['numberOfSolutions']) max_results = data['general']['numberOfSolutions']
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(int(data["general"]["numberOfGenerations"])): for i in range(data["general"]["numberOfGenerations"]):
# number of ants created per generation # number of ants created per generation
for j in range(int(data["general"]["numberOfAntsPerGenerations"])): for j in range(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