-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97bde09
commit 1dadeec
Showing
173 changed files
with
4,834 additions
and
1,218 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,35 @@ | ||
import itertools | ||
|
||
import numpy.random | ||
|
||
import configuration | ||
|
||
|
||
def create_map(nodes): | ||
return ["".join(map(str, comb)) for comb in itertools.product(*nodes)] | ||
|
||
|
||
class MatrixGenerator: | ||
weights = [] | ||
|
||
def print_combinations(self, current_combination, depth, max_depth, services): | ||
def generate_weigths(self, current_combination, depth, max_depth, services): | ||
if depth == max_depth: | ||
self.weights.append(current_combination) | ||
return | ||
|
||
for i in range(services): | ||
self.print_combinations(current_combination + [round(numpy.random.uniform(0.60, 1), 3)], depth + 1, | ||
max_depth, services) | ||
# self.print_combinations(current_combination + [0.5], depth + 1, max_depth, services) | ||
self.generate_weigths(current_combination + [round(numpy.random.uniform(0.80, 1), 3)], | ||
depth + 1, | ||
max_depth, services) | ||
|
||
def __init__(self): | ||
self.weights = [] | ||
numpy.random.seed(50 * configuration.EXPERIMENT_ID) | ||
|
||
self.NUMBER_OF_COMBINATION = configuration.NUMBER_OF_SERVICES ** configuration.NUMBER_OF_NODES | ||
# self.weights = numpy.random.uniform(0.8, 1, [self.NUMBER_OF_COMBINATION, NUMBER_OF_NODES]) | ||
self.print_combinations([], 0, configuration.NUMBER_OF_NODES, configuration.NUMBER_OF_SERVICES) | ||
self.generate_weigths([], 0, configuration.NUMBER_OF_NODES, configuration.NUMBER_OF_SERVICES) | ||
|
||
def get_weights(self): | ||
return self.weights | ||
return self.weights | ||
|
||
def get_weight(self, combination, service): | ||
return self.weights.search_combination(combination)[0][service.parent.id] | ||
# def get_weight(self, combination, service): | ||
# return self.weights.search_combination(combination)[0][service.parent.id] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
2.0 326.3257395 1233.5581545 2932.539595 | ||
3.0 677.876882 3267.887196 16750.7519065 | ||
4.0 1406.8085695 9440.2652075 41020.8520215 | ||
5.0 1814.3068795 13504.857541500001 96165.395044 | ||
6.0 2753.856167 25470.483215 |
Oops, something went wrong.