Skip to content
Snippets Groups Projects
Commit 5948cd65 authored by George Marchment's avatar George Marchment
Browse files

added function "get_relevant_processes_which_minimize_nb_of_clusters" ->...

added function "get_relevant_processes_which_minimize_nb_of_clusters" -> started adding better ways to select the relevant processes
parent 3a052510
No related branches found
No related tags found
No related merge requests found
Pipeline #14615 failed with stage
in 2 minutes and 22 seconds
......@@ -448,6 +448,32 @@ George Marchment, Bryan Brancotte, Marie Schmit, Frédéric Lemoine, Sarah Cohen
else:
raise BioFlowInsightError("Trying to generate random relevant processes however option 'duplicate' is not activated.")
#The reduction alpha is the minimun number cluster depending on the percentage ofprocesses
#For example if there are 10 processes and reduction_alpha = 0.2 -> we want at least 2 clusters
#In the same idea if reduction_alpha = 0.4 -> we want at least 4 clusters
def get_relevant_processes_which_minimize_nb_of_clusters(self, reduction_alpha = 0.2, number_of_tries = 50):
import numpy as np
min_nb_clusters, min_relevant_processes = np.inf, []
already_tried = []
for i in range(number_of_tries):
random_relevant_processes = self.generate_random_relevant_processes()
escape = 0
while(escape<100 and set(random_relevant_processes) in already_tried):
escape+=1
random_relevant_processes = self.generate_random_relevant_processes()
#Cause it means we've already searched the majority of the possibilities
if(escape>=100):
return min_relevant_processes
already_tried.append(set(random_relevant_processes))
#Get the clusters and the code
self.generate_user_view(relevant_processes = random_relevant_processes, render_graphs=False)
clusters = self.graph.get_clusters_from_user_view()
#We want the number of clusters to be at least x% of the size of the workflows
if(len(clusters)>=reduction_alpha*len(self.get_processes_called()) and len(clusters)<min_nb_clusters):
min_relevant_processes = random_relevant_processes
min_nb_clusters = len(clusters)
return min_relevant_processes
#Method that returns the order of execution for each executor
def get_order_execution_executors(self):
dico = {}
......
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